Report by:
Tafseer Ahmad
Supervisor:
Dr. Aladdin M. Ariyaeeinia
APRIL 2008
DECLARATION STATEMENT
I certify that the work submitted is my own and that any material derived or quoted from the
published or unpublished work of other persons has been duly acknowledged (ref. UPR
AS/C/6.1, Appendix I, Section 2 Section on cheating and plagiarism)
Signed:
Date: 07 April 2008
ABSTRACT
Dual-tone Multi-frequency (DTMF) signals are used in touch-tone telephones as well as many
other areas such as interactive control, telephone banking, and pager system. These signals
should decode correctly otherwise they can interfere with speech signal and cause disturbance
during telephone conversation. This report introduces DTMF detection algorithms and describes
how these algorithms are used to achieve decoding. Advantages of both the FFT and Goertzel
algorithm are taken into consideration and both approaches have been compared. The
developed algorithms were implemented in MATLAB. Simulation results of both the algorithms
are included. The MATLAB code developed for this project is given in Appendix B and the GUI
designed for this project is given in Appendix C.
ACKNOWLEDGEMENTS
In the process of learning, one owes a debt of gratitude to everyone who can spare even a
moment to educate those who have yet to learn a lot. I have benefited from the help and
guidance of many people all of whom willingly offered their time and valuable inputs. My first
and lasting thanks are indeed for Almighty and all knowledgeable Allah who endowed me with
the spirit to learn.
I am indebted to Dr. Aladdin M. Ariyaeeinia, my learned Professor who has exhorted and
pushed me on the path of discovery and learning. My thanks are also due to my family and
friends whose support and prayers gave me courage to pursue my dreams. If this paper has
succeeded in a modest way in bringing to fore the basics of the subject, it is because I got good
guidance and help. Any shortcomings are mine alone.
ii
TABLE OF CONTENTS
DECLARATION STATEMENT ........................................................................................................i
ABSTRACT .....................................................................................................................................i
ACKNOWLEDGEMENTS .............................................................................................................. ii
TABLE OF CONTENTS ................................................................................................................ iii
LIST OF FIGURES .........................................................................................................................v
GLOSSARY ................................................................................................................................... vi
1. Introduction ................................................................................................................................ 7
1.1 Background ......................................................................................................................... 7
1.2 Definition: ............................................................................................................................ 7
1.3 Function .............................................................................................................................. 8
1.4 Application .......................................................................................................................... 9
1.5 Specification ........................................................................................................................ 9
1.6 Aim and Objectives: .......................................................................................................... 10
1.6.1 Project Aim: ............................................................................................................... 10
1.6.2 Objectives: ................................................................................................................. 10
1.7 Report Structure: ............................................................................................................... 10
1.8 Summary........................................................................................................................... 11
2. Methods of decoding DTMF Signals ....................................................................................... 12
2.1 Introduction: ...................................................................................................................... 12
2.2 Discrete Fourier Transform: .............................................................................................. 12
2.2.1 Definition .................................................................................................................... 12
2.2.2 Periodic property of DFT ........................................................................................... 13
2.2.3 Symmetric property of DFT ....................................................................................... 13
2.3 FFT Algorithm ................................................................................................................... 14
2.4 Goertzel Algorithm: ........................................................................................................... 16
2.5 Comparison between FFT Algorithm and Goertzel Algorithm: ......................................... 18
2.6 Summary........................................................................................................................... 19
3. System Implementation ........................................................................................................... 20
3.1 Introduction ....................................................................................................................... 20
3.2 DTMF Generation ............................................................................................................. 20
3.2.1 Table Look Up Method .............................................................................................. 20
3.2.2 Taylor Series Expansion:........................................................................................... 21
3.3 DTMF Detection ................................................................................................................ 21
3.3.1 FFT Algorithm ............................................................................................................ 21
3.3.2 Goertzel Algorithm ..................................................................................................... 21
3.4 Software Implementation .................................................................................................. 23
3.4.1 Importance of MATLAB ............................................................................................. 23
iii
iv
LIST OF FIGURES
Figure 1 DTMF Key Pad [1] .......................................................................................................... 8
Figure 2 DFT symmetry of real-valued signal (a) Even-symmetry in DFT sense(b) [9] ............. 13
Figure 3 The initial decomposition of a length-8 DFT into the terms using even- and
odd-
GLOSSARY
DTMF: Dual Tone Multiple Frequency
DFT: Discrete Fourier Transform
FT: Fourier Transform
DTFT: Discrete Time Fourier Transform
FFT: Fast Fourier Transform
ITU: International Telecommunication Union
GUI: Graphical User Interface
vi
1. Introduction
Dual-tone multi-frequency (DTMF) is an international signaling standard for telephone digits.
These signals are used in touch-tone telephone call signaling as well as many other areas
such as interactive control applications, telephone banking, and pager systems. A DTMF
signal consists of two superimposed sinusoidal waveforms whose frequencies are chosen
from a set of eight standardized frequencies. These frequencies were chosen in Bell
Laboratories, where DTMF signaling system was originally proposed as an alternative to
pulse dialing system in telephony.
1.1 Background
The concept of dual tone multiple frequency (DTMF) was conceived in late 1950s which
enabled telephone systems to dial long distance numbers for wired links in general and nonwired links in particular which includes microwave radio relay links or satellites. It is widely
used with push-button telephone sets, which provide a high dialing speed over the pulse-dial
signaling, used in traditional rotary telephone sets. The concept of pulse dialing or loop
disconnect works by continuously connecting and disconnecting the calling partys telephone
line. The repeated connection and disconnection, as the dial spins, sounds like a series of
clicks. The number of clicks or dial pulses to determine the called number. Three dial pulses
or clicks mean the number three has been dialled while ten dial pulses mean the number
zero has been dialled. Low dialling speed and problems with long distance call were the
main disadvantages of pulse dialing and pulse dialing was replaced by DTMF dialling [3].
1.2 Definition:
A DTMF signal consists of a sum of two tones with frequencies taken from two mutually
exclusive groups of pre-assigned frequencies. Each pair of such tones represents a unique
number or a symbol. Due to combination of two frequencies, the term dual tone multiple
frequency has been used. Decoding of a DTMF signal involves identifying the two tones in
that signal and determining their corresponding number or symbol [2]. The DTMF keypad is
visualized as a 44 matrix, with two group of frequencies. The rows represent low frequencies
and column represent high frequencies. A standard DTMF key pad is shown in figure 1.1. It
consists of 16 digits which include ten numbers from 0-9, four alphabets A,B,C,D and two
symbols * and # [3].
1.3 Function
A DTMF signal is generated by adding two frequencies, one taken from the row frequencies
which are the low frequencies and the other taken from column frequencies which are the
high frequencies. DTMF keypad are eight standardized frequencies, which comply with the
International Telecommunication Union standards. These frequencies are selected in a way
that addition, subtraction and multiplication of any two frequencies will not lead to any other
frequency in these standard eight frequencies [2]. This will make the decoding easier and
avoid possible confusion between speech and DTMF tone. Table 1 shows each digit with its
corresponding frequencies. By pressing the number 5, a signal consisting of frequencies
770 Hz and 1336 Hz will be generated. Similarly, by pressing the number 9, a signal
consisting of frequencies 852 Hz and 1477 Hz will be generated.
Key
941
1336
697
1209
697
1336
697
1477
770
1209
770
1336
770
1477
852
1209
852
1336
852
1477
941
1209
941
1477
697
1633
770
1633
852
1633
941
1633
1.4 Application
Initially DTMF systems were only limited to telephone dialing but in recent years, it has also
found applications requiring interactive control such as in voice mail, electronic mail (e-mail),
telephone banking, pager systems and ATM machines [2]. In telephone systems, it provides
fast dialing speed as compared to traditional rotary phones. Same amount of time is required
to dial any number. For example, to dial an 11 digit number in DTMF dialing will consume
same amount of time to dial 0 [4] [5].
1.5 Specification
The difficulty of DTMF tone detection is due to the standards, which must be satisfied when
these signals are detected. International Telecommunication Union (ITU) is an international
body, which provide recommendations on DTMF. A summary of ITU and Bellcore's DTMF
standards and recommendations are given below [1]:
1) Signal frequencies:
Low group (Hz): 697, 770, 852, 941
High group (Hz): 1209, 1336, 1477, 1633
2) Frequency tolerances:
a. Frequencies with an offset less than +/-1.5% must be accepted.
b. Frequencies with an offset more than +/-3.5% must be rejected.
1.6.2 Objectives:
These aims will be achieved by:
1. Decoding DTMF signals using FFT
2. Decoding DTMF signals using Goertzel algorithm
3. Comparing the results achieved from both algorithms
4. Creating a graphical user interface (GUI) for the project
Chapter 3: This chapter will look into the system implementation and describes how both
algorithms have been implemented for decoding DTMF signals. It also explains the
significance of using MATLAB for this project.
Chapter 4: This chapter will explain the procedure adopted to complete the project. It will
include the programming done in MATLAB to decode the DTMF signals. Results of
simulations of both the algorithms will be included here and these results will be analyzed and
discussed.
Chapter 5: This chapter concludes the work carried out. It describes the project aim and
objectives completed successfully and an explanation will be given on the areas where the
project can be improved in the future.
Appendix A: This appendix includes the Gantt chart of the project, which shows the time
allocated to each task and actual time taken by each task. It indicates how the overall project
has been managed.
Appendix B: This appendix includes the software code implemented in MATLAB for decoding
DTMF signals.
10
Appendix C: This appendix includes the simulations and GUI. It explains how to use it and
how the DTMF tones are decoded visually.
1.8 Summary
This chapter provides an introduction about the project and gives basic theory about the
topics covered in the report and also gives an overview about the chapters included in the
report.
11
2.2.1 Definition
It is assumed that the signal x (n) to be analyzed is a sequence of N real or complex values
which are a function of the integer variable n. The DFT of x (n), also called the spectrum
of x (n), is a length N sequence of complex numbers is given by [6][7][8]:
(1)
A simple description of this equation is that the complex numbers Xk represent the amplitude
and phase of the different sinusoidal components of the input signal xn. The DFT computes
the Xk from the xn. By writing the equation in this form, sinusoids are expressed in terms of
complex exponentials, which are much easier to manipulate [6]. From equation (1), the
exponential basis functions are the N values of the Nth roots of unity. This property is what
connects the DFT to convolution and allows efficient algorithms for calculation to be
developed [8].
12
(2)
Figure 2 DFT symmetry of real-valued signal (a) Even-symmetry in DFT sense(b) [9]
Basically, the computational problem for the DFT is to compute the sequence {X(k)} of N
complex-valued numbers given another sequence of data {x(n)} of length N, according to the
formula [10]:
(3)
(4)
In general, the data sequence x(n) is also assumed to be complex valued. Since, for each
value of k, direct computation of X(k) involves N complex multiplications (4N real
multiplications) and N-1 complex additions (4N-2 real additions). Consequently, to compute all
N values of the DFT requires N
Direct computation of the DFT is basically inefficient primarily because it does not exploit the
symmetry and periodicity properties of the phase factor W N [10]. In particular, these two
properties are:
13
(5)
(6)
In 1965, IBM researcher Jim Cooley and John Tukey developed the Fast Fourier Transform
(FFT). It is an algorithm for computing that DFT that has order O (N log N) for certain length
inputs. Now when the length of data doubles, the spectral computational time will not
quadruple as with the DFT algorithm; instead, it approximately doubles. After the FFT's
rediscovery, not only was the computation of a signal's spectrum greatly speeded, but also
the added feature of algorithm meant that computations had flexibility not available to analog
implementations [11].
FFT simply reuses the computations made in the half-length transforms and combines them
through additions and the multiplication by exponential term, which is not periodic over N/2, to
rewrite the length-N DFT. Figure 3 illustrates this decomposition. Now two length-N/2
2
transforms O(N ) can be computed and then one of them can be multiplied by the complex
exponential (complexity O (N)), and results can be added together (complexity O (N)). The
total complexity is still dominated by the half-length DFT calculations, but the proportionality
coefficient has been reduced [7][11].
14
Figure 3 The initial decomposition of a length-8 DFT into the terms using even- and
odd-indexed inputs [11]
Each of the half-length transforms can be reduced to two-quarter length transforms, each of
these to two eighth-length ones, etc. This decomposition continues until length-2 transforms
will be left. This transform is quite simple, involving only additions. Thus, the first stage of the
FFT has N/2 length-2 transforms as shown in figure 3. Pairs of these transforms are
combined by adding one to the other multiplied by a complex exponential. Each pair requires
4 additions and 4 multiplications, giving a total number of computations equaling 8(N/4) = N/2.
This number of computations does not change from stage to stage. Because the number of
stages, the number of times the length can be divided by two, equals log 2N, the complexity of
the FFT is O (N log2 N) [7][11][12].
15
According to figure 4, the length-8 DFT is divided into two length-4 DFTs, with the outputs
added and subtracted together in pairs. From figure 3 as the frequency index goes from 0
through 7, the values from the length-4 DFTs are recycled into the final calculation because of
the periodicity of the DFT output. Examining how pairs of outputs are collected together, the
basic computational element known as a butterfly was created as shown in figure 5. By
considering together the computations involving common output frequencies from the two
half-length DFTs, it seems that the two complex multiples are related to each other, and these
multiples can reduce the computational work even further [11][12].
The FFT takes N points of input data and produces an output sequence of N points
corresponding to the DFT of the input data. Since the FFT algorithm performs the
computation of DFT in (N/2) log2N multiplications and N log2N additions for an N-point
sequence. There are some applications where only a selected number of values of the DFT
are desired, but the entire DFT is not required. In such a case, the FFT algorithm may no
longer be more efficient than a direct computation of the desired values of the DFT. In fact,
when the desired number of the values of the DFT is less than log 2N, a direct computation of
the desired values is more efficient [7] [12].
16
Unlike the FFT or DFT, the Goertzel algorithm does not need a complete block of data before
it can begin processing [14].
Goertzel's algorithm is useful for computing a few frequency values; if many or most DFT
values are needed, FFT algorithms that compute all DFT samples in O(NlogN) operations are
faster. Goertzel's algorithm can be derived by converting the DFT equation into an equivalent
form as a convolution, which can be efficiently implemented as a digital filter [13]. The DFT
equation is given as:
(7)
(8)
(9)
(10)
(11)
12)
Note that this last expression can be written in terms of a recursive difference equation.
(13)
where y (1) = 0. The DFT coefficient equals the output of the difference equation at time
n = N:
(14)
Expressing the difference equation as a z-transform will lead to the following:
(15)
(16)
(17)
This system is realized in the structure in Figure 6.
17
For this system y(n) not for all n, but only for n = N. So only the recursive part can be
computed, or just the left side of the flow graph in Figure 2.4, for n = [0, 1, . . . ,N], which
involves only a real/complex product rather than a complex/complex product as in a direct
DFT, plus one complex multiply to get y (N) = X (k) [13]. If the data are real-valued, only real
multiplications and real additions are needed until the final multiply. The computational cost of
Goertzel algorithm is thus 2N + 2 real multiplies and 4N 2 real adds, a reduction of almost a
factor of two in the number of real multiplies relative to direct computation via the DFT
equation. If the data are real-valued, this cost is almost halved again [13].
2.5
Comparison
between
FFT
Algorithm
and
Goertzel
Algorithm:
The advantages of Goertzel algorithm approach over FFT and other algorithms are two-fold:
1) it is computationally more efficient, and 2) the value of the DFT can be computed at any
frequency desired [2]. The extent to which the Goertzel algorithm is more efficient than other
algorithms depends on the number of frequencies at which the DFT is to be computed. Each
iteration of the Goertzel algorithm requires one real multiplication and two real additions. If the
value of the DFT is required at M points, then the total cost for computing the DFT is M*N
multiplications and 2*M*N additions. For values of M < Log N, Goertzel algorithm is less
expensive computationally than an FFT algorithm which is O(N*Log N) [13][15].
A second advantage to Goertzel algorithm is that, unlike FFT algorithm require N and N to be
equal and a power of 2, Goertzel algorithm places no artificial constraints on these values.
Hence, Goertzel algorithm may be used to compute the value of the DFT at any frequency,
and with any value of N. This is critical in DTMF detection because the resolution between
frequencies decreases as the value of N decreases. If the FFT were used, the value of the
18
DFT could be computed only at N equally spaced frequencies, which may or may not
correspond to the frequencies of interest. The fact that any value of N may be used with
Goertzel algorithm is also highly beneficial, the optimal range of N is about 150 400 [7][12]
[15].
2.6 Summary
This chapter described different approaches to decode DTMF signals. It explained DFT, and
then provided a theoretical background of FFT and Goertzel algorithm. Both of these
algorithms are used to compute the DFT. In the end, both the algorithms have been
compared in terms of their performance.
19
3. System Implementation
3.1 Introduction
This chapter will describe the methods adopted for system implementation. It will explain the
DTMF generation process, which includes the table look-up method and the Taylor series
expansion. It also explains the DTMF detection process using both the approaches that is
FFT and Goertzel algorithm and describes the software implementation.
Fs
Fo * I = integer number of samples
Where:
Fs = sampling frequency
Fo = frequency of interest
The period of the frequency to be generated must be evenly divisible by a multiple of the
sampling rate. This method can require large amounts of memory if the frequency is not an
easy divisor of the sampling rate. If there are numerous frequencies to generate, or the
frequency is unknown beforehand, then the table look-up method may not be the best
solution [5].
20
(18)
where 0 < x < p/2. Note that x is in radians and that the other three quadrants must be
accounted for by manipulating the sign and the input value, x. The Taylor series expansion
method requires more computations but less memory than the table look-up method [5].
21
The DTMF decoder computes the DFT samples closest in frequency to the eight DTMF
fundamental tones and their respective second harmonics. It also computes the DFT samples
closest in frequency to the second harmonics corresponding to each of the fundamental tone
frequencies. The second computation is employed to distinguish between speech and the
pure sinusoids generated by the DTMF signal. In general, the spectrum of speech contains
components at all frequencies including the above second harmonics frequencies. On the
other hand, the DTMF signal generated has negligible second harmonics [2] [5]. Table 2
shows DFT index values for DTMF tones and their second harmonics.
Basic Tone in
Exact k value
Hz
Nearest integer k
Absolute
value
error in k
697
17.861
18
0.139
770
19.731
20
0.269
852
21.833
22
0.167
941
24.113
24
0.113
1209
30.981
31
0.019
1336
34.235
34
0.235
1477
37.848
38
0.152
1633
41.846
42
0.154
Second
Exact k value
Nearest integer k
Absolute
value
error in k
harmonic
in
Hz
1394
35.024
35
0.024
1540
38.692
39
0.308
1704
42.813
43
0.187
1882
47.285
47
0.285
2418
60.752
61
0.248
2672
67.134
67
0.134
2954
74.219
74
0.219
3266
82.058
82
0.058
Table 2:DFT index values for DTMF tones and their second harmonics [2]
The DFT length N determines the frequency spacing between the location of the DFT
samples and the time it takes to compute the DFT sample. A large N makes the spacing
smaller, providing higher resolution in the frequency domain but increases the computation
time. The frequency fk in Hz corresponding to the DFT index (bin number) k is given by [2]:
(19)
k=0,1N-1
22
where fs is the sampling frequency. If the input signal contains a sinusoid of frequency
different from that given above, then its DFT will contain not only large valued samples at
values of k closest to (N fin/fs) but also non zero values at other value of k due to a
phenomenon called leakage. To minimize the leakage, it is appropriate to choose N in a way
that the tone frequencies fall as close as possible to a DFT bin thus providing a very strong
sample at this index value relative to all other values. For 8kHz sampling frequency, it was
determined that the best value of the DFT length to detect the eight fundamental DTMF tones
to be 205 and that for detecting the eight second harmonics is 201[2]. Eight DFT samples can
be calculated if sampling frequency, input frequency and number of DFT sample are given
and then by measuring the energy present at these eight frequencies, the corresponding
DTMF signal can be decoded.
This project can be implemented both in MATLAB as well as in programming languages such
as C and C++. MATLAB has been used due to the following reasons [16]:
Arrays, matrices and vectors are very easy to use in this software.
It also contains many helpful commands created by past users and are collected into
tool boxes that meet the need of specialist areas of engineering such as digital signal
processing and other areas.
23
3.5 Summary
This chapter described the methods adopted for system implementation. It explained the
DTMF generation process, which includes the table look-up method and the Taylor series
expansion. It also elucidated the DTMF detection process using both the approaches that is
FFT and Goertzel algorithm. It also described the software implementation.
24
25
At this stage, both the high and low frequency signals are filtered and shown below in the time
domain. The figure 9 shows the program code, which generates filtered high frequency and
low frequency signal in time domain while figure 10 shows the simulation result of the filtered
high frequency and low frequency signal in time domain.
Figure 9 Program Code to generate filtered high frequency and low frequency signals
Figure 10 Filtered high frequency and low frequency signals when key 4 is pressed
26
27
Figure 12 Program Code to compute the DFT of DTMF signal and to decode the
frequencies using goertzel function in MATLAB
Figure 13 Key 9 is decoded at approximately half the desired frequency (852 Hz, 1477
Hz)
28
4.5 Discussion
It can be seen from the simulation results obtained that the DTMF signals have been
generated correctly by adding two corresponding frequencies. The decoding part of the
29
project was also partially successful as it decoded the DTMF signals but at half the desired
frequencies. Also the keys pressed were calculated and displayed on the GUI. It is tried to
implement and correct the problem of decoding of undesired frequencies and the decoding of
second harmonic but in the end there were some errors during the process of simulation,
which were not resolved by the end of the project. When second harmonic was added, some
peaks appear on the sides because detection process does not detect presence of DTMF
frequency at beginning and end of DTMF pulse.
4.6 Summary
This chapter explained the procedure adopted to complete the project. It described how
DTMF generation is implemented in MATLAB and also explain the results from the
simulations. Then it explained how DTMF signals are decoded using the FFT and Goertzel
algorithm along with the MATLAB code and simulations. This chapter provided the reader on
how the simulation worked using MATLAB and each stage explained how the program was
coded and simulated.
30
The project provided a very good understanding of the concepts of digital signal processing. It
also enabled me to understand and fully grasp subject of DTMF in general, and DTMF
decoding in particular. Since the algorithms were implemented in MATLAB, so this software
has been learned and used very efficiently and effectively.
However, the project is considered successful as far as DTMF generation is concerned. The
decoding part of the project was also partially successful as it decoded the DTMF signals at
half the desired frequencies. Also the keys pressed were calculated and displayed on the
GUI. It is tried to implement and correct the problem of decoding of undesired frequencies
and the decoding of second harmonic but in the end there were some errors during the
process of simulation, which were not resolved by the end of the project. When second
harmonic was added, some peaks appear on the sides because detection process does not
detect presence of DTMF frequency at beginning and end of DTMF pulse.
Due to lack of time and learning all the aspects, the project did not completed according to the
right procedure. However, the methods and techniques explained in this report are sufficient
enough to continue on the programming on decoding the DTMF signal accordingly at the
desired frequencies and also to decode the DTMF signal when second harmonic is added.
This project can be used as a starting point in areas where DTMF signals need to be
separated from speech signals. For such kind of project, first DTMF signals will be detected
and then they will be extracted by using a stable a causal filter.
31
REFERENCES
[1] Arslan, G. 1998 Dual-Tone Multiple Frequency Detector Implementation. Viewed 15th
March 2008
<http://users.ece.utexas.edu/~bevans/courses/ee382c/projects/spring98/arslan/finalreport>
[5] Sivapalan, J. 2004 Removal of DTMF signal from speech signal, University of
Hertfordshire, Herts, viewed 11th March 2008 <www.mmt.herts.ac.uk>
[6] Wikipedia. 2008. Discrete Fourier Transform [online]. Available
at:http://en.wikipedia.org/wiki/Discrete_Fourier_transform [Accessed 15th March 2008].
[7] Proakis, J. G. & Manolakis,D.G., 1998. Introduction to Digital Signal Processing.
Singapore: MacMilan
th
[8] Burrus, C.,S., 2006 The Discrete Fourier Transform. Viewed 18 March
2008.<www.cnx.org>
th
[9] Jones, D.,L., 2006 DFT Definition and Properties. Viewed 18 March
2008.<www.cnx.org>.
[10]Fast Fourier Transform Viewed 15th March 2008.
<http://www.cmlab.csie.ntu.edu.tw/cml/dsp/training/coding/transform/fft.html>
th
32
[16] Albasha, R. 2007 Wideband Antenna Tuning and Impedance Matching Using Genetic
Algorithms, University of Hertfordshire, Herts, viewed 11th March 2008
<www.mmt.herts.ac.uk>
[17] Bonas, K. 2006 FFT Teaching Tool, University of Hertfordshire, Herts, viewed 11th March
2008 <www.mmt.herts.ac.uk>
33
BIBLIOGRAPHY
[1] PROAKIS, J. G,MANOLAKIS,D.G 1998. Introduction to Digital Signal Processing.
Singapore: MacMilan
[4] SIVAPALAN, J. 2004 Removal of DTMF signal from speech signal, BEng Thesis
University of Hertfordshire
34
35
handle to figure
set(handles.popupmenu1,'Value',1);
state=get(hObject, 'Value');
if state==1,
set(hObject, 'Value', 1);
else,
set(handles.popupmenu1, 'Value', 2);
end
guidata(hObject, handles);
36
t=[0:0.000125:.05];
lower_sinusoid=sin(2*pi*f1*t);
higher_sinusoid=sin(2*pi*f5*t);
signal=lower_sinusoid+higher_sinusoid;
sound(signal,8000);
axes(handles.axes1);
plot(t,signal);
set(handles.axes1,'XMinorTick','on');
title('DTMF Input');
xlabel('Time');
ylabel('Amplitude');
Phone_Number=['1' '2' '3' 'A'; '4' '5' '6' 'B'; '7' '8' '9' 'C'; '*' '0' '#' 'D'];
condition=get(handles.popupmenu1, 'Value');
maximum=2048*2;
minimum=1024*2;
order=10;
gain=0.5;
normal_frequency=0.25;
ch=0.28;
[ x1,y1]=cheby1(order,gain,normal_frequency);
first_filtered=filter( x1,y1,signal);
low_frequency_fft=fft(first_filtered,maximum);
low_fft_signal=abs(low_frequency_fft(1:minimum));
axes(handles.axes2);
plot(first_filtered);grid;
title('Low Frequency Signal');
xlabel('Time');ylabel('Amplitude');
[x2,y2]=cheby1(order,gain,ch,'high');
second_filtered=filter(x2,y2,signal);
high_frequency_fft=fft(second_filtered,maximum);
high_fft_signal=abs(high_frequency_fft(1:minimum));
axes(handles.axes3);
plot(second_filtered);grid;
title('High Frequency Signal');
xlabel('Time');ylabel('Amplitude');
if condition == 1,
37
axes(handles.axes4);
plot(low_fft_signal);
title('FFT Low Pass');grid;
xlabel('Frequency');ylabel('Amplitude');
axes(handles.axes5);
plot(high_fft_signal);
title('FFT High Pass');grid;
xlabel('Frequency');ylabel('Amplitude');
calculate_energy=[norm(low_fft_signal(320:368))
norm(low_fft_signal(368:406))
norm(high_fft_signal(701:760))
norm(high_fft_signal(810:820))]';
find_location=[find(calculate_energy==max(calculate_energy(1:4)))
find(calculate_energy==max(calculate_energy(5:8)))-4]';
Key=Phone_Number(find_location(1,1),find_location(2,1));
set(handles.edit1,'String',Key(1,1));
else
axes(handles.axes4);
plot(low_fft_signal);
title('Goertzel Low Pass');grid;
xlabel('Frequency');ylabel('Amplitude');
axes(handles.axes5);
plot(high_fft_signal);
title('Goertzel High Pass');grid;
xlabel('Frequency');ylabel('Amplitude');
second_filtered=[second_filtered zeros(1,(maximum-size(second_filtered,1)) )];
first_filtered=[first_filtered zeros(1,(maximum-size(first_filtered,1)) )];
vertical=[601:611 664:674 728:738 810:820];
horizontial=[344:354 381:391 422:432 466:476];
high_frequency_fft = goertzel(second_filtered,vertical);
low_frequency_fft = goertzel(first_filtered,horizontial);
high_fft_signal=abs(high_frequency_fft);
low_fft_signal=abs(low_frequency_fft);
38
calculate_energy=[norm(low_fft_signal(9:12))
norm(low_fft_signal(20:23))
norm(low_fft_signal(31:34))
norm(high_fft_signal(9:12))
norm(low_fft_signal(34:37))
39
40
Figure 18 shows the GUI, when FFT algorithm has been selected and number 7 has been
pressed. The upper plot shows the DTMF input (when number 7 has been pressed). The
bottom two plots on the left show the filtered low frequency and filtered high frequency signals
respectively. The bottom two plots on the right shows the decoded frequencies and then
displays the digit pressed which was 7.
41
Figure 19 shows the GUI, when Goertzel algorithm has been selected and number 3 has
been pressed. The upper plot shows the DTMF input (when number 3 has been pressed).
The bottom two plots on the left show the filtered low frequency and filtered high frequency
signals respectively. The bottom two plots on the right shows the decoded frequencies and
then displays the digit pressed which was 3.
42
43
44