Pre-calculation of Geortzel coefficient
Hello, I have found an implementation of the Goertzel algorithm that contains code that I don't understand. And more specifically the pre-calculation of coefficients. :pensive_face:
At the top of the code there is :
#define DTMF_697Hz 27980
#define DTMF_770Hz 26956
#define DTMF_852Hz 25701
#define DTMF_941Hz 24219These defines are used inside the goertzel calculation like such :
for (i = 0; i < N; i++)
{
v0 = ((cos_fact * v1) >> 14) - v2 + *x;
x++;
v2 = v1;
v1 = v0;
}x is my buffer.
v0, v1 and v2 are long int
cos_fact is the one of defines I showed above and passed as a function parameter.
My questions would be: What do these define correspond to? How to pre-calculate them for other frequencies? Is it normal that the values are so far apart?
Thank you ! :smiling_face_with_smiling_eyes:
ps: This code is part of ampm_open_lib and my goal would be to use it for detecting other frequencies than DTMFs tones.
