This code is a development of John Etherton's original decoder based on the Goertzel algorithm it features a number of improvements and tweaks to increase speed and accuracy.
It requires a mono 16bit 16KSps WAV file as input and produces a text output string comprising the dialed number.
Add it to your python project like so:
from DTMFdetector import DTMFdetector dtmf = DTMFdetector(16000) data = dtmf.getDTMFfromWAV('wavfile.wav') print(data)
I recommend the sox utility to convert whatever audio source you may have into the required WAV format, eg:
sox -q --volume 0.9 infile.mp3 -b16 -r16000 -c1 wavfile.wav
Note that to work with mp3, sox may require additional MAD and LAME downloads.
It's offered here under the usual GPL license blah blah.
Download