1
$\begingroup$

I'm trying to use the goertzel algorithm to detect a pair of frequencies in a signal.

The sample rate I'm using is 8000 hz, and the size of the incoming sample buffer is 60 samples.

I have a large array of 600 samples in size, so each time a new buffer comes in I move the data 60 samples to the right in the large buffer to make room for the new buffer, which I put at the front of the array (from index 0).

[ buffer0 | ... | buffer9 ]

I apply the goertzel algo to this large array. I'm looking for the frequencies 133.33 and 333.33 hz.

My algorithm gives me normalized magnitude. For the first frequency, I get a more or less stable detected magnitude around 0.5, which is also the amplitude of the original signal (I'm responsible for generating the signal myself). So that seems correct.

For the second frequency, I get a wildly varying normalized magnitude which seems to vary between 0.0 and 0.50, almost in a sine-like fashion. I know that the amplitude of this sine wave is 0.5.

When I save the generated signals and analyze them using audacity's spectrum feature I can see the correct frequencies in the spectrum, so it looks like the signal is being generated correctly.

My questions:

1) the algorithm seems to have a hard time detecting the second frequency. Why? 2) what is the relationship between the number of samples used for running the goertzel algo, and the detected frequencies?

My goal is to detect 64 unique combinations, so I was thinking of generating one frequency from a set of 16 and another one from a set of 4 and then just adding the two signals with 0.5 amplitude.

Thanks B

$\endgroup$

1 Answer 1

1
$\begingroup$

Since Görtzel computes a part of the DFT, the relation between detectable frequencies is the same. So with 8000Hz sampling rate and 600 samples you cover the frequency range of -4000Hz to 4000Hz with 600 frequency intervals, and both your frequencies are points of the subdivision, thus both should be perfectly detectable.

Can you show the code for the Görtzel iterations?


Or even before that, did you build the test signals using $\sin(\pi\cdot f\cdot t)$ or $\sin(2\pi\cdot f\cdot t)$? Only the second gives the correct frequency, the first could explain your observations, since the 600 samples would then contain $12.5$ periods of the oscillation for $f=333.33Hz$, but full $5$ for $133.33Hz$.

$\endgroup$

Your Answer

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

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