ECE 466 Dual-Tone Multi-Frequency (DTMF) Signal Decoding
Dual-Tone Multi-Frequency (DTMF) Signal Decoding
ECE 466
Dual-Tone Multi-Frequency (DTMF) Signal Decoding
• This project is to be done individually. Each student must work on the project
independently and develop own analyses and computer code in its entirety.
• Data required for this project are available for download on D2L. You will also find
reference materials and code there. Whether you begin working right away or not,
be sure you download the data and make sure you can load it into MATLAB as soon
as possible to avoid last-minute difficulties.
• Reports and MATLAB code will be graded primarily on completeness in addressing
the assignment and quality of results. Reports must be typed, not handwritten;
well-organized; and must clearly explain your design, decisions and analysis that
went into it. Code must be provided in the form specified below, and should be
commented well-enough to be clearly understandable.
1 Project Description
Touch tone™ phone pads generate so-called Dual-Tone Multi-Frequency (DTMF) signals to
communicate control and routing information over the telephone lines to the switching station.
These signals are decoded at the switching station to properly route the call and connect two
phones.
In the DTMF protocol, each digit, from 0 to 9, and the symbols ′∗′ and ′#′ are represented
by the sum of two equal-amplitude tones (sinusoids)
x(t) = A sin(2πf1t) +A sin(2πf2t) (1)
where f1 is one of four ”low” frequencies, f2 is one of four ”high” frequencies, and A is the
amplitude of the sinusoids. The total number of possible symbols represented in this way is
4× 4 = 16, and as such the system can accommodate four additional symbols. The frequencies
used by the DTMF signaling scheme are shown in Table 1. Rows of the table correspond to
1
Table 1: DTMF Keypad Frequencies
1209 Hz 1336 Hz 1477 Hz 1633 Hz
697 Hz 1 2 3 A
770 Hz 4 5 6 B
852 Hz 7 8 9 C
941 Hz * 0 # D
Table 2: Other telephone tones
Tone Frequencies Cadence
Dial Tone f1 = 350 Hz, f2 = 440 Hz Continuous
Ring Back Tone f1 = 440 Hz, f2 = 480 Hz 1 sec on + 3 sec off
Busy Tone f1 = 480 Hz, f2 = 620 Hz 0.5 sec on + 0.5 sec off
DND/No more f1 = 480 Hz, f2 = 620 Hz 0.25 sec on + 0.25 sec off
Error Tonne f1 = 480 Hz, f2 = 620 Hz 0.25 sec of each tone
Confirmation Tone f1 = 350 Hz, f2 = 440 Hz Three bursts of tone 0.1 sec on + 0.1 sec off
Transfer/Conf Tone f1 = 350 Hz, f2 = 440 Hz 0.1 sec on + 0.1 sec off
”low” frequencies, whereas columns correspond to ”high” frequencies. For example, according
to Table 1 and (1), the digit 4 is represented by
x(t) = A sin(2π770t) +A sin(2π1209t).
Note that the frequencies in the table are chosen to avoid harmonics, as none is a multiple of
any other, and none is equal to the sum or difference of any other. Symbols in the last column
are reserved for future use. When dialing a number, a dialing tone is transmitted, followed
by a sequence of 10 signals with frequencies based on Table 1, according to the number they
represent.
Additional signaling tones, besides the basic symbols, for the DTMF system are listed in
Table 2.
1.1 System specifications
Telephone quality voice signals are usually sampled at 8 kHz. This value also ensures that there
will be no aliasing even with the highest DTMF tone (1633 Hz). Specifications for the DTMF
signaling system are outlined by the International Telecommunications Union (ITU) CCITT
Red Book, vol. VI, Fascicle VI.1, Oct. 1984. Some important ones are listed below:
Frequency tolerance. Any frequency within 1.5% of the ideal frequencies in Table 1 should
be deemed as a valid signal. Any frequency above 3.5% of a valid frequency should be ignored.
2
Tone duration. Tones less than 23ms long should not be detected. Tones at least 40ms long
should always be detected. Interruptions that are less than 10ms long are not to be interpreted
as two separate signals. This implies that digits should be spaced by at least 10ms.
Frequency twists. Upper frequency must be no more than 8 dB below, or 4 dB above, the
lower frequency.
2 Project Requirements
Write a MATLAB function that accepts as input a .mat file containing an audio signal of a
DTMF (touch-tone) dialing sequence, and correctly identifies and prints out the number that
was dialed. Your processing architecture will rely on Goertzel’s algorithm to identify the tones,
but may vary in the details of the Goertzel parameters and other functions and steps that you
use. The MATLAB Signal Processing Toolbox includes a function goertzel that you may
employ.
You will also write a report for your project. Items to be included in your report:
1. An overview description of how your algorithm works. This must include a block diagram
of the major processing steps with a description of the rationale behind each step. It
should identify the major MATLAB functions or code blocks corresponding to each major
function in your block diagram.
2. A brief description of the theory underlying the processing steps. Explain the analyses
and design decisions that led to each of your parameter choices.
3. A complete listing of the MATLAB programs used. Code must be sufficiently modular and
well commented to be understood readily. Listings must also be included for any functions
used, except for those which are built into either MATLAB or its Signal Processing
Toolbox.
Upload a single .zip file containing your MATLAB code and written report on D2L by the
deadline. Late submissions will NOT be accepted. See below for further instructions on naming
the zip file and how your code must be organized. Your program will be tested by applying it
to three test signals (not the same three provided for development of your algorithm.)
Start working early. If you encounter problems, ask questions during office hours.
3 References
Several reference papers are provided in the section for this project on D2L. Although thor-
ough reading and understanding may not be necessary, you may find these sources useful for
ideas about processing approaches and pitfalls. Remember that apart from using Goertzel’s
algorithm, other details are up to you.
3
4 Data
Sample data sequences are located in the tt_samples.zip file available on D2L. The following
files are included in the zip
• Three sample touch tone audio files. Each is a MATLAB .mat file, with a name in the
form nnn-nnn-nnnn_nn.mat. The portion of the file name before the underscore character
is the phone number encoded in the file. The portion after the underscore denotes the
signal-to-noise ratio in dB. For example, a file named 517-001-4520_25.mat would be
an audio sequence dialing the number 517-001-4520 observed in noise at SNR = 25
dB. The data is always sampled at 8 kHz. Use MATLAB’s load command to load the
data, which will appear as a single vector with the name signal. You can also use the
commands sound(signal,8000) or soundsc(signal,8000) to listen to the signal. Each
sample signal includes a 1 sec dial tone at the beginning, followed by the ten digits of
the phone number, followed by 1 sec of silence. The digits are separated by quiet spaces.
Duration of the digits varies randomly between 80 ms and 400 ms, while the duration
of quiet spaces varies randomly between 50 ms and 200 ms. White noise is added at
the specified SNR, including the “quiet” spaces between the digits and the one second of
“silence” at the end. The signals will have neither short interruptions in them, nor any
frequency “twist” (imbalance between the amplitude of the two tones). There will always
be exactly 10 digits (standard U.S. telephone number), but you should not rely on this
fact in your code.
• The MATLAB file tt_create.m that was used to generate the sample data. This file will
be useful to see how the test sequences were generated, and you can use it to generate
new test sequences of your own. You can also modify this file if you want to generate
test sequences with different parameters, e.g. by introducing “twist” into the data, or
allowing interruptions in digits.
5 Signal Processing issues
The following are some considerations and questions you must deal with in designing your
decoding algorithm
1. Analysis window. You will want to analyze the frequency content of a short segment of
the signal at a time. You will need to decide the length and amount of overlap among
segments. Issues to consider include the following:
• The segment length should be long enough to provide adequate frequency resolution
between DTMF tones; and
• The segments should be short enough to recognize that there are two different tones
(digits) when they are separated by the minimum digit spacing of at least 10ms.
4
Thoroughly document and provide a rationale for your parameter choices.
2. DFT Size N : What DFT size will guarantee retrieval of the frequencies in your data
within the 1.5% accuracy required by the DTMF specification? Do you want to use one
value of N for all eight frequencies, or one for the low band and one for the high band, or
a different N optimized for each frequency you are trying to detect? As before, document
and justify your choice of N .
3. Detection threshold: Since there will be noise present, provide a mechanism to determine
if there is a signal present, or if a segment represents a ”quiet” space. Since the signal
starts out with a dial tone, you do not have the luxury of a noise-only segment at the
beginning. One approach could be to compare outputs across Goertzel filters to seek
the maximum, or alternatively compare the average output with some minimum value.
Either way, justify your thresholding mechanism.
4. High and low bands. Many DTMF structures start by filtering the data into two bands,
one passing all high tones, and the other all low tones. If you choose to do this, justify
your parameter choices.
5. Decision logic. Your basic filtering and frequency analysis will identify the frequencies
present in the data as a function of time. You will then have to devise some decision logic
to convert this information into a series of digits.
6 MATLAB code submission and evaluation
1. Your deliverable must contain the entire MATLAB code, including all functions and
subfunctions and data files required to run your algorithm on a test signal. Place all
files in a single flat directory (no subdirectories inside) and create a zip file with the
name YourLastName_YourFirstName_Project.zip. Do not include any functions that
are built into MATLAB or its Signal Processing Toolbox.
2. Your top level function must have as its first line
function digits = tt_decode(x)
Furthermore, it must work when all of the files in your zip file have been unzipped and
placed in the working MATLAB directory.
3. Your program should produce an output: that is simply the phone number that is de-
tected, in phone number format, i.e. the output should look something like
517-001-4520
5
if that was the signal passed into it.
4. Your code will be tested by executing the command
digits = tt_decode(signal)
using various test signals as the input variable signal. Be absolutely certain that
your program will run correctly when unzipped into the MATLAB work di-
rectory and this command is typed into MATLAB.
The test will consist of running your algorithm with several sound files representing various
phone numbers different from those in tt_samples with fairly good SNRs. Also a sequence
of signals corresponding to new phone numbers with SNRs decreasing from 50 dB to 20
dB in 10 dB steps, and then down to 0 dB in 5 dB steps will be applied. The purpose
of this test is to see determine the noise level at which your algorithm “breaks” (either
crashes or returns an incorrect phone number). You can use tt_create to create your
own test signals with various SNRs, in exactly the same way I will create all of my test
signals.
7 Grading
Your grade in this project will be calculated as follows:
• Code performance: 70%
– Performance on assorted high-SNR signals: 30%
– Performance on decreasing-SNR signals: 30%
– Correctness of output format: 10%
• Report: 30%
– Algorithm and parameter description and rationale: 10%
– Code listing and readability: 10%
– General report quality (complete but succinct, figs and writing): 10%
6
Appendix A Windowing
When processing even infinite duration signals, we are forced to process finite segments of them.
This is equivalent to multiplying a signal x[n] with a window w[n]
v[n] = x[n]w[n]
which in the frequency domain becomes convolution of the corresponding DTFTs
V (ejω) = X(ejω) ∗W (ejω) = 1
2π
∫ π
−π
X(ejθ)W (ej(ω−θ))dθ. (2)
In the simplest case this window is the so-called rectangular one
w[n] =
{
1, 0 ≤ n ≤ L− 1
0, otherwise
with DTFT
W (ejω) = e−jω(L−1)/2
sin(ωL/2)
sin(ω/2
.
We have also seen examples of different windows in Chap. 7 of your textbook and Lecture
9. MATLAB provides implementations of many windows and also has a ”Window Designer”
app accessible by the windowDesigner command. Fig. 1 shows the DTFT W (ejω) of a shifted
rectangular window w[n] = ejω0n, 0 ≤ n ≤ L − 1 of length L, and illustrates some important
parameters of the window. The so-called ”main lobe” of the window is centered at ω0. The
other lobes are termed ”side lobes”. The 3dB width is the range of frequencies which a signal
can pass without its power being attenuated by more than a factor of 2. Some properties, such
as the width of the main lobe, and the amplitude of the side lobes for different windows are
outlined in Table 3. Note that the window shape (type) and the length L affects the main lobe
width, and correspondingly determines the resolution in the frequency domain.
The convolution in (2) smears the DTFT of X(ejω). In the case of sinusoids, this causes
oscillations in the magnitude of the frequency response. As an example, consider the discrete-
time signal
x[n] = cos(ω0n) + 0.75 cos(ω1n), −∞ < n <∞. (3)
After windowing x[n] with a window w[n], the DTFT of v[n] is
V (ejω) =
1
2
W (ej(ω−ω0)) +
1
2
W (ej(ω+ω0)) +
0.75
2
W (ej(ω−ω1)) +
0.75
2
W (ej(ω+ω1)) (4)
so the DTFT of the window is shifted to the frequencies ±ω0 and ±ω1 and appropriately scaled.
Fig. 1 shows this effect for a rectangular window of length 64 and different values of ω1 and
ω2. From the figures we can see that the smearing caused by windowing affects our ability to
distinguish the two sinusoids, especially when their frequencies are close.
Typically, larger L decreases the mainlobe width, and consequently increases frequency
resolution, at the cost of time resolution.
7
Figure 1: DTFT of w[n] = ejω0n, 0 ≤ n ≤ L− 1.
Table 3: Comparison of commonly used windows of length L.
Type of window Peak side lobe amplitude (Relative) (dB) Approximate Width of Main Lobe 3dB Bandwidth
Rectangular −13 4π/(L+ 1) 0.89 2πL
Hann −31 8π/L 1.44 2πL
Hamming −41 8π/L 1.30 2πL
Blackman −57 12π/L 1.68 2πL