I am trying to plot a spectogram straight from an mp3 file in python 2.7.3 (using ubuntu). I can do it from a wav file as follows.
#!/usr/bin/python
from scikits.audiolab import wavread
from pylab import *
signal, fs, enc = wavread('XC124158.wav')
specgram(signal)
show()
What's the cleanest way to do the same thing from an mp3 file instead of a wav? I don't want to convert all the mp3 files to wav if I can avoid it.
Best Answer
I'd install the Debian/Ubuntu package libav-tools and call
avconv
to decode the mp3 to a temporary wav file:Edit: Your other question was closed, so I'll expand my answer here a bit with a simple bandpass filtering example. In the file you linked it looks like most of the birdsong is concentrated in 4 kHz - 5.5 kHz.