You are on page 1of 10

DTMF Detection Using Goertzel Algorithm

KRANTHI KUMAR .D 10011P0405 kkcharan4@gmail.com

Abstract:--- A new type of digital Dual-Tone Multi frequency (DTMF) detection scheme based on the DFT algorithm. This detection scheme was designed to provide optimal performance and exceed Bell Core specifications for DTMF detection which is more robust and cost-effective than conventional analog detection technique.

1.INTRODUCTION
Dual-tone multi-frequency (DTMF) is an international signaling standard for telephone digits whose signals are used in traditional telephone systems i,e.,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 sinusoidal waveforms which are superimposed and whose frequencies are chosen from a set of eight standardized frequencies chosen in Bell Laboratories, where DTMF signaling system were originally proposed as an alternative to pulse dialing system in telephony. Transmission receivers are having wide tolerances to compensate the distortion caused by aging transmitters, variations in keying characteristics and transmission line distortions such as frequency variation and noise. Estimating frequencies of these signals with noise interferences is an important problem in signal processing. Efficient voice coding techniques are designed to maximize the subjective quality of reconstructed speech with higher signal to noise ratio and also carrier to interference ratio(received signal strength). The detector part of early DTMF systems consisted of analog implemented band pass _filter- banks, which were tuned to the eight standard frequencies. But as analog lines as well as many other analog systems were converted to digital, researchers have became more interested in digital DTMF detectors. Digital implementation has many advantages over analog implementation in accuracy, stability, re-programmability, and chip count. Many digital DTMF decoding algorithms, have been proposed, but they have several draw backs in general. 1. Most of them cannot comply with the related International Telecommunications Union (ITU) and Bell Communications Research, Inc. (Bell core) recommendations. 2. Some of them have too heavy computational load
1

3. Some of them need too much memory to implement on a single fixed point DSP. Although it does not satisfy the ITU specfications, the Goertzel Algorithm, which is an efficient algorithm to compute the Discrete Fourier Transform (DFT), is the most commonly used digital DTMF tone detection algorithm. Goertzel algorithm is well known in the DSP domain and used to detect the presence of a frequency or a group of frequencies. This algorithm is popular as the calculation required for implementation is lesser when compared to other techniques like DFT (FFT), when a smaller number of frequencies are to be detected.

2.DTMF OVERVIEW
A DTMF tone consists of two superimposed sinusoidal waveforms summed together from a set of eight standardized frequencies. These standardized frequencies are determined by AT&T Bell Laboratories such that they have no common multipliers which consist of two mutually exclusive frequency groups: the low frequency group and the high frequency group. Four low frequency tones (< 1 kHz) are assigned to rows, while four high frequency tones (> 1 kHz) are assigned to columns as shown in figure1. This allows a touch tone keypad to have up to twelve unique DTMF tones guaranteeing that none of the frequencies have common harmonics and thereby improves the performance of analog detectors. Upon pushing a button, two frequencies are transmitted corresponding to the column-row intercept at that button. However, the most commonly used frequency analysis technique, the Discrete Fourier Transform (DFT), samples the frequency domain with equally spaced samples, and therefore, it is not possible to have a sample exactly at each standard frequency.

The general formula for a pure DTMF(without noise) signal is characterized by the following equation

x(t) = AM cos(2fLT + ) + AM cos(2fHT + )


where AM is the amplitude for each DTMF signal, fL and fH are the low and high frequencies, is the phase shift[7], and T is the duration of the signal based on the number of samples.

The DTMF tone generator uses two digital filters in parallel each using the impulse sequence as an input. The filter for the DTMF tone for key 7 is depicted below.

L 2 852 / f s
H L ( z) z sin L z 2 2 z cos L 1 z sin H H H ( z) 2 z 2 z cos H 1
H 2 1209 / f s

( n)

DTMF Tone

y7 ( n )
7

Figure 2. Digital DTMF tone generator for the digit 7.

