All Projects → ribt → dtmf-decoder

ribt / dtmf-decoder

Licence: other
Extract phone numbers from an audio recording of the dial tones.

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to dtmf-decoder

DtmfDetection
C# implementation of the Goertzel algorithm for DTMF tone (a.k.a. Touch-Tone) detection and localization in audio data. Includes wrappers and extensions for NAudio.
Stars: ✭ 32 (-82.12%)
Mutual labels:  dtmf, dtmf-decoder
Recorder
html5 js 录音 mp3 wav ogg webm amr 格式,支持pc和Android、ios部分浏览器、和Hybrid App(提供Android IOS App源码),微信也是支持的,提供H5版语音通话聊天示例 和DTMF编解码
Stars: ✭ 2,891 (+1515.08%)
Mutual labels:  dtmf
dxkSynthDefs
some synth defs for SuperCollider
Stars: ✭ 21 (-88.27%)
Mutual labels:  dtmf
DTMF-Decoder
A Java program to implement a DMTF Decoder.
Stars: ✭ 28 (-84.36%)
Mutual labels:  dtmf-decoder

DTMF decoder

(Sorry for my English, I'm not dumb but French. Feel free to make a PR to correct this README.)

Have you always dreamt of finding the phone number dialled by someone in a video? It's possible now! All you have to do is record the audio of the beeps and this script will extract the phone number for you from the dial tones.

Installation

(If you are on Mac or Windows, go to hell.)

$ git clone https://github.com/ribt/dtmf-decoder.git
$ cd dtmf-decoder/
$ sudo python3 -m pip install -r requirements.txt --upgrade
$ chmod +x dtmf.py
$ sudo cp dtmf.py /usr/local/bin/dtmf

Usage

You have to give a wav file (you can try to convert it with ffmpeg -i audio.mp3 audio.wav for example).

Usage: dtmf [-h] [-v] [-l] [-r] [-d] [-t F] [-i T] file.wav

optional arguments:
  -h, --help     show this help message and exit
  -v, --verbose  show a complete timeline
  -l, --left     left channel only (if the sound is stereo)
  -r, --right    right channel only (if the sound is stereo)
  -d, --debug    show graphs to debug
  -t F           acceptable frequency error (in hertz, 20 by default)
  -i T           process by T seconds intervals (0.05 by default)

Examples

You can test this script with these examples :

The perfect case

$ dtmf perfect-example.wav
0123456789

As you can see it works perfectly, we have a classical French phone number.

The non-perfect case

$ dtmf not-perfect-example.wav
012374526789

We can guess there is a problem because we have more than ten numbers. So try the verbose output:

$ dtmf -v not-perfect-example.wav
0:00 ...................0
0:01 0..........1111.....
0:02 .....222............
0:03 33........7.......44
0:04 .......5..........2.
0:05 .66666............77
0:06 777.............888.
0:07 ..........99........
0:08 .................

We can guess there are false positives so try to decrease the tolerance:

$ dtmf -v -t 10 not-perfect-example.wav 
0:00 ...................0
0:01 0..........111......
0:02 .....222............
0:03 3..................4
0:04 .......5............
0:05 ..66.6..............
0:06 7...............88..
0:07 ...........9........
0:08 .................

The number 6 must have been split into two so the number is 0123456789.

How it works

This script is quite simple. We split the signal into frames and we analyse them one by one. We calculate a Fast Fourier Transorm to find its constituent frequencies. We find the frequencies with the bigger amplitude and we compare them with the DTMF's (dual-tone multi-frequency) frequencies.

DTMF keypad frequencies from Wikipedia:

array of dial tones' frequencies from Wikipedia

Graph explaining the functioning :

graphs

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].