ggwave icon indicating copy to clipboard operation
ggwave copied to clipboard

question: how about using a Goertzel filter?

Open aguaviva opened this issue 5 years ago • 4 comments

I was wondering, did you try using a Goertzel filter? That allows you to compute the power of a single frequency, that is what is used to detect the DTMF tones. This would spare you having to compute the FFT.

aguaviva avatar Jan 13 '21 14:01 aguaviva

This is definitely something to explore. I remember doing some experiments with it in the past, but not sure why I gave up on it. It looks like very well suited for this approach.

ggerganov avatar Jan 13 '21 19:01 ggerganov

So I started some experiments using the Goertzel algorithm in the experiment/goertzel branch and I think I now remember what was the problem with this approach. The Goertzel algorithm is only more efficient than FFT if you want to observe less than log(N) frequencies. In ggwave with current default Tx protocols we use 96 frequencies for the audible protocols and another 96 frequencies for the ultrasound protocols. N is 1024 so log(N) is 10. This means there will be no computational gain if the Goertzel algorithm is used instead of FFT.

For DTMF the number of frequencies is just 8 so there is some benefit using this approach. Also, it saves some memory so I guess it is the preferred method in applications with limited memory.

However, for ggwave I don't think there will be any positive effect unless I am missing something.

ggerganov avatar Feb 07 '21 20:02 ggerganov

Sounds good! I didn't know you were using so many frequencies!

aguaviva avatar Feb 09 '21 21:02 aguaviva

In ggwave v0.2.0 we now have Dual-Tone protocols that use just 32 frequencies, so Goertzel might be back on the table. Moreover, I think it would be nice to add support for vanilla DTMF, so I guess I'll keep this issue open to remind me about this and provide updates in the future.

ggerganov avatar Feb 20 '21 18:02 ggerganov