3.DTMF DETECTION
Because of increasing importance for digital DTMF detectors many techniques have been proposed and implemented upon which Goertzel algorithm and Linear Prediction (LP) based algorithm and a sub-band non-uniform Discrete Fourier Transform. The Goertzel algorithm being the basis of the DTMF detector. This method is a very effective and fast way to extract spectral information from an input signal. It can perform tone detection using much less CPU horsepower than the Fast Fourier Transform. Linear Prediction (LP) based algorithm models each frequency with a two-pole autoregressive (AR) model. The signal from the channel is first down-sampled by a factor of 2 and then filtered by two band-pass filters separating the two frequencies of the DTMF

signal. Then, computing the auto-correlation and cross-correlation of both sub-signals using an iterative algorithm and these estimates are used in the normal equations to find the AR model coefficients . It is obvious to say that this algorithm will not meet the ITU specifcations due to its high computational load. A sub-band non-uniform Discrete Fourier Transform is based on the fact that the DTMF tone frequencies are low (The highest frequency is 1633 Hz.)when compared to the sampling frequency (Sampling rate at telephone channels is 8 Khz). Filtering the signal in a high-pass and low-pass section and applying a decimation by a factor of 2 retains all the DTMF frequencies and high frequencies can be omitted thereby reducing the number of samples used in Goertzel algorithm by two which reduces the computational load. Disadvantages of this algorithm are sub-band decomposition itself needs some computation and delay, and the down- sampling procedure might cause some interference. Additionally since the signals high-pass section, which is generally used for talk-off test, is thrown away a, talk-off test cannot be applied. Most engineers are familiar with the Fast Fourier Transform (FFT) and would have little trouble using a "canned" FFT routine to detect one or more tones in an audio signal. If you only need to detect a few frequencies, a much faster method is available which is Goertzel algorithm. The Goertzel algorithm implementation examines the energy of one of the two tones from an incoming signal at eight different DTMF frequencies to determine which DTMF frequency is present. To do this evaluation, the input signal is transformed to the DTMF frequencies, which are computed by the modified Goertzel algorithm. The matched filter concept is used for each DTMF frequency to determine the frequency at which the incoming signal has maximum energy. Since maximum energy corresponds to DTMF frequency, this procedure enables us to detect the DTMF frequency.

4.FFT VS Goertzel Algorithm


Single tone detection method is popular for many applications. In the traditional personal communication system (PCS), such as the PSTN system, the single tone detection method is widely used on the detection of the DTMF signal, the dial tone, the busy tone, the ring-back tone, the disconnect tone, and the caller-ID tone. In the past, many algorithms are proposed for the single tone detection. The FFT with spectrum peak detection is a well-known approach for the single or multi-tone detection. In, various FFT methods for single tone detection are evaluated and compared in detail. However, the FFT method calculates all components over the frequency domain exhaustively. But only one or two components on the frequency domain need to be calculated in the single tone detection process. Goertzel proposed the Goertzel-algorithm for single tone detection. The Goertzel Algorithm uses the fact that the complex exponential in the Discrete Fourier Transform (DFT) equation is periodic and expresses the computation of DFT as a linear filtering operation defined by the difference equations ,.The individual DFT coefficient is generated using a simple

recursive filter and a second-order digital resonator. The complexity is reduced dramatically and cost-down on device is achieved.

ALGORITHM When DFT is to be computed at selected values of k (frequencies), Direct computation of DFT is more efficient than FFT algorithm. If the number of DFT points to be computed is less than log2N, then Goertzel algorithm is more efficient .The Goertzel Algorithm enables individual DFT coefficient generation using a simple recursive filter, which incorporates a second-order digital resonator. Instead of computing all N DFT coefficients, Goertzels Algorithm detects DTMF frequencies using a bank of eight filters. Goertzel algorithm uses linear filtering approach of x(n)

X[k]= = = = = (

, ,

| n=N ) |n=N
and .

Specifically, processing a signal x[n] through an LTI filter with impulse response h[n] = evaluating the result, ,at n = N will give the corresponding N-point DFT coefficient X[k] =

This LTI filtering process is illustrated below.

h[n] =
Representing the filter by its z-transform, we have

and since H(z)= =

The filtering operation can be equivalently performed by the system

H(z)= = =

The filtering operation can also be equivalently performed by

