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

Classic analog-modeled phaser effect using LFO-modulated allpass filter stages. More...

#include "../Core/Oscillator.h"
#include "../Core/DryWetMixer.h"
#include "../Core/AudioSpec.h"
#include "../Core/AudioBuffer.h"
#include "../Core/DspMath.h"
#include "../Core/StateBlob.h"
#include <algorithm>
#include <array>
#include <atomic>
#include <cmath>
#include <cstddef>
#include <cstdint>
#include <numbers>
#include <vector>
Include dependency graph for Phaser.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  dspark::Phaser< T >
 Zero-latency, highly optimized allpass-based phaser. More...
 
struct  dspark::Phaser< T >::FirstOrderAllpass
 

Namespaces

namespace  dspark
 Main namespace for the DSPark framework.
 

Detailed Description

Classic analog-modeled phaser effect using LFO-modulated allpass filter stages.

Creates the sweeping "jet" sound by passing the signal through a series of first-order allpass filters whose cutoff frequencies are modulated by an LFO. Includes an analog-style saturation stage in the feedback loop to emulate classic hardware behavior and prevent harsh digital clipping.

Three levels of API complexity are provided:

  • Level 1 (Simple): setRate(), setDepth(), setMix()
  • Level 2 (Intermediate): setStages(), setFeedback(), setFrequencyRange()
  • Level 3 (Expert): setLfoWaveform(), setCenterFrequency()

Threading: prepare() belongs to the setup thread; processBlock() and reset() belong to the audio thread. All setters are lock-free atomic publications, safe from any thread; the LFO rate/waveform/spread are applied on the audio thread at the next block (the oscillators are not thread-safe). Non-finite setter arguments are ignored.

Dependencies: Oscillator.h, DryWetMixer.h, AudioSpec.h, AudioBuffer.h, DspMath.h, StateBlob.h.

phaser.prepare(spec);
phaser.setRate(0.5f); // 0.5 Hz sweep
phaser.setFeedback(0.7f); // High resonance
phaser.processBlock(buffer);
Zero-latency, highly optimized allpass-based phaser.
Definition Phaser.h:67
void setFeedback(T amount) noexcept
Injects phase-shifted signal back into the input for resonance.
Definition Phaser.h:300
void prepare(const AudioSpec &spec)
Prepares the phaser and allocates internal state blocks.
Definition Phaser.h:83
void setRate(T hz) noexcept
Sets the speed of the phaser sweep.
Definition Phaser.h:256
void processBlock(AudioBufferView< T > buffer) noexcept
Processes an audio block in-place.
Definition Phaser.h:109

Definition in file Phaser.h.