"Thomas Magma" <

[email protected]> wrote in message

news:

[email protected]

> Say I set up my Goertzel algorithm to detect a 1000Hz tone. What happens

> if the tone coming in is 1020Hz?How about 1100Hz? Will I still get gain

> from my Goertzel detector? I guess my question is, what is the shape and

> bandwidth of the Goertzel when used as a tone detector? I'm guessing it

> has something to do with the amount of samples processed...is there a

> formula for this?

>
Hello Thomas,

Yes there is a formula for this. The function is called a Dirichlet

function - otherwise known as a periodic sync function. This is found by

finding the DFT of a rectangular window. Remember the Goertzel algo is a way

of finding the DFT of a function for a single bin's frequency.

The gain formula is

X(f) = (1/N)*sin(pi*f*N/F)/sin(pi*f/F)

where N is the number of samples,

f is the difference between your signal's frequency and the analysis

frequency,

and F is the sample rate.

For example let N=205, the sample rate is 8000Hz, your signal's freq. is 697

Hz, and you are using bin number 18, so the center frequency is simply

702.439Hz.

Then f = 697 - 702.439 = - 5.439 Hz.

X(f) then equals 0.96835 or -0.279 dB.

Also the energy loss is 1-X(f)*X(f) = 0.06229 or 6.229% of the energy will

show up in the other bins. This last formula is the result of Bessel's

identity (special case of Parseval's theorem)

IHTH,

Clay