3

I'm trying to create a spectrogram object for audio analysis.

I'm using Snack Library. This library, create the spectrogram as a canvas object but I
should use the spectrogram as a numerical object (every 10 ms I should extract the vector of frequencies).

This is the code of Snack Library:

c = tkSnack.SnackCanvas(root, height=400)
c.pack()
c.create_waveform(0, 0, sound=mysound, height=100, zerolevel=1)
c.create_spectrogram(0, 150, sound=mysound, height=200)

I'm looking for tutorials online but I only found ways to draw the spectrogram.

Thanks a lot!

elviuz
  • 639
  • 1
  • 7
  • 26
  • Is there a reason to think Snack will do this? I haven't used the library for years, but this is primarily because one runs into simple limitations like this very quickly. – tom10 Feb 20 '14 at 00:32
  • Ok... do you know another (good) library for audio analysis in python? – elviuz Feb 20 '14 at 22:16
  • I don't know of a good library specifically designed for only audio analysis. Personally, I just use the tools available in the standard packages like matplotlib (which has a reasonable spectrogram), numpy, scipy, etc. – tom10 Feb 21 '14 at 01:54
  • OK. I wrote it up as an answer so I could provide more specific links, etc. Personally, I've found this more generalized approach very useful. – tom10 Feb 21 '14 at 15:57
  • 1
    What do you mean with "every 10 ms I should extract the vector of frequencies"? A 10ms hop for a data blockenizer or a 10ms rate for drawing like [this time and spectra animated plot example](https://github.com/danilobellini/audiolazy/blob/c554181e5780e0203877ce78f15e20fcb3e66209/examples/animated_plot.py) in [AudioLazy](https://github.com/danilobellini/audiolazy), my DSP package? – H.D. May 23 '14 at 22:23

1 Answers1

2

For audio analysis I just use a combination of the generalized data analysis tools. Here are the tools I use for audio:

reading and writing .wav files:
Python wave module, and scipy.io.wave These work for most .wav files, but not the very unusual formats

FFTs:
numpy rfft and friends (rfftfreq is particularly useful with rfft)

spectrograms and more general graphs:
matplotlib and, in particular matplotlib's specgram

tom10
  • 67,082
  • 10
  • 127
  • 137