13 views

Uploaded by manelouchka

drone

drone

© All Rights Reserved

- 2006 Full 1246
- Frequency Detection Fourier
- Subbuchoi Williams
- Jaymz Campbell - FInal Year ISE3 Report
- Syntor X9000
- User Guide for TFocs
- LS_ON_DIGITAL_SIGNAL_PROCESSING
- bouquin_+++signals-and-systems-10.10
- ankit final report(ankit)HIET1.doc
- report for plag
- Dual
- Deriving Musical Control Features From a Real-Time Timbre Analysis of the Clarinet
- Ec2029 Digital Image Processing
- z Transformation
- Nexys4 PDM RefProj2 V2
- DSP Lab Manual GEC Dahod 1
- US20120163231.pdf
- Pengolahan Sinyal Digital B 2011 2012 01
- Advanced Voice Features
- 6 Fourier

You are on page 1of 46

Engineering

HONOURS IN DIGITAL COMMUNICATIONS AND

ELECTRONICS

Final Year Project Report

GOERTZEL ALGORITHM

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

3.4.3 Goertzel Algorithm implementation in MATLAB ........................................................ 24

3.5 Summary........................................................................................................................... 24

4. Experimental Procedure & Results ......................................................................................... 25

4.1 Introduction ....................................................................................................................... 25

4.2 DTMF Generation ............................................................................................................. 25

4.3 Decoding DTMF signals with FFT .................................................................................... 27

4.4 Decoding DTMF signals with Goertzel Algorithm ............................................................. 27

4.5 Addition of Second Harmonic ........................................................................................... 29

4.5 Discussion ......................................................................................................................... 29

4.6 Summary........................................................................................................................... 30

5. Conclusion and Future Work ................................................................................................... 31

5.1 Conclusion ........................................................................................................................ 31

5.2 Future Work ...................................................................................................................... 31

REFERENCES ............................................................................................................................ 32

BIBLIOGRAPHY.......................................................................................................................... 34

APPENDIX A: Project Time Plan ................................................................................................ 35

APPENDIX B: Software Code ..................................................................................................... 36

APPENDIX C: Graphical User Interface ..................................................................................... 40

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-

Figure 4 Length-8 FFT computation [11].................................................................................... 15

Figure 5 Basic computational element of the FFT: Butterfly [11] ................................................ 16

Figure 6 Goertzel Filter for computing DFT [13] ......................................................................... 18

Figure 7 Program Code to generate DTMF signals .................................................................... 25

Figure 8 DTMF signal generated when key 1 is pressed ......................................................... 25

Figure 9 Program Code to generate filtered high frequency and low frequency signals ............ 26

Figure 10 Filtered high frequency and low frequency signals when key 4 is pressed ............. 26

Figure 11 Key 5 is decoded at approximately half the desired frequency (770 Hz, 1336 Hz) 27

Figure 12 Program Code to compute the DFT of DTMF signal and to decode the frequencies

using goertzel function in MATLAB ............................................................................................. 28

Figure 13 Key 9 is decoded at approximately half the desired frequency (852 Hz, 1477 Hz) . 28

Figure 14 Second Harmonic Addition (Key "3" is pressed) ......................................................... 29

Figure 15 Second Harmonic Addition (Key "8" is pressed) ......................................................... 29

Figure 16 -- Gantt Chart of the Project Time Plan ...................................................................... 35

Figure 17 GUI Window ................................................................................................................ 40

Figure 18 DTMF Decoding with FFT when "7" is pressed .......................................................... 41

Figure 19 DTMF Decoding with Goertzel Algorithm when "3" is pressed ................................... 42

Figure 20 Second Harmonic Addition (FFT Simulation) ............................................................. 43

Figure 21 Second Harmonic Addition (Goertzel Algorithm simulation) ....................................... 44

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].

High Frequencies : 1209 Hz, 1336 Hz, 1477 Hz, 1633 Hz

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.

a. Tones with a duration less than 23 ms must be rejected.

b. Tones with duration more than 40 ms must be accepted.

c. An interruption of more than 40 ms must be accepted as a pause (One tone has finished,

a new one has started).

