Single-frequency Goertzel algorithm implementation for tone detection. The Goertzel algorithm is an efficient way to compute the magnitude of a specific frequency component in a signal. It's particularly useful for DTMF (touch-tone) detection and other single-frequency detection applications.
More...
#include <GoerzelStream.h>
|
| bool | begin (const GoertzelConfig &config) |
| | Initialize the Goertzel detector with configuration.
|
| |
|
int | getBlockSize () const |
| | Get the block size.
|
| |
|
const GoertzelConfig & | getConfig () const |
| | Get the current configuration.
|
| |
| float | getMagnitude () const |
| | Get the magnitude of the detected frequency.
|
| |
| float | getMagnitudeSquared () const |
| | Get the squared magnitude (more efficient if you don't need the actual magnitude)
|
| |
|
void * | getReference () |
| |
|
float | getTargetFrequency () const |
| | Get the target frequency.
|
| |
| bool | isDetected () const |
| | Check if the detected magnitude is above the configured threshold.
|
| |
| bool | isDetected (float threshold) const |
| | Check if the detected magnitude is above a threshold.
|
| |
| bool | processSample (float sample) |
| | Process a single sample.
|
| |
|
void | reset () |
| | Reset the detector state.
|
| |
|
void | setReference (void *ref) |
| |
|
|
float | coeff = 0.0f |
| |
|
GoertzelConfig | config |
| |
|
float | magnitude = 0.0f |
| |
|
float | magnitude_squared = 0.0f |
| |
|
void * | reference = nullptr |
| |
|
float | s1 = 0.0f |
| |
|
float | s2 = 0.0f |
| |
|
int | sample_count = 0 |
| |
Single-frequency Goertzel algorithm implementation for tone detection. The Goertzel algorithm is an efficient way to compute the magnitude of a specific frequency component in a signal. It's particularly useful for DTMF (touch-tone) detection and other single-frequency detection applications.
This implementation expects normalized float samples in the range [-1.0, 1.0]. For different sample formats, use GoertzelStream which handles format conversion.
- Author
- pschatzmann
- Copyright
- GPLv3
◆ begin()
Initialize the Goertzel detector with configuration.
- Parameters
-
◆ getMagnitude()
| float getMagnitude |
( |
| ) |
const |
|
inline |
Get the magnitude of the detected frequency.
- Returns
- Magnitude value
◆ getMagnitudeSquared()
| float getMagnitudeSquared |
( |
| ) |
const |
|
inline |
Get the squared magnitude (more efficient if you don't need the actual magnitude)
- Returns
- Squared magnitude value
◆ isDetected() [1/2]
| bool isDetected |
( |
| ) |
const |
|
inline |
Check if the detected magnitude is above the configured threshold.
- Returns
- True if magnitude is above configured threshold
◆ isDetected() [2/2]
| bool isDetected |
( |
float |
threshold | ) |
const |
|
inline |
Check if the detected magnitude is above a threshold.
- Parameters
-
- Returns
- True if magnitude is above threshold
◆ processSample()
| bool processSample |
( |
float |
sample | ) |
|
|
inline |
Process a single sample.
- Parameters
-
| sample | Input sample (normalized float in range [-1.0, 1.0]) |
- Returns
- True if block is complete and magnitude is available
The documentation for this class was generated from the following file: