tags:

views:

41

answers:

2

If I have a recorded audio file (MP3), is there any way to get the figure out the DTMF tones that were recorded in pure Python?

(If pure python is not available, then Java is okay too. The point being that it should be able to run in Google Appengine)

+1  A: 

Do an FFT on the data. You should get spikes at the frequencies of the two tones.

Jerry Coffin
I saw this method mentioned for WAV files. You sure it will also work for MP3?
Joseph
You have to decode the MP3 first, of course, but yes, once you've done that, the origin of the data becomes (more or less) irrelevant.
Jerry Coffin
+4  A: 

First you will need to decode the MP3 into an uncompressed format of raw samples at a given bit depth and sampling rate. Then you look for the frequencies that make up each DTMF tone. Though FFT can be used for this, the cannonical algorithm is The Goertzel Algorithm, which makes use of the fact that you know what frequencies you care about before doing the transformation: http://en.wikipedia.org/wiki/Goertzel_algorithm

There does exist some free python code for detecting DTMF using a Goertzel, though I haven't tried it myself, take a look at:

http://johnetherton.com/projects/pys60-dtmf-detector

bdk