"The Goertzel algorithm is a technique in digital signal processing (DSP) for efficient evaluation of the individual terms of the discrete Fourier transform (DFT). It is useful in certain practical applications, such as recognition of dual-tone multi-frequency signaling (DTMF) tones produced by the push buttons of the keypad of a traditional analog telephone. The algorithm was first described by Gerald Goertzel in 1958." [0]
It's also a nice project for an ESP32 with a MEMS microphone.
100% great suggestion. I found this solution the hard way, by hand, on paper, a few weeks before learning this algorithm already existed. Reminded me that a large percentage of efficient engineering is just knowing what tools you have available off the shelf.
The algorithm I figured out was mostly equivalent, though about 3x slower than implementing Goertzel. In my use case, it was already a win hitting the product requirements, but implementing Goertzel allowed background functionality to operate better while capturing data.
From Wikipedia:
"The Goertzel algorithm is a technique in digital signal processing (DSP) for efficient evaluation of the individual terms of the discrete Fourier transform (DFT). It is useful in certain practical applications, such as recognition of dual-tone multi-frequency signaling (DTMF) tones produced by the push buttons of the keypad of a traditional analog telephone. The algorithm was first described by Gerald Goertzel in 1958." [0]
It's also a nice project for an ESP32 with a MEMS microphone.
[0] https://en.wikipedia.org/wiki/Goertzel_algorithm