DSPark 1.6.1
Header-only audio DSP framework in pure C++20 — zero dependencies
Loading...
Searching...
No Matches
Goertzel.h File Reference

Goertzel algorithm for efficient single-frequency detection. More...

#include "../Core/DspMath.h"
#include <algorithm>
#include <cassert>
#include <cmath>
#include <numbers>
Include dependency graph for Goertzel.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  dspark::Goertzel< T >
 Single-frequency magnitude detector using the Goertzel algorithm. More...
 

Namespaces

namespace  dspark
 Main namespace for the DSPark framework.
 

Detailed Description

Goertzel algorithm for efficient single-frequency detection.

The Goertzel algorithm computes the magnitude and phase at a specific frequency in O(N) time. It acts as an extremely narrow bandpass filter evaluated over a specific block size (N).

Note
Because it uses a rectangular window inherently, if the target frequency does not align exactly with a harmonic of the window (fs/N), it will suffer from spectral leakage. For precise offline analysis, consider pre-windowing your input data (e.g., Hann window).

Threading: owner-managed. All methods (prepare, push/process, readouts, reset) are meant to be called from the thread that owns the stream; no internal synchronization is provided. Use one instance per thread.

Dependencies: DspMath.h.

Definition in file Goertzel.h.