Decoder for dual-tone multi-frequency (DTMF) signals.
- Install dependencies
pip install -r requirements.txt
- Run the demo
The script comes with 3 demos;
One for decoding the signals as they are detected, another one for live plotting the signals, and lastly one for executing commands when a predefined signal was detected.
Live decode:
python -m dtmf_decoder
Live plot:
python -m dtmf_decoder live-plot
Command decoder:
python -m dtmf_decoder command-decoder
The decoding process works in the following series of steps:
-
The input signal is fed into a Goertzel filter which allows us to unravel the signal into frequencies and their associated energy levels.
-
The two frequencies with the highest energy levels are picked and mapped to the closest lower and higher frequencies according to the DTMF keypad matrix.
-
Finally the mapped frequencies are looked up in a "keypad table" with the result being the key that was encoded in the DTMF signal.
Example plot for a DTMF signal representing the key "7" along with its Goertzel filtered output.
I thought this was a fun project to do in my free time to get the basic idea of how DTMF signaling works and was mainly inspired by this scene from The Hummingbird Project where Anton sent commands to his computer over a telephone network from jail.