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>
|
void | 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)
|
|
float | getTargetFrequency () const |
| Get the target frequency.
|
|
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.
|
|
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()
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: