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

High-performance Chorus / Flanger effect with LFO-modulated delay lines. More...

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

Go to the source code of this file.

Classes

class  dspark::Chorus< T >
 Multi-voice chorus/flanger with true stereo spread and smooth parameter handling. More...
 

Namespaces

namespace  dspark
 Main namespace for the DSPark framework.
 

Detailed Description

High-performance Chorus / Flanger effect with LFO-modulated delay lines.

Creates the classic chorus effect by mixing the dry signal with delayed copies whose delay time is modulated by LFOs. Multiple voices with phase-offset LFOs create a rich, wide stereo field.

Engineered for real-time performance:

  • No transcendental functions (sin, cos) in the audio hot path (the LFOs and the feedback saturation use polynomial approximations). The inner loop itself is a serial recursion (feedback plus parameter smoothing), so it does not vectorize; the per-sample work is branch-light instead.
  • Sample-rate-invariant one-pole parameter smoothing for zipper-free automation.
  • Tape-style feedback saturation prevents digital clipping.

Threading: prepare() belongs to the setup thread (allocates; never call it concurrently with processing). processBlock() and reset() belong to the audio thread. All setters are lock-free atomic publications, safe from any thread; LFO reconfiguration (voices, waveform, spread) is deferred to the next processBlock() on the audio thread. Non-finite setter arguments are ignored.

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

Definition in file Chorus.h.