d. An interruption of less than 10 ms must be tolerated (The tone continuous).

a. The low frequency may have 8 dB higher power

b. The high frequency may have 4 dB higher power

1.6.1 Project Aim:

The aim of this project is to evaluate the relative usefulness of alternative approaches such as

Fast Fourier Transform (FFT) and Goertzel algorithm to decode dual tone multiple frequency

(DTMF) signals.

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 2: This chapter will describe the methods to decode DTMF signals. It will provide

theoretical explanation of both methods, which are Fast Fourier Transform and Goertzel

algorithm. It will also draw a comparison between both approaches.

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.1 Introduction:

This chapter will look into different approaches to decode DTMF signals. It explains DFT and

then describes FFT, which employs divide and conquer approach to compute the DFT of a

function. It reduces the computational complexity to a substantial amount. It describes

Goertzel algorithm, which is an efficient algorithm to compute the DFT, but it looks at specific

predetermined points as compared to FFT, which calculates evenly across the bandwidth of

the signal. It will also compare both the algorithms in terms of their performance.

Discrete Fourier Transform (DFT) is a great way to determine the strength of a signal at any

particular frequency, because DFT provides the frequency-domain representation of a timedomain signal and also DFT view data discretely. It locates the desired frequency from the

DFT and finds the magnitude of the frequency response at that point rather than a continuous

equation. The located or desired frequency be matched with other frequencies magnitude

and compared to the corresponding harmonics. From this information, we can determine if a

DTMF signal was sent or not [5].

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

If the expression that defines the DFT is evaluated for all integers k instead of just for

k=0,1,2,N, then the resulting infinite sequence is a periodic extension of the DFT, periodic

with period N.The periodicity can be shown directly from the definition:

(2)

The DFT is defined as transform of complex-valued data to complex-valued spectra.

However, in practice signals are often real-valued. The DFT of a real-valued discrete-time

signal has a special symmetry, in which the real part of the transform values are DFT even

symmetric and the imaginary part is DFT odd symmetric as shown in the figure below [9].

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)

FFT is an efficient way to compute the DFT of a function. The basic idea behind FFT is to

decompose the N-point DFT computation into computations of smaller size DFTs and to take

advantage of periodicity and symmetry of complex number. Such decompositions, if properly

carried out can result in significant savings in the computational complexity [2] [7].

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].

In over thirty years of Fourier transform algorithm development, the original Cooley- Tukey

algorithm is far and away the most frequently used. It is so computationally efficient that

power-of-two transform lengths are frequently used regardless of what the actual length of the

data [11].

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].

Goertzel algorithm reduces the cost of computing a single DFT frequency sample by almost a

factor of two. It is useful for situations requiring only a few DFT frequencies [13]. In 1958

G.Goertzel published a paper, which revealed a time-domain solution that yielded the same

value for the magnitude of a spectral line as that which would have been achieved (for that

particular frequency) if a complete fourier analysis had been performed. For DTMF tone

detection it is an highly effective and efficient choice of algorithm employing pairs of two-pole

resonators to detect the dual tones making up the incoming DTMF signal. It is thereby, a

recursive infinite impulse response (IIR) filter-type structure and thus has advantages of lower

computational memory requirements than an equivalent finite impulse response (FIR) filter.

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.

Adding two sine waves generates DTMF tones. According to Table 1 from Chapter 1, 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. However there are some other methods for generating DTMF

tones are given as [2][5]:

This method take previously computed sine wave values from memory. The sine function is

periodic and only one period must be computed. Since this is sampled data, an accurate sine

wave generator must confirm that the samples starting and ending point are the same. The

easiest way to determine this is to find the smallest value of I (an integer) that when multiplied

by the ratio below will result in an integer [5].

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

The Taylor series expansion method reduces the memory required to compute an

approximation of the sine value. The accuracy can be selected. The Taylor series expansion

method expresses a function by polynomial approximation. The expansion for a sine function

order 5 is [5]:

(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].

3.3.1 FFT Algorithm

The purpose of using FFT is to compute the DFT of the DTMF signal, which transforms the

