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.


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.


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?

  • $\begingroup$ Have you ever found an answer to that question? I find that the average signal power tends to be quite low compared to the high magnitude squared responses of Goertzel (even if the actual frequency is +100 Hz off). Maybe the average signal power could be used to normalize the response somehow? $\endgroup$ Commented Nov 16, 2019 at 17:47
  • $\begingroup$ Ok, I think I got it. Insteaid of using the average signal power, I'm calculating the total signal energy (basically just the sum of all squared signal values) and divide the Goertzel response by that. This makes the responses independent of the signal strength/volume and also helps to prevent the detection of false positives in noisy signals. $\endgroup$ Commented Nov 17, 2019 at 11:22

1 Answer 1


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.

  • 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$ Commented Mar 10, 2013 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$ Commented Aug 12, 2013 at 8:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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