The DTMF frequency is transformed to a discrete fourier transform (DFT) coefficient. The relationship between the DTMF frequency (fi) and the DFT coefficient (k) is given in equation. k is the nearest integer where fs = Sampling frequency N = Filter length For each k, the state variable, shown in below equation is obtained by using the recursive difference equation

=
where n = 0, 1, ..., N

Within the same k, above equation is iterated until the last state variable, output, is given in equation

.Thereafter, the

Where

This is the desired DFT value, that is, X(k) = This figure gives an overview of the entire Goertzel algorithm.

Figure3. Direct-Form Realization of the Goertzel Algorithm

Since were only evaluating the output of this filter at , the multiplier need only be used at time n = N. With this in mind, the algorithm requires N real multiplications and a single complex multiplication to compute X[k] for a given k. This compares favorably to N complex multiplications as required by the canonical DFT equation and approximately N log2 N complex multiplications as required by the radix-2 FFT algorithms, when computing X[k] for a given k.

5.APPLICATION The Goertzel algorithm is modified further based on the matched filter concept to achieve DTMF detection. The energy of the incoming signal is calculated at the eight DTMF frequencies. The DTMF frequency at which the incoming signal has maximum energy is the detected frequency. This energy calculation is given as mag_square= ------- (1) max _ maximum (max, mag_square) ---------(2) max is the maximum energy that initially was set to a zero value and stored in memory. The energy from equation (1) is used for comparison with the stored maximum energy. As soon as the new energy is greater than the stored maximum energy from the comparison, this new energy is stored as the maximum energy for the next comparison. Also, the index that was initialized to a zero value is changed to a number that represents the frequency of this new energy. The comparison is performed for a total of eight times. After the final comparison, the index, a number between 0 and 7 from the result of the comparisons, is returned to the calling program. This number represents the detected DTMF frequency. Since the telephone industry has preset the sampling frequency to 8 kHz and the DTMF frequencies to 697, 770, 852, 941, 1209, 1336, 1477, and 1633 Hz, the filter length must be large enough to find the desired k value that corresponds to the DTMF frequencies. Therefore, there is a trade off to be considered between the computation burden and better resolution. we need to calculate the constant, k. The value of this constant determines the tone we are trying to detect and is given By:

f tone k N fs
Where: ftone = frequency of the tone. fs = sampling frequency. N = no.of samples Now we can calculate the value of the coefficient 2cos(2**k/N).

Sampling Frequency : 8 KHz Minimum duration of DTMF signal is 40 msec. Thus 0.04 x 8000 = 320 samples are available for decoding Take length = 256 samples. And compute 256 pt. DFT DFT length N determines the frequency spacing between the locations of the DFT samples.

The k value for different frequencies are calculated for N=256.

The feedback section has to be repeated N times (N=256). Since we are only interested in detecting the presence of a tone and not the phase we can detect the square of the magnitude: Yk(N) |2 = V2(N) + V2(N-1) - coeff*V(N)*V(N-1) Where: coeff = 2*cos(2*p*k/N)

6.ADVANTAGES OF GOERTZEL ALGORITHM OVER FFT Here are some implementation advantages of the Goertzel algorithm over the standard radix2 FFT for single tone detection: N does not need to be an integer power of 2. The resonant frequency can be any value between zero and fs Hz. The amount of filter coefficient (versus FFT twiddle factor) storage is reduced. No storing a block of input data is needed before processing can begin (as with the FFT). Processing can begin with first input time sample. No data bit reversal is needed for Goertzel. If you implement the Goertzel algorithm M times to detect M different tones, Goertzel is more efficient (fewer multiplies) than the FFT when M < log2N. Computational requirements to detect a single tone (assuming real-only x(n) input) are given in below table

7.REFERENCES http://www.embedded.com/design/real-world-applications/4401754/Single-tonedetection-with-the-Goertzel-algorithm http://www.engineersgarage.com/tutorials/dtmf-dual-tone-multiple-frequency?page=1 Manolakis, Dimitris G. and John G. Proakis. Digital Signal Processing. 2nd edition. Macmillan Publishing Co., 1992. http://users.ece.utexas.edu/~bevans/courses/ee382c/projects/spring98/arslan/finalreport.p df

10

You might also like