output y
k
n is required only at time N À 1, we just need to compute the non-recursive
part of the filter at the N À 1th iteration. The recursive part of algorithm can be
expressed as
w
k
n xn 2cos2pf
k
=f
s
w
k
n À 1 À w
k
n À 2:
9:3:12
The non-recursive calculation of y
k
N À 1 is expressed as
Xk y
k
N À 1 w
k
N À 1 À e
Àj2pf
k
=f
s
w
k
N À 2:
9:3:13
A further simplification of the algorithm is made by realizing that only the magnitude
squared of X(k) is needed for tone detection. From (9.3.13), the squared magnitude of
X(k) is computed as
jXkj
2
w
2
k
N À 1 À 2 cos2pf
k
=f
s
w
k
N À 1w
k
N À 2 w
2
k
N À 2: 9:3:14
Therefore the complex arithmetic given in (9.3.13) is eliminated and (9.3.14) requires
only one coefficient, 2cos2pf
k
=f
s
, for each jXkj
2
to be evaluated. Since there are eight
possible tones to be detected, we need eight filters described by (9.3.12) and (9.3.14).
Each filter is tuned to one of the eight frequencies defined in Figure 9.1. Note that
Equation (9.3.12) is computed for n 0, 1, . . . , N À 1, but Equation (9.3.14) is com-
puted only once at time n N À 1.
9.3.3 Implementation Considerations
The flow chart of DTMF tone detection algorithm is illustrated in Figure 9.8. At
the beginning of each frame of length N, the state variables xn, w
k
n, w
k
n À 1,
w
k
n À 2, and y
k
n for each of the eight Goertzel filters and the energy are set to 0. For
each sample, the recursive part of each filter defined in (9.3.12) is executed. At the end of
each frame, i.e., n N À 1, the squared magnitude jXkj
2
for each DTMF frequency
is computed based on the (9.3.14). The following six tests are performed to determine if
a valid DTMF digit has been detected.
Magnitude test
According to the International Telecommunication Union (ITU), previously the
International Telegraph and Telephone Consultative Committee (CCITT), standard,
the maximum signal level transmit to the public network shall not exceed À9 dBm
(=À 1 dBm) (See Appendix A.6 for the definition of dBm). This leaves an average
voice range of À35 dBm for a very weak long distance call, to À10 dBm for a local
call. Generally, the DTMF receiver would be expected to operate at an average range
of À29 dBm to 1 dBm. The 1 dBm is an extreme, but could happen. Thus the largest
magnitude in each band must be greater than a threshold of À29 dBm, otherwise
the DTMF signal should not be decoded. For this magnitude test, the squared
414
PRACTICAL DSP APPLICATIONS IN COMMUNICATIONS