A Java program to implement a DMTF Decoder.
For the project page click here.
DTMF stands for Dual Tone Multi Frequency. This is an in-band telecommunication signalling system using voice-frequency band over telephone lines between telephone equipment and other communications devices and switching centres. DTMF is used to represent up to 16 keys (most telephones only use 12 of these). Each key is represented by two different frequencies. The first bin (lower frequencies) consist of frequencies under 1kHz and the second bin (Upper bin) consists of frequencies above 1.2kHz. The combination of the two tones will be distinctive and different from tones of other keys and these tones cannot be mimicked by voice or random signals.
The intent of this project is to design a DTMF Decoder and create a Java API for a it. I started this project while I was on a short internship at VASTech during the December 2015-January 2016 UCT vacation break. My mentor for this project was Albert Visagie (@avisagie).
The API is designed for use in programs where a DTMF signal needs to be decoded (given it is in a valid form of .mp3 file, .wav file or as an array of sample points; either as double[]
(mono) or as double[2][]
(stereo)).
double[]
/ double[2][]
).Check out this small CMD program that uses the decoder.
To use this decoder in your code, import com.tino1b2be.dtmfdecoder.DTMFUtil;
.mp3
or .wav
filesIf you have a signal you want to decoded that is saved as a .mp3
or .wav
, it can be decoded this way:
DTMFUtil dtmf = new DTMFUtil(filename);
dtmf.decode();
String left_channel = dtmf.getDecoded()[0];
String right_channel = dtmf.getDecoded()[1]; // only works if it exists else it throws an indexing error
Where filename
is the path to the .mp3
or .wav
file. More file types can be implemented using the AudioFile interface but only these two are implemented so far.
This is particularly useful if you are decoding an audio (or any signal) stream. If you have an array of samples of the signal ( from -1
to 1
with a mean of 0
) and where Fs
is the sampling frequency of the signal, the decoder can be used this way:
int Fs = 8000;
double[] samples = {/* array of samples */}
DTMFUtil dtmf = new DTMFUtil(samples, Fs);
dtmf.decode();
String sequence = dtmf.getDecoded()[0];
int Fs = 8000;
double[][] samples = {{/* array of samples from first channel */},{/* array of samples from second channel */}}
DTMFUtil dtmf = new DTMFUtil(samples, Fs);
dtmf.decode();
String[] sequence = dtmf.getDecoded();
String first_channel = sequence[0];
String second_channel = sequence[1];
A PDF version of the full report on this project can be viewed here. This report covers everything from the research made in the project, the pseudo code and algorithms used along with the motivations for using them, testing and much more. You can contact me for more information on my email ([email protected]). To find out more about me please visit my website.
The project is licensed under the MIT License.