function from time-domain to frequency domain. 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, computational complexity of FFT algorithm is O(N*Log N) [13][15].

FFT algorithm requires N and N to be equal and a power of 2. The implementation of DTMF

decoding is almost similar apart from the fact that with FFT, the value of the DFT could be

computed only at N equally spaced frequencies, which may or may not correspond to the

frequencies of interest (eight frequencies). On the other hand, Goertzels algorithm computes

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

[15].

DTMF tones can easily decoded by computing the DFT of the DTMF signal and then

measuring the energy present at eight DTMF frequencies. The minimum duration of a DTMF

signal is 40 ms. So with a sampling rate of 8kHz, there are at most 0.04*8000=320 samples

available for decoding each DTMF digit. The actual number of samples used for the DFT

computation is less than this number and is chosen so as to minimize the difference between

the actual location of the sinusoid and nearest integer value DFT index k [2].

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.

The algorithms developed for decoding the DTMF signals were implemented using the

MathWorks MATLAB 7.0 software package. In this section, the details of implementation of

the software are presented and the code written for its implementation is given in appendix B.

Arrays and vectors are the heart of MATLAB since all the data stored in MATLAB is in the

form of arrays. It allows array operations, which allows set of data to be quickly manipulated

and it also offers graphical user interface (GUI) tools that allows the user to use MATLAB as

an application development tool. This is the reason why MATLAB is very important in solving

problems in many fields [16].

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]:

traditional languages such as C.

C/C++.

Arrays, matrices and vectors are very easy to use in this software.

languages.

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

The FFT algorithm is implemented in MATLAB as follows [18]:

Y = fft(X) returns the discrete Fourier transform (DFT) of vector X, computed with a fast

Fourier transform (FFT) algorithm.

If X is a matrix, fft returns the Fourier transform of each column of the matrix.

If X is a multidimensional array, fft operates on the first nonsingleton dimension.

Y = fft(X,n) returns the n-point DFT. If the length of X is less than n, X is padded with

trailing zeros to length n. If the length of X is greater than n, the sequence X is truncated.

When X is a matrix, the length of the columns are adjusted in the same manner.

Y = fft(X,[],dim) and Y = fft(X,n,dim) applies the FFT operation across the dimension dim.

Goertzel algorithm computes the discrete Fourier transform (DFT) of specific indices in a

vector or matrix. It is implemented in MATLAB as follows [18]:

y = goertzel(x,i)

y = goertzel(x,i,dim)

y = goertzel(x,i) returns the DFT of vector x at the indices in vector i, computed using the

second-order Goertzel algorithm. If x is a matrix, goertzel computes each column

separately. The indices in vector i must be integer values from 1 to N, where N is the

length of the first matrix dimension of x that is greater than 1. The resulting y has the same

dimensions as x. If i is omitted, it is assumed to be [1:N], which results in a full DFT

computation.

y = goertzel(x,i,dim) returns the discrete Fourier transform (DFT) of matrix x at the indices

in vector i, computed along the dimension dim of x.

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

4.1 Introduction

This chapter will explain the procedure adopted to complete the project. It will describe how

DTMF generation is implemented in MATLAB and also explain the results from the

simulations. Then it will explain how DTMF signals are decoded using the FFT and Goertzel

algorithm along with the MATLAB code and simulations. It will also show the graphical user

interface and demonstrate how the frequencies are decoded. This chapter will provide all

readers on how the simulation works using MATLAB and each stage explain how the program

was coded and simulated referring to the earlier chapters.

This section describes the code to generate DTMF signal by adding two corresponding

frequencies as explained in chapter 1,2 and 3. The figure 7 shows the program code, which

generates the DTMF signal by adding two frequencies. Figure 8 shows the simulation result

the when number 1 was pressed.

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

At this stage, the FFT is used to compute the DFT at N equally spaced frequencies. In

MATLAB, the fft() function was used. Then energy was measured along the bandwidth of the

signal to detect the two frequencies and position of the digit is located. The figure 11 shows

the frequencies decoded when key 5 was pressed. These frequencies are approximately

