Goertzel/DTMF decoding on Atmel

142 views
Skip to first unread message

Josh Myer

unread,
Nov 29, 2009, 6:28:25 PM11/29/09
to Signaltunnel
Does anyone have experience with the Goertzel Algorithm for frequency
detection?

I've been tinkering with doing DTMF decoding on an atmel for a few
evenings, and it's been great fun, but not quite come to fruition.
Right now, I'm trying to get the basic idea working in C code on my
Big Computer, using PCM and AU files as input.

Here's what I've found thus far:

I got the list of frequencies to decode at: http://en.wikipedia.org/wiki/Dual-tone_multi-frequency

And am trying to use the Goertzel Algorithm (http://en.wikipedia.org/
wiki/Goertzel_algorithm) for frequency decoding. In this, I'm not
quite getting something right, but I'm not entirely sure what.

My input files are all unsigned ints (8 and 16 bits) at 11.025kHz or
8.0kHz. I normalize the sample points down to the range [0.0, 1.0].
I take my normalized frequency (omega) as 697/11025, with a window of
105 samples. This sort of works, but not really. I'm wondering if
I'm losing state somewhere or something.

I found a handy paper on DTMF decoding at
http://ptolemy.eecs.berkeley.edu/papers/96/dtmf_ict/www/node3.html ;
it leads me to believe that I'm doing this all correctly.

http://www.embedded.com/story/OEG20020819S0057 also looks promising,
but I'm still missing some detail.

I hope to have this working soonish, but figured I should post it to
get the list started on a fun note.

Happy hacking,
--
/jbm

Jonathan Foote

unread,
Nov 29, 2009, 10:12:28 PM11/29/09
to Signaltunnel

Are you prototyping in floating point or fixed? Starting with FP will
give you an idea if overflow is going to be an issue.

When doing frequency detection, spectral leakage routinely kicks my
ass. Without knowing the details, I'm guessing it may be a problem.
Sanity checks: try a super-long window, or window size with a integer
number of cycles from one of your sinusoids.

-J

On Nov 29, 3:28 pm, Josh Myer <josh.m...@gmail.com> wrote:
> Does anyone have experience with the Goertzel Algorithm for frequency
> detection?
>
> I've been tinkering with doing DTMF decoding on an atmel for a few
> evenings, and it's been great fun, but not quite come to fruition.
> Right now, I'm trying to get the basic idea working in C code on my
> Big Computer, using PCM and AU files as input.
>
> Here's what I've found thus far:
>
> I got the list of frequencies to decode at:http://en.wikipedia.org/wiki/Dual-tone_multi-frequency
>
> And am trying to use the Goertzel Algorithm (http://en.wikipedia.org/
> wiki/Goertzel_algorithm) for frequency decoding.  In this, I'm not
> quite getting something right, but I'm not entirely sure what.
>
> My input files are all unsigned ints (8 and 16 bits) at 11.025kHz or
> 8.0kHz.  I normalize the sample points down to the range [0.0, 1.0].
> I take my normalized frequency (omega) as 697/11025, with a window of
> 105 samples.  This sort of works, but not really.  I'm wondering if
> I'm losing state somewhere or something.
>
> I found a handy paper on DTMF decoding athttp://ptolemy.eecs.berkeley.edu/papers/96/dtmf_ict/www/node3.html;
> it leads me to believe that I'm doing this all correctly.
>
> http://www.embedded.com/story/OEG20020819S0057also looks promising,

Christoph

unread,
Dec 7, 2009, 5:39:55 AM12/7/09
to Signaltunnel
On Nov 29, 7:12 pm, Jonathan Foote <rrm...@gmail.com> wrote:
> Are you prototyping in floating point or fixed? Starting with FP will
> give you an idea if overflow is going to be an issue.
>
> When doing frequency detection, spectral leakage routinely kicks my
> ass. Without knowing the details, I'm guessing it may be a problem.
> Sanity checks: try a super-long window, or window size with a integer
> number of cycles from one of your sinusoids.
>
> -J
>
> On Nov 29, 3:28 pm, Josh Myer <josh.m...@gmail.com> wrote:
>
> > Does anyone have experience with the Goertzel Algorithm for frequency
> > detection?
[...]
> > I found a handy paper on DTMF decoding athttp://ptolemy.eecs.berkeley.edu/papers/96/dtmf_ict/www/node3.html;
> > it leads me to believe that I'm doing this all correctly.
>
> >http://www.embedded.com/story/OEG20020819S0057alsolooks promising,
> > but I'm still missing some detail.

I seemed to recall that a Management Material former colleague of
mine,
dug out the Goertzel filter to come up with something "simpler" than
my "complicated math",
so I had to prove that what I had already implemented was
computationally as efficient
AND had better performance.

The reason why my algorithm
(in essence,
a digital quadrature oscillator mixing the target frequency to DC,
followed by a bank of overlapping Hann window FIR low pass filters)
performs better
was explained by my roommate from China: superior out-of-band
rejection.

See
http://pony.noisebridge.net/~cmaier/signaltunnel/Goertzel.pdf
for the gory details of the proof.

If I dig deeper, I probably also have the assembly code somewhere.

Christoph
Reply all
Reply to author
Forward
0 new messages