Skip to content

Instantly share code, notes, and snippets.

@ymgve
Created December 24, 2016 02:15
Show Gist options
  • Save ymgve/25c1acf97d2404a178827cceab765b0b to your computer and use it in GitHub Desktop.
Save ymgve/25c1acf97d2404a178827cceab765b0b to your computer and use it in GitHub Desktop.
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