half the desired frequencies, which are 770Hz and 1336 Hz.

Hz, 1336 Hz)

At this stage, the goertzel algorithm is used to compute the DFT. In MATLAB, the goertzel ()

function was used. Then energy was measured along the eight specific frequencies and two

frequencies were detected and also position of the digit is located. The figure 12 shows the

program code which compute the DFT of the DTMF signal using goertzel function and decode

the frequencies. The figure 13 shows the frequencies decoded when key 9 was pressed.

These frequencies are approximately half the desired frequency which are 852Hz and 1477

Hz.

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

Second harmonics were added to the both the sinusoidal frequencies, but some peaks

appear on the sides in both cases (FFT and Goertzel Algorithm) which makes detection

difficult and wrong digit is decoded. Figure 14 shows the FFT simulation with second

harmonic addition while Figure 14 shows the Goertzel algorithm simulation with second

harmonic addition. The whole GUI simulation is included in appendix C.

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

5.1 Conclusion

The concept of DTMF is explained in detail, which included its definition, functions and

applications in todays world. Different approaches to decode DTMF signals were also

described in this report. System implementation to achieve the decoding of DTMF signals is

also described in detail along with the software implementation through the MATLAB

software. The simulations and results achieved from both the algorithms were also

elaborated.

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.

There is room for future work in this area as the detection process should decode the

frequencies and determine the digit pressed when second harmonic is added and eventually

it should discriminate between speech and DTMF. It should also modify the DTMF generation

algorithm to generate pulses with different lengths and delays.

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>

McGraw Hill

at:http://en.wikipedia.org/wiki/Dual-tone_multi-frequency [Accessed 12th March 2008]

http://en.wikipedia.org/wiki/Pulse_dialing [Accessed 12th March 2008].

[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

[12]Proakis, J.G. & Manolakis,D.G., 1992. Digital Signal Processing Principles, Algorithms

and Applications.USA: MacMilan

th

[14] Penketh, J., 2002 An Efficient Method for the Use of Overlapped Analysis Windows

Employing the Goertzel Algorithm. Viewed 22 March 2008

<www.ee.ucl.ac.uk/lcs/papers2002/LCS043.pdf >.

[15] Beard, J.H., Given S.P.,Young B.J., 1995 A Discrete Fourier Transform Based Digital

th

<www.rootsecure.net/content/downloads/pdf/paper_dtmf.pdf >

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

McGraw

and Applications.USA: MacMilan

[4] SIVAPALAN, J. 2004 Removal of DTMF signal from speech signal, BEng Thesis

University of Hertfordshire

34

35

% --- Executes just before Project is made visible.

function Project_OpeningFcn(hObject, eventdata, handles, varargin)

% This function has no output args, see OutputFcn.

% hObject

handle to figure

% handles

handles.output = hObject;

set(handles.popupmenu1,'Value',1);

guidata(hObject, handles);

% uiwait(handles.figure1);

function popupmenu1_Callback(hObject, eventdata, handles)

% hObject

% handles

%

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(637:701))

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))

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));

39

The GUI consists of DTMF keypad and one pop up menu. The pop up menu provides the

user two choices of algorithms, which are FFT and Goertzel algorithm. By typing Project at

the command window, the GUI window comes on the screen as shown in Figure 17. First, the

user selects the algorithm and then presses any key.

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

