question: how about using a Goertzel filter?
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.
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.
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.
Sounds good! I didn't know you were using so many frequencies!
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.