C version of the Optimized Goertzel algorithm (https://www.embedded.com/the-goertzel-algorithm/) with DTMF detector code.
Please refer to the example used as a test on the test/test.c
file. In short terms:
- Init a
goertzel_dtmf_state
structure by callinggoertzel_dtmf_detect
with the sample rate and the number of samples to process. - Call
goertzel_dtmf_add_sample_pcm8
orgoertzel_dtmf_add_sample_pcm16
to add the configured number of samples. - Detect the DTMF symbol by reading the return value of
goertzel_dtmf_detect
. The thresholds should be tweaked accordingly to the amplitude and sampling frequency that's being used.
- Init a
goertzel_state
structure by callinggoertzel_init
with the sample rate and the number of samples to process. - Call
goertzel_process_sample_pcm8
orgoertzel_process_sample_pcm16
to add the configured number of samples. - Detect the squared Goertzel magnitude with the return value of
goertzel_get_squared_magnitude
. The thresholds should be tweaked accordingly to the amplitude and sampling frequency that's being used. If the magnitude value is required,goertzel_get_magnitude
is available.