[SciPy-user] Create a spectrogram from a waveform

David Cournapeau cournape@gmail....
Mon Sep 1 02:13:51 CDT 2008

On Mon, Sep 1, 2008 at 5:52 AM, Ed McCaffrey <ed@edmccaffrey.net> wrote:
> Thanks for the reply.  I had not heard of audiolab before, but I just tried
> using it.
> Looking at audiolab made me realize that I had forgotten how a .wav stores
> the data for multiple channels, so that was why the spectrogram I generated
> before looked so odd.

You should not have to care how it is stored, normally. audiolab gives
you one column per channel; audiolab is just a wrapper around sndfile,
which handles interleaving/deinterleaving internally if necessary.

Also, this is not well documented, unfortunately, but if you don:t
have advanced needs, you can use the high level API ala matlab:

from scikits.audiolab import wavread

If you want to compute the spectrogram without matplotlib, this is not
too difficult: a spectrogram is a short time fourier, that is fourier
transform computed on windowed parts of your signal


I hope to include a tool for automatically segmenting a signal into a
matrix of overlapping windows (implemented by A. Archibald) into numpy
after 1.2 release. With this, a spectrogram is 2-3 lines away in pure



More information about the SciPy-user mailing list