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_statestructure by callinggoertzel_dtmf_detectwith the sample rate and the number of samples to process. - Call
goertzel_dtmf_add_sample_pcm8orgoertzel_dtmf_add_sample_pcm16to 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_statestructure by callinggoertzel_initwith the sample rate and the number of samples to process. - Call
goertzel_process_sample_pcm8orgoertzel_process_sample_pcm16to 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_magnitudeis available.