DTMF and the Goertzel

Hi-

I've been on mission to find a way to do inexpensive real time DTMF tone capture from an audio stream. From my research, I found that the Goertzel filter is a good and simple way to test for the presence of the tone components. What I learned from trial code implementation is that the Goertzel filter is sensitive to the the tone frequency it's testing for. For example, if we're testing for 1336 Hz but the true tone is actually 1320 Hz, the Goertzel filter will give a weak response for 1336 even though the

1320 tone means it's there. The filter's test band is too discriminating (or should I say narrow?).

So you DTMF DSP experts out there, what strategies are you aware of that can be used to test for tone presence over a range of frequencies in DTMF decoders (as opposed to a single frequency)?

JJS

Reply to
John Speth
Loading thread data ...

formatting link

Vladimir Vassilevsky DSP and Mixed Signal Design Consultant

formatting link

Reply to
Vladimir Vassilevsky

I hate reading posts that start with "from my research I have found the Goertzel...". The Goertzel algorithm is like the best damn imperial- sized nut driver in a metric world. It's like having a good pair of vice- grips and a machine that has socket-head screws.

In other words, it's a tool that can be made to work, but isn't necessarily the best choice.

If you're absurdly low on RAM and you have a processor that has good precision and you're pretty good at coding up bilinear filters, then the Goertzel algorithm will do an OK job. In action, it's pretty much a second-order bandpass filter with infinite Q, that you reset to zero at the beginning of each test interval so your results will be meaningful.

The bandwidth of the Goertzel kernel, by itself, if allowed to run forever, is zero. The Goertzel gets a non-zero bandwidth _entirely_ by virtue of being run for a finite amount of time. The magic here is that the shorter that you run it before you check the values and reset the filter, the wider the bandwidth. So the quick solution to your problem is to just run it for less time. If that doesn't give you enough noise rejection, then run it in small chunks and average the detected signal strength over a few samples.

A better solution, in this day and age, on most processors, would be to use a sine table (or a set of them, specific to your sampling rate). Multiply your incoming signal by the prototypes of your DTMF tones, in phase and in quadrature (i.e., multiply by cos(wt) and sin(wt)). Accumulate the results, and at the end of your accumulation period (which, incidentally, is going to be exactly the same as what you used for the Goertzel) find the signal strength (or better, the square thereof). You'll use up ROM for the sine table(s), but you may find that you're using less time in the multiplications -- particularly because at the very least you need 16-bit arithmetic and careful minding of your p's and q's for the Goertzel, where you can do the demodulation method with 8- bit coefficients.

If you're just bound and determined to use an infinite impulse response method of some sort, it may be better to use IIR bandpass filters with finite Q (and therefor controlled bandwidth) that are running all the time. Design them so that you can read off the signal energy from the filter states at any given sample, run them at your audio sampling rate, check them three or four times faster than their bandwidth, and compare their energy to some threshold to see if you want to decide that you've detected a tone.

--
www.wescottdesign.com
Reply to
Tim Wescott

Thanks Tim and Vladimir. You're responses are juicy enough to zero in on some good solutions.

JJS

Hi-

I've been on mission to find a way to do inexpensive real time DTMF tone capture from an audio stream. From my research, I found that the Goertzel filter is a good and simple way to test for the presence of the tone components. What I learned from trial code implementation is that the Goertzel filter is sensitive to the the tone frequency it's testing for. For example, if we're testing for 1336 Hz but the true tone is actually 1320 Hz, the Goertzel filter will give a weak response for 1336 even though the

1320 tone means it's there. The filter's test band is too discriminating (or should I say narrow?).

So you DTMF DSP experts out there, what strategies are you aware of that can be used to test for tone presence over a range of frequencies in DTMF decoders (as opposed to a single frequency)?

JJS

Reply to
John Speth

e
e

at

6
s
t

ce-

t

at

-

I've always seen the Goertzel algoritm described as a clever way to implement a dft, which is more or less what you purpose with a complex mix and accumulate

no?

-Lasse

Reply to
langwadt

That, too.

--
www.wescottdesign.com
Reply to
Tim Wescott

A bank of Goerzels A bank of band-pass filters FFT

--
Fredrik Östman
Reply to
Fredrik Östman

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.