Audio waveform visualisation in Python/Django

littlejim84 picture littlejim84 · Jul 20, 2010 · Viewed 7.2k times · Source

I've looked around Stack Overflow for an answer to this, but nowhere seems to give the correct answer or direction...

My project will allow a user to upload a WAV, which ultimately will be converted to a low quality MP3 using FFmpeg on the server and it'll all be stored and served on Amazon S3. The next obstacle is working out how to extract a reliable waveform visualisation from this uploaded sound. I'm using Python and Django on Linux Ubuntu 10 on a VPS for this project...

I'm, at the vert least, needing some sort of direction... I'm at a lost of where to start to look for such a tool?

Answer

tom10 picture tom10 · Jul 20, 2010

To make a graph or plot of the waveform, the usual Python appoach is to get the waveform into a numpy array, and then use matplotlib to make the plot.

The easiest way to read the data into a numpy array is to use scipy.io.wavfile.read, though if you prefer not to use scipy (it's a big package), it's not difficult to read and convert the data using Python's wav module.