File syn_goertzel.h¶
FileList > dsp > syn_goertzel.h
Go to the source code of this file
Integer-Only Goertzel Algorithm Single-Frequency Tone Detector. More...
#include "../common/syn_defs.h"#include <stdbool.h>#include <stddef.h>#include <stdint.h>
Classes¶
| Type | Name |
|---|---|
| struct | SYN_Goertzel Goertzel Filter Instance State. |
Public Functions¶
| Type | Name |
|---|---|
| uint64_t | syn_goertzel_get_magnitude_sq (const SYN_Goertzel * g) Calculate the squared magnitude |X(k)|^2 at the end of a sample block. |
| SYN_Status | syn_goertzel_init (SYN_Goertzel * g, uint32_t sample_rate_hz, uint32_t target_freq_hz, size_t block_size) Initialize a Goertzel Filter instance. |
| size_t | syn_goertzel_process_block (SYN_Goertzel * g, const int16_t * samples, size_t count) Process a buffer of 16-bit PCM samples through the Goertzel filter. |
| SYN_Status | syn_goertzel_process_sample (SYN_Goertzel * g, int16_t sample) Process a single 16-bit PCM sample through the Goertzel filter. |
| SYN_Status | syn_goertzel_reset (SYN_Goertzel * g) Reset Goertzel filter delay accumulators for a new sample block. |
Detailed Description¶
Provides a zero-malloc fixed-point implementation of the Goertzel algorithm for efficient single-frequency magnitude evaluation and DTMF tone decoding on resource-constrained microcontrollers without running full FFTs.
Public Functions Documentation¶
function syn_goertzel_get_magnitude_sq¶
Calculate the squared magnitude |X(k)|^2 at the end of a sample block.
Parameters:
gPointer to Goertzel instance.
Returns:
64-bit squared magnitude value |X(k)|^2 (or 0 if invalid).
function syn_goertzel_init¶
Initialize a Goertzel Filter instance.
SYN_Status syn_goertzel_init (
SYN_Goertzel * g,
uint32_t sample_rate_hz,
uint32_t target_freq_hz,
size_t block_size
)
Parameters:
gPointer to Goertzel instance.sample_rate_hzSampling frequency in Hz (e.g. 8000).target_freq_hzTarget tone frequency in Hz (e.g. 697 for DTMF row 1).block_sizeSample block size N (e.g. 205).
Returns:
SYN_OK on success, or SYN_INVALID_PARAM.
function syn_goertzel_process_block¶
Process a buffer of 16-bit PCM samples through the Goertzel filter.
Parameters:
gPointer to Goertzel instance.samplesArray of 16-bit signed PCM input samples.countSample count in array.
Returns:
Number of samples actually processed.
function syn_goertzel_process_sample¶
Process a single 16-bit PCM sample through the Goertzel filter.
Parameters:
gPointer to Goertzel instance.sample16-bit signed PCM input sample.
Returns:
SYN_OK on success, or SYN_INVALID_PARAM.
function syn_goertzel_reset¶
Reset Goertzel filter delay accumulators for a new sample block.
Parameters:
gPointer to Goertzel instance.
Returns:
SYN_OK on success, or SYN_INVALID_PARAM.
The documentation for this class was generated from the following file src/syntropic/dsp/syn_goertzel.h