开发者

Python, C/++,java... any api's for comparing audio signals?

Does anyone know of a library for either python, c(++), or java , or even an external app, that I can use to check for a specific audio distortion in an mp3? My problem is this: I have a very robust Django app that automatically does podcasting for a r开发者_高级运维adio station for all the different shows, but about once a week the computer that does the actual recording records corrupted audio, that has a specific interence pattern, it's a chopping sound almost like a helicopter where the audio drops several times a second. I'm not hoping to fix those audio files(as I've tried manually with good editing software and it's just a lost cause) but rather detect weither or not that type of corruption is present so I can switch to the back-up version of the recording automatically. external tools should ideally run on linux, but windows is acceptable as long as it is headless(no forced gui).

Thanks.


I think all you will need to do is do an fft on the mp3 and you should see a really low frequency spike which corresponds to the big drops. I'm no dsp guru though so not sure that this will work, but its easy to try.

You can use the numpy library for python for this. Link

just read in the mp3 file into an array and then do an fft, for a test I would recommend just plotting it first (using maptlotlib for example), with both versions, corrupt and good and see if you can easily detect the corrupt version. Then hopefully you can write a simple algorithm to detect corrupted files from there fft's.

For reading in the mp3 into a data buffer you can use PyMedia http://pymedia.org/

I haven't used PyMedia so i'm not sure on reading the mp3 into a buffer (it shouldn't be too complicated I imagine), but after that plotting the fft is as simple as:

from numpy import *
from numpy.fft import *
import pylab

# place code to read the mp3 file into buf[] here.

buf_fft = fft(buf, 1024)
pylab.plot(fftfreq(1024, 0.1), abs(buf_fft))
pylab.show()


Try BASS Library and see if it has what you are looking for.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