3
$\begingroup$

I've written a quick test app that uses the Goertzel algorithm to determine if a given frequency is present in the signal. This is to pick up DTMF tones and various other signals. The app appears to be working. I'm using the 'magnitude squared' approach in my final stage.

http://www.embedded.com/design/configurable-systems/4024443/The-Goertzel-Algorithm

Now, how does this magnitude relate to all the other variables (especially the amplitude of the source signal)? Most of the implementations determine the presence of a given frequency if the magnitude exceeds some threshold. I want to know how this threshold is determined, and how would I go about selecting a suitable threshold.

EDIT:

OK, I think I've found the answer (I hope). Most implementations of the algorithm state that is will return the 'relative power'. I couldn't find any that stated what it was relative to.

This morning, it dawned on me (pun intended) that it's probably relative to the input signal (duh!). So, if we calculated what the power of the input signal is over all the samples taken, and then compare this to the relative power given by the algorithm, we should have a good idea of the contribution of our target frequency?

Is my understanding correct?

$\endgroup$
3
$\begingroup$

You can potentially base the threshold on the overall energy in the frame. If the tone has, say, 10% or more of the total energy, there is a good bet it's there and not just noise.

In general FFT based algorithms may not be the best choice for this. Unless your tone and your local sample clock are phase-locked, you can't line up the tone on one of the FFT bins (or your Goertzel frequency) so the energy of the tone will "smear" out over multiple frequency bins. The FFT is actually a pretty band band pass filter.

The alternative would be a time-domain band pass filter with a well defined bandwidth and steepness. This would also get rid of the framing constraint and you can dial in the time constant based on the properties of the signal rather then internal properties of the algorithm.

$\endgroup$
  • 1
    $\begingroup$ That run contrary to just about every resource I've read. Goertzel seems to be the 'go to' method by default when DTMF is concerned. $\endgroup$ – His Royal Redness Mar 10 '13 at 20:42
  • $\begingroup$ Goertzel is a 'discrete' case of the FFT algorithm which is used to distinguish between two or more known frequencies. It works well for this use case. FFT is used when you don't know what frequencies to expect. $\endgroup$ – dodgy_coder Aug 12 '13 at 8:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.