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

Phase accumulator producing a [0, 1) ramp for oscillators and LFOs. More...

#include "DspMath.h"
#include "AudioSpec.h"
#include <cmath>
#include <limits>
Include dependency graph for Phasor.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  dspark::Phasor< T >
 Phase accumulator generating a [0, 1) ramp for oscillators and modulation. More...
 

Namespaces

namespace  dspark
 Main namespace for the DSPark framework.
 

Detailed Description

Phase accumulator producing a [0, 1) ramp for oscillators and LFOs.

Building block for table oscillators, LFOs and modulation carriers (WavetableOscillator, Vibrato, Tremolo, RingModulator). The accumulator and increment live in double internally (framework rule: recursive state in double) so ultra-slow LFO rates neither stall nor drift - a float accumulator freezes completely below ~3e-3 Hz at 96 kHz (the per-sample increment rounds to zero against the phase's ulp) and runs slow LFOs measurably fast (+0.125% at 0.1 Hz). The public API stays in T.

Threading: owner-managed. Not internally thread-safe: call setters and advance() from the owning (audio) thread, or synchronise externally.

Dependencies: DspMath.h (FloatType), AudioSpec.h.

Definition in file Phasor.h.