Skip to content

Simple dtmf signal detector for Python based on FFT

License

Notifications You must be signed in to change notification settings

mark-kray/PyDtmf

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PyDTMF

Simple dtmf signal detector for Python based on FFT

A simple python script for detecting DTMF tones in time domain signals. The best practice for DTMF detection is using Goertzel algorithm to detect only select frequencies. At the time of creation, there is no easily accesible python library that implements it. Consequently, this package uses numpy's efficient FFT implementation instead. The detector function works on smaller chunks of a given signal in time domain and returns the detected DTMF tones. They are detected, when no other frequencies have significant amplitude in the input chunks. Any longer inputs should be split to ~50ms chunks before being used in the detector. Implementation specifics are explained in the code comments.

Quick-start

Input:

indata: array like object, chunk of signal samples

sample_rate: sample rate of the discrete signal

Output:

detected: string or None, detected dtmf tone

from Dtmf import detect_dtmf
detected = detect_dtmf(indata, sample_rate)

A longer signal should be split into shorter ~50 ms windows.

Examples

DtmfSignalAnalysis.py: Plots a real DMTF signal generated by a mobile phone in both time and frequency domain. Prints the most significant frequencies and the detected tone.

DtmfFromAudioInputStream.py: Live DTMF detection from an input sound device. Intended to be used with a phone connected to the microphon port. Prints detected DTMF signals.

HugoController.py: Expands on the last example, by triggering keyboard inputs for the 1997 Hugo 4 game for PC. This is intended to recreate how the game was originally played on the early 90's TV game-show. A member of the audience watching at home was selected to play the game on live TV, by inputting the commands through their telephone set.

Resources

The resources directory contains a recording of 12 standard DTMF signals generated by Huawei P30.

DTMF tone 1

DTMF tone 1

About

Simple dtmf signal detector for Python based on FFT

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages