Created
December 24, 2016 02:15
-
-
Save ymgve/25c1acf97d2404a178827cceab765b0b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import struct | |
from PIL import Image, ImageDraw | |
data = open("simone.wav.raw", "rb").read() | |
im = Image.new("RGB", (1000, 1000)) | |
draw = ImageDraw.Draw(im) | |
prev = None | |
for i in xrange(0, 0xf00, 4): | |
L, R = struct.unpack("<hh", data[i:i+4]) | |
print L, R | |
if prev is not None: | |
draw.line((prev, (L / 20, 500 + R / 20)), (255,255,255)) | |
prev = L / 20, 500 + R / 20 | |
im.save("test.png") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment