Download Document 8467067

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

Mathematics of radio engineering wikipedia , lookup

Approximations of π wikipedia , lookup

Factorization of polynomials over finite fields wikipedia , lookup

Algorithm wikipedia , lookup

Elementary arithmetic wikipedia , lookup

Transcript
IOSR Journal of VLSI and Signal Processing (IOSR-JVSP)
Volume 4, Issue 3, Ver. II (May-Jun. 2014), PP 34-43
e-ISSN: 2319 – 4200, p-ISSN No. : 2319 – 4197
www.iosrjournals.org
Dtmf Detection Using Goertzel Algorithm
1
Sai Bharadwaj B, 2V.Sharmila Gowri, 3V.Bindu Madhuri
1,2,3
(ECE,Vignan’s Institute of Engineering For Women,India)
Abstract: Dual-tone multi-frequency(DTMF) is an international signaling standard for telephone
digits(number buttons). These signals are used in touch-tone telephones as well as many other areas. Since
analog devices are rapidly changing with digital devices, digital DTMF decoders become more important. The
subject of this paper is to build a dual-tone multi-frequency(DTMF) signal detector. There are many algorithms
for DTMF detection, and among all of them the chosen one is Goertzel’s algorithm. It is one of the simplest
algorithms of all and it is very often used in practical realizations. The simulation of this algorithm is done in
MATLAB and outputs of this test are given in this paper.
Keywords: Pulse dialing,Tone dialing, Push button tone dialing,Digital frequency spectrum, Fast fourier
spectrum, Goertzel algorithm, Energy threshold.
I.
Introduction:
Pulse dialing and tone dialing are the two systems used in telephone signaling. DTMF is the name
used for push-button tone dialing. DTMF uses two tones to represent each key on the touch pad. DTMF has
found widespread applications such as in automated telephone inquiry services where a user can select options
from a menu by sending DTMF signals from a telephone.
DTMF signaling represents a digit or a character by the sum of a high-frequency tone and a low
frequency tone (thereby, dual tone). When any key is pressed, the tone of the column and the tone of the row are
generated[5]. The DTMF corresponding to that key is generated by either table lookup or a resonator. The signal
is transmitted through the telephone line to a switching center. The switching center samples the signal and uses
FFT or Goertzel algorithm to determine the received frequencies and hence tell the corresponding digi[3].
II.
Methodology:
Initially, a simple energy threshold is used to separate the digits in each file which can be done as
follows. The whole signal is divided into frames whose individual average energy is calculated. The average of
all these is considered as the threshold. But in some cases, the noise energy exceeds the threshold. Hence, five
continuous frames are joined to make the noise energy less than the signal energy. This is done in steps 1 and 2
of the program. Now, the starting point of each digit is needed to be found, shown in step 3. If the current frame
number is 1 and the energy is more than the threshold, then it is one of the digit’s starting points. For frame
numbers after 1, if the frame energy is more than the threshold and also the previous frame energy, then it is
again one of the digit’s starting points. Then the Goertzel algorithm is implemented to obtain the frequency
spectrum. Using the largest two amplitudes in the output of Goertzel algorithm, the digits in the signal are
found.
III.
Understanding Fft And Goertzel Algorithm:
In this as we have seen when a key is pressed a signal with corresponding two frequencies are
transmitted. Now in order to carry out its functions and process the user’s request, the public telephone system
should first identify the dialed numbers. For this it carries the DTF and obtains the digital frequency spectrum.
Depending upon the frequency content it identifies the number. The equations of DFT pair are shown below in
equations (1) and (2):
N 1
N 1
n0
n 0
X (k )   x(n)e j 2nk / N   x(n)WNnk where k=0,1,2……..N-1 …………..(1)
1 N 1
1 N 1
x(n)   X (k )e j 2nk / N   X (k )WNnk where n = 0, 1, 2 …, N-1…………… (2)
N k 0
N k 0
Where x(n) represents the discrete time signal, X (k ) represents discrete frequency signal and N is
the number of points sampled in the frequency spectrum for the DFT analysis[1].
Comparison of time required for DFT, FFT, Goertzel algorithms. One important factor in determining
whether the DFT can be applied efficiently is the time constraint involved. To be able to process the ‘dial
www.iosrjournals.org
34 | Page
Dtmf Detection Using Goertzel Algorithm
request’, the above calculations should be as fast as possible. This is obvious from the fact that the computation
of DFT involves complexity calculations (Eq 1). For one k, 4N real multiplications are needed. Hence,
2
computing N point X (k ) requires 4 N real multiplications. As such, if we had the value of N=1024 with a
computation speed of 40MIPS, the total number of multiplications is 4194304. The time it would take for this is
4194304/40M which is approx. 0.1 seconds. For a complete phone number of length 10 digits, it would take a
bit over 1s. Therefore, it isn’t a very viable option to use in a real-life practical scenario.
A.Working of the FFT algorithm: The FFT algorithm requires only 2 N log 2 N real multiplications. Using
the same example with N=1024 and the computation speed as 40MIPS, the total number of multiplications is
just 20480, and it takes 0.000512 seconds; which is a far better performance than 0.1ms in the case earlier[2].
B.Working of the Goertzel Algorithm: : Goertzel algorithm[4] is especially useful when the number of
frequency points needed to compute are less than N. If we have to evaluate M number of DFT coefficients,
where M< 2 log 2 N the number of real multiplications required for this algorithm is nearly equal to
M(N+2)~MN. With our typical values of N=1024 and M=7, the total number of multiplications needed is 7148,
which takes about 0.0001787 seconds; undoubtedly, the best among the three. By using the Goertzel method,
maximum time utilization is obtained and the fastest response obtained.
The equations of the Goertzel algorithm are:
 2 
