|
DSPark 1.6.1
Header-only audio DSP framework in pure C++20 — zero dependencies
|
High-performance STFT analysis-modification-synthesis pipeline. More...
#include <SpectralProcessor.h>
Public Member Functions | |
| void | prepare (const AudioSpec &spec, int fftSize=2048, int hopSize=0) |
| Allocates buffers and prepares the WOLA processing state. | |
| template<typename Func > | |
| void | processBlock (AudioBufferView< T > buffer, Func &&processFunc) noexcept |
| Processes a block of audio through the STFT pipeline. | |
| int | getLatency () const noexcept |
| I/O latency in samples: exactly one FFT frame. | |
| int | getFFTSize () const noexcept |
| int | getNumBins () const noexcept |
| int | getHopSize () const noexcept |
| void | reset () noexcept |
| Clears all internal delay lines and state variables. | |
High-performance STFT analysis-modification-synthesis pipeline.
Callback contract:
Channels beyond the prepared channel count pass through dry. The first fftSize output samples after prepare()/reset() are the windowed ramp-in of the zero-primed analysis ring (silence before input arrives).
| T | Sample type (float or double). |
Definition at line 82 of file SpectralProcessor.h.
|
inlinenoexcept |
Definition at line 255 of file SpectralProcessor.h.
|
inlinenoexcept |
Definition at line 257 of file SpectralProcessor.h.
|
inlinenoexcept |
I/O latency in samples: exactly one FFT frame.
Constant and independent of the caller's block sizes.
Definition at line 254 of file SpectralProcessor.h.
|
inlinenoexcept |
Definition at line 256 of file SpectralProcessor.h.
|
inline |
Allocates buffers and prepares the WOLA processing state.
Not real-time safe (allocates). Any previous stream state is cleared. An invalid spec (non-positive or NaN sample rate, no channels) is ignored, preserving the previous state.
| spec | Audio environment specification. |
| fftSize | FFT size (default 2048). Must be a power of two; in release builds any other value is rounded up to the next power of two within [4, 1<<20]. |
| hopSize | Hop size in samples. Values <= 0 (default) select fftSize/2 (50% overlap). Clamped to [1, fftSize/2]; non-divisors of fftSize fall back to fftSize/2 (a non-divisor hop would break the COLA condition and cause audible amplitude modulation). |
Definition at line 104 of file SpectralProcessor.h.
|
inlinenoexcept |
Processes a block of audio through the STFT pipeline.
In-place; arbitrary block sizes are supported and produce bit-identical output regardless of how the stream is chopped. Inlines the provided callback to manipulate frequency bins without function call overhead. Safe no-op before prepare().
| Func | Callback type, compatible with void(T* freqData, int numBins). Must not throw. |
| buffer | Audio block to process in-place. |
| processFunc | User-defined spectral modification function. |
Definition at line 179 of file SpectralProcessor.h.
|
inlinenoexcept |
Clears all internal delay lines and state variables.
Definition at line 260 of file SpectralProcessor.h.