- 2006 Full 1246Uploaded byrajesh2911
- Frequency Detection FourierUploaded byspreewell
- Subbuchoi WilliamsUploaded byNikhil Perla
- Jaymz Campbell - FInal Year ISE3 ReportUploaded byjaymzcd
- Syntor X9000Uploaded byuncmikee1997
- User Guide for TFocsUploaded byFarhan Bin Khalid
- LS_ON_DIGITAL_SIGNAL_PROCESSINGUploaded byMayuri Prajapati
- bouquin_+++signals-and-systems-10.10Uploaded byTarik Ziad
- ankit final report(ankit)HIET1.docUploaded bykunalgourav02
- report for plagUploaded byAbood Ali
- DualUploaded byLily Sharma
- Deriving Musical Control Features From a Real-Time Timbre Analysis of the ClarinetUploaded byRaiatea Moeata
- Ec2029 Digital Image ProcessingUploaded byl_k_indoria
- z TransformationUploaded bySaimir Lleshi
- Nexys4 PDM RefProj2 V2Uploaded byVale Conde Cuatzo
- DSP Lab Manual GEC Dahod 1Uploaded byTushar Mhuskey
- US20120163231.pdfUploaded byJustin Oommen
- Pengolahan Sinyal Digital B 2011 2012 01Uploaded byadeswhy
- Advanced Voice FeaturesUploaded byIsrrael Caceres M
- 6 FourierUploaded byAyu Iga Lestari
- 06152180Uploaded bymymaterials
- DSP ALGORITHMS & ARCHITECTURE NOTES (vtupro.com).pdfUploaded bySGS
- Siemens%20Optipoint%20400%20StanderdUploaded byRolando Bussoli
- Ee545L5 TransformationsUploaded byhdcosta123
- Impact of DPU 2017Uploaded bymdzakir_hussain
- GP328Uploaded bySuribabu varikuti
- ewsd v16Uploaded byEugen Bleuler
- Power Transmission for Hybrid Wind and Solar SystemUploaded byantonytechno
- Interference Cancellation by Repeated Filtering in the Fractional Fourier Transform Domain Using Mean-Square Error ConvergenceUploaded byAnonymous 7VPPkWS8O
- 電話機DECT2080-2om.pdfUploaded byKatsunori Hataya

- uavUploaded bymanelouchka
- Random WalkUploaded byCiobanu Gheorghe
- An Investigation of the Repetitive Failure in an Aircraft EngineUploaded bymanelouchka
- Math 2m16 1trim2Uploaded bymanelouchka
- A Lightweight and Wide-swath UAV Camera for High-resolution Surveillance MissionsA Lightweight and Wide-swath UAV Camera for High-resolution Surveillance MissionsUploaded bymanelouchka
- 01570505Uploaded bymanelouchka
- 2D-FFTUploaded byAngel Mariano
- Chapter 1Uploaded byShrinivas Saptalakar
- Presentation NameUploaded bymanelouchka

- 5. Capacitated Planned MaintenanceUploaded byMarcelo Ziulkoski
- Hw3Uploaded byMunir Aslam
- ch02Uploaded byhungvu11
- TORA output.TxtUploaded byPratyushSharma
- Novel Algorithm ADM (1)Uploaded byEugen Ionita
- Smith Flowers 091012Uploaded byKen Leonhart
- 4-2-Sorting.pdfUploaded byKenneth Baker
- 12 Polynomial FunctionsUploaded byTitser Laarni
- AMR.842.695Uploaded byVarun
- Lines 03Uploaded byErol Kerem
- TransshipmentUploaded byVen Haté
- aimaUploaded byagmedia95
- Kalman and Bayesian Filters in PythonUploaded bydmorenoc
- matlab project ideaUploaded bySrivatson Sridar
- course map VUUploaded bybernardaristo
- Bubble SortUploaded byRongeet Sodhi
- ('Christos Papadimitriou', 'Midterm 1', '(Solution)') Fall 2009Uploaded byJohn Smith
- hw3Uploaded byElla Lewis
- Computer Notes - Data Structures - 15Uploaded byecomputernotes
- 2016_Digital Forensics and WatermarkingUploaded bychienql
- 2182Uploaded byRahil Mahdiyan
- Adaptive Delta ModulatorUploaded byMor DepRz
- Image Compression Using DCTUploaded byĐặng Thành Trung
- Ch 4 SplinesUploaded byMawar Lestary
- Matlab Image processingUploaded byAfrasinei Sergiu Vlad
- EC 511LECT3 Pulse ModulationUploaded bySurbhi Singh
- Filtering of Randomly Occurring Signals by Kurtosis in the Frequency DomainUploaded byJulio Manuel Revilla Ocejo
- 54800Uploaded byWendy Snyder
- ant in fmsUploaded byGovardhan Kudumula
- pak gustiUploaded byMalmsteen Fauzi