DUAL-TONE MULTIFREQUENCY (DTMF) SIGNALS

12.6 DUAL-TONE MULTIFREQUENCY (DTMF) SIGNALS

DTMF is the generic name for push-button telephone signaling that is equivalent to the Touch Tone system in use within the Bell System. DTMF also finds widespread use in electronic mail systems and telephone banking systems in which the user can select options from a menu by sending DTMF signals from a telephone.

In a DTMF signaling system a combination of a high-frequency tone and a low-frequency tone represent a specific digit or the characters * and #. The eight frequencies are arranged as shown in Figure 12.14, to accommodate a total of 16 characters, 12 of which are assigned as shown, while the other four are reserved for future use.

DTMF signals are easily generated in software and detected by means of digital filters, also implemented in software, that are tuned to the 8 fre- quency tones. Usually, DTMF signals are interfaced to the analog world via a codec (coder/decoder) chip or by linear A/D and D/A converters. Codec chips contain all the necessary A/D and D/A, sampling, and fil- tering circuitry for a bidirectional analog/digital interface.

The DTMF tones may be generated either mathematically or from

a look-up table. In a hardware implementation (e.g., in a digital signal

Dual-tone Multifrequency (DTMF) Signals 627

FIGURE 12.14 DTMF digits processor), digital samples of two sine waves are generated mathemati-

cally, scaled, and added together. The sum is logarithmically compressed and sent to the codec for conversion to an analog signal. At an 8 kHz sampling rate the hardware must output a sample every 125 ms. In this case a sine look-up table is not used because the values of the sine wave can be computed quickly without using the large amount of data mem- ory that a table look-up would require. For simulation and investigation purposes, the look-up table might be a good approach in MATLAB.

At the receiving end, the logarithmically compressed, 8-bit digital data words from the codec are received and logarithmically expanded to their 16-bit linear format. Then the tones are detected to decide on the transmitted digit. The detection algorithm can be a DFT implementa- tion using the FFT algorithm or a filter bank implementation. For the relatively small number of tones to be detected, the filter bank implemen- tation is more efficient. We now describe the use of the Goertzel algorithm to implement the 8 tuned filters.

Recall from the discussion in Chapter 5 that the DFT of an N -point data sequence {x(n)} is

N * −1

X (k) =

x(n)W nk N , k = 0, 1, . . . , N − 1 (12.40)

n =0

If the FFT algorithm is used to perform the computation of the DFT, the number of computations (complex multiplications and additions) is

N log 2 N . In this case we obtain all N values of the DFT at once. However,

Chapter 12

APPLICATIONS IN COMMUNICATIONS

if we desire to compute only M points of the DFT, where M < log 2 N, then a direct computation of the DFT is more efficient. The Goertzel algorithm, which is now described, is basically a linear filtering approach to the computation of the DFT and provides an alternative to direct computation.

12.6.1 THE GOERTZEL ALGORITHM The Goertzel algorithm exploits the periodicity of the phase factors {W k N } and allows us to express the computation of the DFT as a linear filtering operation. Since W −kN N = 1, we can multiply the DFT by this factor. Thus

X (k) = W −k(N −m)

We note that (12.41) is in the form of a convolution. Indeed, if we define the sequence y k (n) as

N * −1

y −k(n−m)

then it is clear that y k (n) is the convolution of the finite-duration input sequence x(n) of length N with a filter that has an impulse response

(12.43) The output of this filter at n = N yields the value of the DFT at the

h k (n) = W −kn N u(n)

frequency ω k = 2πk/N . That is,

X (k) = y k (n)| n =N

as can be verified by comparing (12.41) with (12.42).

The filter with impulse response h k (n) has the system function

(12.45) This filter has a pole on the unit circle at the frequency ω k = 2πk/N .

H k (z) =

1−W −k N z −1

Thus the entire DFT can be computed by passing the block of input data into a parallel bank of N single-pole filters (resonators), where each filter has a pole at the corresponding frequency of the DFT.

Instead of performing the computation of the DFT as in (12.42), via convolution, we can use the difference equation corresponding to the filter given by (12.45) to compute y k (n) recursively. Thus we have

y k (n) = W −k N y k (n − 1) + x(n), y k (−1) = 0 (12.46)

Dual-tone Multifrequency (DTMF) Signals 629

FIGURE 12.15 Realization of two-pole resonator for computing the DFT

The desired output is X (k) = y k (N ). To perform this computation, we can compute once and store the phase factor W −k N .

The complex multiplications and additions inherent in (12.46) can

be avoided by combining the pairs of resonators possessing complex con- jugate poles. This leads to 2-pole filters with system functions of the form

1−W k

N z −1

(12.47) The realization of the system illustrated in Figure 12.15 is described by

H k (z) =

1 − 2 cos (2πk/N ) z −1 +z −2

the difference equations 2πk

v k (n)=2 cos

v k (n − 1) − v k (n − 2) + x(n) (12.48)

(12.49) with initial conditions v k (−1) = v k (−2) = 0. This is the Goertzel algo-

k (n)=v k (n) − W N v k (n − 1)

rithm.

The recursive relation in (12.48) is iterated for n = 0, 1, . . . , N , but the equation in (12.49) is computed only once, at time n = N . Each iteration requires one real multiplication and two additions. Consequently, for a real input sequence x(n), this algorithm requires N + 1 real multiplications to yield not only X (k) but also, due to symmetry, the value of X (N − k).

We can now implement the DTMF decoder by use of the Goertzel algorithm. Since there are eight possible tones to be detected, we require eight filters of the type given by (12.47), with each filter tuned to one of the eight frequencies. In the DTMF detector, there is no need to compute the complex value X (k); only the magnitude |X(k)| or the magnitude-squared

value |X(k)| 2 will suffice. Consequently, the final step in the computation of the DFT value involving the numerator term (feedforward part of the

Chapter 12

APPLICATIONS IN COMMUNICATIONS

filter computation) can be simplified. In particular, we have

|X(k)| =|y k (N )| = 2v k (N ) − W N v k (N − 1) 2 (12.50)

=v 2 k 2πk (N ) + v 2 k (N − 1) − 2 cos v k (N )v k (N − 1)

Thus complex-valued arithmetic operations are completely eliminated in the DTMF detector.

12.6.2 PROJECT 12.6: DTMF SIGNALING The objective of this project is to gain an understanding of the DTMF tone generation software and the DTMF decoding algorithm (the Goertzel algorithm). Design the following MATLAB modules:

1. a tone generation function that accepts an array containing dial- ing digits and produces a signal containing appropriate tones (from Figure 12.14) of 0.5-second duration for each digit at 8 kHz sampling frequency

2. a dial-tone generator generating samples of (350 + 440) Hz frequency at 8 kHz sampling interval for a specified amount of duration

3. a decoding function to implement (12.50) that accepts a DTMF signal and produces an array containing dialing digits

Generate several dialing list arrays containing a mix of digits and dial tones. Experiment with the tone generation and detection modules and comment on your observations. Use MATLAB’s sound generation capabilities to listen to the tones and to observe the frequency components of the generated tones.