v k (n)  2 cos
k v k (n  1)  v k (n  2)  x(n)
N 
(3)
 2 
 2 
yk (n)  vk (n)  cos
k vk (n  1)  j sin
k vk (n  1)
 N 
 N 
1. Set vk (n)  0 for n  0 and vk (n)  x(0)
(4)
2. Iterate (Eq 3) N times starting at n=1
3. Use (Eq 4) at the end to find y k (N )
This algorithm is used to check if the signal contains specific frequency components. In DTMF, we need to
check 8 coefficients which correspond to the frequency values of 697,770,852,941,1209,1336,1477 and 1633 Hz
respectively, which are characteristic to the DTMF signaling being implemented.
IV.
Results
A.Phone NumberA:
Energy of the wave signal
0.05
0.2
0.045
0.15
0.04
0.1
0.035
0.05
0.03
Amplitude
Amplitude of PhoneNumberA
sampled Signal-PhoneNumberA
0.25
0
-0.05
0.025
0.02
-0.1
0.015
-0.15
0.01
-0.2
0.005
-0.25
0
0.5
1
1.5
2
2.5
3
Samples x(n)
3.5
Fig 1.:Input signal plot
4
4.5
5
0
0
0.5
1
4
x 10
1.5
2
2.5
3
Samples x(n)
3.5
4
4.5
5
4
x 10
Fig 2.: Energy of the wave signal plot:
www.iosrjournals.org
35 | Page
Dtmf Detection Using Goertzel Algorithm
Energy of the frames
0.25
frame energy
0.2
0.15
0.1
0.05
0
0
50
100
150
200
250
300
frame number(each frame of 10ms)
350
400
Fig 3.: Frame energies plot:
FFT OUTPUTS:
FFTDigit1
FFTDigit2
80
100
90
70
80
60
70
60
amplitude
amplitude
50
40
50
40
30
30
20
20
10
0
10
0
500
1000
1500
2000
2500
Analog frequency(Hz)
3000
3500
0
4000
0
500
1000
1500
2000
2500
Analog frequency(Hz)
3000
3500
4000
Fig 4.(a)FFT digit 1
4.(b)FFT digit 2
FFTDigit4
100
100
90
90
80
80
70
70
60
60
amplitude
amplitude
FFTDigit3
50
50
40
40
30
30
20
20
10
10
0
0
500
1000
1500
2000
2500
Analog frequency(Hz)
Fig
3000
3500
4000
0
0
500
Fig 4.(c)FFT digit 3
1000
1500
2000
2500
Analog frequency(Hz)
3000
3500
4000
Fig 4.(d)FFT digit 4
www.iosrjournals.org
36 | Page
Dtmf Detection Using Goertzel Algorithm
FFTDigit6
120
100
100
80
80
amplitude
amplitude
FFTDigit5
120
60
60
40
40
20
20
0
0
500
1000
1500
2000
2500
Analog frequency(Hz)
3000
3500
0
4000
0
500
1000
1500
2000
2500
Analog frequency(Hz)
3000
3500
4000
Fig 4.(e)FFT digit 5
4.(f)FFT digit 6
Fig
FFTDigit7
120
100
amplitude
80
60
40
20
0
0
500
1000
1500
2000
2500
Analog frequency(Hz)
3000
3500
4000
Fig 4.(f)FFT digit 7
Goertzal Algorithm outputs:
Digit2
60
50
50
40
40
Amplitude
Amplitude
Digit1
60
30
20
20
10
0
600
30
10
800
1000
1200
Goertzel
1400
1600
1800
0
600
800
Fig 5.(a):digit 1
1000
1200
Goertzel
1400
1600
1800
Fig 5.(b):digit 2
www.iosrjournals.org
37 | Page
Dtmf Detection Using Goertzel Algorithm
Digit4
Digit3
50
60
45
50
40
35
Amplitude
Amplitude
40
30
20
30
25
20
15
10
10
5
0
600
800
1000
1200
Goertzel
1400
1600
1800
0
600
800
Fig 5.(c):digit 3
1000
1200
Goertzel
1400
1600
1800
Fig 5.(d):digit 4
Digit5
Digit6
70
45
40
60
35
50
Amplitude
Amplitude
30
40
30
25
20
15
20
10
10
0
600
5
800
1000
1200
Goertzel
1400
1600
0
600
1800
800
Fig 5.(e):digit 5
1000
1200
Goertzel
1400
1600
1800
Fig 5.(f):digit6
Digit7
70
Output Of Phone Number
Phone Number A = 8 8 2 3 0 9 6
60
Amplitude
50
40
30
20
10
0
600
800
1000
1200
Goertzel
1400
1600
1800
Fig 5.(g):digit 7
www.iosrjournals.org
38 | Page
Dtmf Detection Using Goertzel Algorithm
B.Phone NumberB:
Energy of the wave signal
1
0.9
sampled Signal-PhoneNumberB
1
0.8
0.8
0.7
Amplitude
Amplitude of PhoneNumberB
0.6
0.4
0.2
0.6
0.5
0.4
0
0.3
-0.2
0.2
-0.4
0.1
-0.6
0
-0.8
-1
0
0.5
1
1.5
2
2.5
Samples x(n)
3
3.5
4
0
0.5
1
1.5
2
x(n)
2.5
3
3.5
4
4
x 10
Fig.7:Energy of wave signal
4
x 10
Fig .6: Input Sequence
Energy of the frames
0.35
0.3
frame energy
0.25
0.2
0.15
0.1
0.05
0
0
50
100
150
200
250
300
350
frame number(each frame of 10ms)
400
450
Fig .8:Frame energies plot
FFT Outputs:
:
FFT Digit1
FFT Digit2
50
50
45
45
40
40
35
30
Amplitude
Amplitude
35
25
20
30
25
20
15
15
10
10
5
0
5
0
500
1000
1500
2000
2500
Analog Frequency(Hz)
3000
3500
4000
0
0
500
1000
1500
2000
2500
Analog Frequency(Hz)
3000
3500
4000
Fig.9(b):digit 2
Fig.9(a):digit 1
www.iosrjournals.org
39 | Page
Dtmf Detection Using Goertzel Algorithm
FFT Digit4
50
45
FFT Digit3
50
40
45
35
Amplitude
40
Amplitude
35
30
30
25
20
25
15
20
10
15
5
10
0
5
0
0
500
1000
1500
2000
2500
Analog Frequency(Hz)
3000
3500
0
500
4000
1000
1500
2000
2500
Analog Frequency(Hz)
3000
3500
4000
3000
3500
4000
Fig.9(d):digit 4
Fig.9(c):digit 3
FFT Digit6
FFT Digit5
60
50
45
50
40
40
30
Amplitude
Amplitude
35
25
20
30
20
15
10
10
5
0
0
500
1000
1500
2000
2500
Analog Frequency(Hz)
3000
3500
4000
0
0
500
Fig 9.(e):digit 5
1000
1500
2000
2500
Analog Frequency(Hz)
Fig.9(f):digit 6
FFT Digit7
60
50
Amplitude
40
30
20
10
0
0
500
1000
1500
2000
2500
Analog Frequency(Hz)
3000
3500
4000
Fig.9(g):digit 7
www.iosrjournals.org
40 | Page
Dtmf Detection Using Goertzel Algorithm
Goertzel Algorithm outputs:
Digit2
60
Digit1
60
50
50
40
Amplitude
Amplitude
40
30
30
20
20
10
10
0
600
0
600
800
1000
1200
Goertzel
1400
1600
800
1000
1800
1200
Goertzel
1400
1600
1800
Fig.10(b):digit 2
Fig.10(a):digit 1
Digit4
10
Digit3
10
9
9
8
8
7
7
6
Amplitude
Amplitude
6
5
5
4
4
3
3
2
2
1
1
0
600
0
600
800
1000
1200
Goertzel
1400
1600
800
1000
1800
1200
Goertzel
1400
1600
1800
Fig.10(c):digit 4
Fig.10(c):digit 3
Digit6
12
Digit5
12
10
10
8
Amplitude
Amplitude
8
6
6
4
4
2
2
0
600
0
600
800
1000
1200
Goertzel
1400
1600
1800
800
1000
1200
Goertzel
1400
1600
1800
Fig.10(c):digit 6
Fig.10(c):digit 5
www.iosrjournals.org
41 | Page
Dtmf Detection Using Goertzel Algorithm
Digit7
12
Output Of Phone Number:
Phone number B= 4 4 3 4 5 0 0
10
Amplitude
8
6
4
2
0
600
800
1000
1200
Goertzel
1400
1600
1800
Fig.10(c):digit 7
V.
Results And Discussion
A. Location of the number digit:
Energy threshold is an important parameter to determine the location of each digit number. The average
energy of the frames is used as the threshold. In case the noise signal energy is higher than the threshold, which
was the case in some plots; changing the frame size to 10 ms although it can be even more worked to smoothen
out the noise. Therefore, the threshold can still be kept the same while accurately finding the ‘start point’.
B. FFT vs Goertzel method:
By comparing the pairs of plots given the FFT and Goertzel methods, we see that for the two high
peaks which we get for each digit we have higher amplitude for FFT computed peak compared to the Goertzel
peak. This is might be because we are rounding off the K. Also if noise is effecting the signal FFt seems to
accurate than the Goertzel. But for the purpose of detecting the digits Goertzel accuracy is sufficient as it give
almost accurate frequencies if not exact ones.
As per the no. of computation we see that its greatly reduced when we use Goertzal as we calculate
only 8 points with 1024 computations per point, compared to 20*1024 in FFT. So there is a great speed up for
Goertzal. This is an algorithm with a faster and equally efficient response.
Goertzel is much faster than FFT when M is smaller than 2log2N. In this project, we applied the
Goertzel and FFT methods to tell the digit number contained in the wav file. Both methods get the same answer.
However Goertzel method is an efficient way to analysis frequency spectrum at some fixed points as its faster.
VI.
Observations
Not many frequency points are required to decode the signal
1) If the Goertzel Algorithm criteria is satisfied, the time for computing is greatly reduced.
2) It is better than the FFT method.
VII.
Conclusion
The Phone numbers were detected, the threshold energy was set. The Phone numbers were detected
using the Goertzel Algorithm and the FFT Technique.
PhoneNumberA = 8 8 2 3 0 9 6
Phone number B= 4 4 3 4 5 0 0
References
Books:
[1].
RG Lyons,Understanding Digital Signal Processing,2nd edn [Prentice Hall PTR,NJ,2004].
Thesis:
[2].
Duhamel,MVetterli P,Fast Fourier transforms:A tutorial review and a state of the art.Signal process 19 ,259
Papers:
www.iosrjournals.org
[1990].
42 | Page
Dtmf Detection Using Goertzel Algorithm
[3].
SL Gay,J Hartung,GL Smith,Algorithms for multi-channel DTMF Detection for the WE DSP32 Family,IEEE on the proceedings
of international conference on acoustics, Speech and Signal Processing [Glassglow,1989]
Websites:
[4].
Web:http://en.wikipedia.org/wiki/Goertzel_algorithm Q.23,Technical features of push-button Telephone sets [ITU-T,Geneva
],p,1988.
www.iosrjournals.org
43 | Page