|
DSPark 1.6.1
Header-only audio DSP framework in pure C++20 — zero dependencies
|
Zero-latency, highly optimized allpass-based phaser. More...
#include <Phaser.h>

Classes | |
| struct | FirstOrderAllpass |
Public Member Functions | |
| ~Phaser ()=default | |
| void | prepare (const AudioSpec &spec) |
| Prepares the phaser and allocates internal state blocks. | |
| void | processBlock (AudioBufferView< T > buffer) noexcept |
| Processes an audio block in-place. | |
| void | reset () noexcept |
| Clears internal DSP state and history buffers. Call this when transport stops or playback jumps. | |
| void | setRate (T hz) noexcept |
| Sets the speed of the phaser sweep. | |
| void | setDepth (T amount) noexcept |
| Sets how wide the frequency sweep is. | |
| void | setMix (T dryWet) noexcept |
| Balances the unprocessed and processed signal. | |
| void | setStages (int count) noexcept |
| Configures the intensity/color of the phaser via filter stages. | |
| void | setFeedback (T amount) noexcept |
| Injects phase-shifted signal back into the input for resonance. | |
| void | setStereoSpread (T amount) noexcept |
| Sets the stereo phase spread of the sweep LFO. | |
| void | setCenterFrequency (T hz) noexcept |
| Defines the midpoint of the logarithmic frequency sweep. | |
| void | setFrequencyRange (T minHz, T maxHz) noexcept |
| Explicitly defines the sweep boundaries. | |
| void | setLfoWaveform (typename Oscillator< T >::Waveform wf) noexcept |
| Changes the geometric shape of the LFO modulation. | |
| int | getStages () const noexcept |
| Retrieves the active stage count. | |
| T | getRate () const noexcept |
| Retrieves the current sweep rate. | |
| std::vector< uint8_t > | getState () const |
| Serializes the parameter state (setup/UI threads; allocates). | |
| bool | setState (const uint8_t *data, size_t size) |
| Restores parameters from a blob (tolerant; rejects foreign ids). | |
Static Public Attributes | |
| static constexpr int | kMaxStages = 12 |
Protected Attributes | |
| AudioSpec | spec_ {} |
| std::atomic< T > | rate_ { T(0.5) } |
| std::atomic< T > | depth_ { T(0.8) } |
| std::atomic< T > | mix_ { T(0.5) } |
| std::atomic< T > | feedback_ { T(0) } |
| std::atomic< T > | minFreq_ { T(200) } |
| std::atomic< T > | maxFreq_ { T(6000) } |
| std::atomic< int > | numStages_ { 4 } |
| std::atomic< typename Oscillator< T >::Waveform > | lfoWaveform_ { Oscillator<T>::Waveform::Sine } |
| std::atomic< T > | stereoSpread_ { T(0) } |
| bool | prepared_ { false } |
| T | currentDepth_ { T(0.8) } |
| T | currentFb_ { T(0) } |
| T | smoothCoef_ { T(0.01) } |
| T | lastSpread_ { T(-1) } |
| int | lastStages_ { kMaxStages } |
| std::array< FirstOrderAllpass, kMaxStages > | stages_ {} |
| std::array< T, kMaxChannels > | fbState_ {} |
| Oscillator< T > | lfo_ |
| Oscillator< T > | lfoR_ |
| DryWetMixer< T > | mixer_ |
Static Protected Attributes | |
| static constexpr int | kMaxChannels = 16 |
Zero-latency, highly optimized allpass-based phaser.
Employs parameter smoothing to prevent zipper noise and utilizes fast math approximations for real-time performance.
| T | Sample type (must satisfy FloatType concept, e.g., float or double). |
|
default |
|
inlinenoexcept |
|
inlinenoexcept |
|
inline |
|
inline |
|
inlinenoexcept |
Processes an audio block in-place.
| buffer | The AudioBufferView containing channels to process. |
|
inlinenoexcept |
|
inlinenoexcept |
Defines the midpoint of the logarithmic frequency sweep.
Keeps the current sweep RATIO and recenters it geometrically. Callable before prepare() (a 20 kHz ceiling stands in for Nyquist until the rate is known; the per-sample cutoff clamp covers later rate changes anyway).
| hz | Center frequency in Hertz (non-positive or non-finite values are ignored). |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inline |
|
inlinenoexcept |
Sets the stereo phase spread of the sweep LFO.
Offsets the right channel's LFO phase against the left, like classic hardware stereo phasers. 0 = mono-coherent sweep (both channels move together), 1 = fully opposed (180-degree) sweep.
| amount | Spread amount [0.0, 1.0]. Applied on the audio thread. Non-finite values are ignored. |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
staticconstexprprotected |
|
staticconstexpr |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |