I try to decode freqs of 17k & 17.8k which carry on a sinus of 15ms duration.

I try to decode them with a goertzel filter. It seems fine when one of the filters show a magnitude that is around 800. But, the filter has his own mood and after several hours of checking the system again it produces a very low magnitude. I thought of using a band pass filter so I can decide if the frequency is there or not by extraction the energy inside the BPF.

What is better?


public class Goertzel
    public double GoertzelFilter(float[] samples, int start, int end,double coeff)
        double sPrev = 0.0;
        double sPrev2 = 0.0;
        int i;
        for (i = start; i < end; i++)
            double s = samples[i] + coeff * sPrev - sPrev2;
            sPrev2 = sPrev;
            sPrev = s;
        double power = sPrev2 * sPrev2 + sPrev * sPrev - coeff * sPrev * sPrev2;
        return power;
  • $\begingroup$ The Goertzel filter is a bandpass filter. In basic form it is inherently marginally stable. How did you implement it? $\endgroup$ – Olli Niemitalo Jun 4 '15 at 7:45
  • $\begingroup$ I updated the post. The big problem is that record by NAudio(c#) is somehow filtering the signals I want although I didn't applied any filters there. I see a very small magnitude return from the goertzel. $\endgroup$ – axcelenator Jun 4 '15 at 7:49
  • $\begingroup$ I assume that you call GoertzelFilter() once for each 15 ms frame, feeding that function all samples belonging to the frame. How do you ensure synchronization, that you actually start at the beginning of the frame? If your transmitter and receiver have independent clocks there could be drift, and you would go out of sync. $\endgroup$ – Olli Niemitalo Jun 4 '15 at 7:56
  • $\begingroup$ Firstly I search for a start delimiter which is another freq of 10K and 200ms duration. Also there is an End Delimiter. After I search for them I calculae how many bits are in the frame. 99% of the time it is accurate. It worked very well but yesterday the goertzel started to show magnitudes like 0.0000014. So a spectrum showing the recorded file is showing that the 17K is somewhere in -100db. Very low. So I think I have a problem with the record code. But it is very strange $\endgroup$ – axcelenator Jun 4 '15 at 8:00

Your Answer

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

Browse other questions tagged or ask your own question.