|
DSPark 1.6.1
Header-only audio DSP framework in pure C++20 β zero dependencies
|
v1.6.1 β 90+ headers of professional audio DSP: filters, dynamics, reverbs, physically-modeled analog (tape, tube, transformer), pitch, spectral tools, EBU-verified metering. One #include, the same code on every target β desktop apps, WebAssembly, mobile, embedded, offline tools, and native VST3/CLAP/AU plugins (effects and MIDI instruments) with HTML/CSS/JS editors.
π Full API documentation: cristianmoresi.github.io/DSPark
CI runs a 630-case test suite and the public conformance suite on every commit across Windows (MSVC, x64 and ARM64), Linux (GCC + Clang, x64 and ARM64), macOS (ARM64) and WebAssembly (Emscripten), plus AddressSanitizer/UBSan, an exceptions-free embedded profile and a single-header amalgamation. Loudness is validated against the official EBU R128 test vectors, and a per-processor quality metrics table (THD+N, noise floor, spurious/aliasing, latency) is generated from the measurements.
No build system. No linking. No configuration. Just include and go.
Most audio DSP libraries fall into two categories: either they require a massive framework dependency, or they cover only a narrow slice of what you need. Nothing gives you everything in a single, portable, dependency-free package.
DSPark was built to change that. Whether you are:
You get the same framework, the same headers, the same API. The difference is how deep you go.
Every processor exposes three levels of complexity:
You never see complexity you don't need. But it's always there when you do.
Effect classes expose protected internals so you can subclass them directly to reach the delay lines, filters and early reflections inside. They are deliberately leaf classes with non-virtual destructors β honouring the zero-virtual-dispatch design β so you extend by direct inheritance and composition rather than polymorphic base-pointer deletion:
| Class | Description |
|---|---|
Equalizer<T> | Multi-band parametric EQ with linear-phase (FFT) and IIR modes |
Compressor<T> | Modular: 5 detectors (Peak, RMS, TruePeak, SplitPolarity, Hilbert), 2 topologies (FF/FB), 4 characters (Clean/Opto/FET/Varimu), upward/downward modes. Hold and range controls, adaptive auto-makeup gain, external sidechain. |
Limiter<T> | ISP true-peak brickwall limiter with adaptive release |
NoiseGate<T> | State machine with hysteresis, hold time, duck mode. External sidechain. |
Expander<T> | Downward expander with threshold, ratio, hold, range |
DynamicEQ<T> | Frequency-selective dynamics (above/below threshold, dual-action) |
MultibandCompressor<T> | Crossover + per-band Compressor, configurable up to 12 bands (compile-time MaxBands) |
TransientDesigner<T> | Attack/sustain shaping via envelope following |
DeEsser<T> | Frequency-targeted dynamic reduction for sibilance |
AlgorithmicReverb<T> | 16-line FDN with Jot (1991) frequency-dependent absorption, Householder feedback mixing, Lexicon-style smooth random + noise modulation, serial allpass per line (Infinity2-style), feedback IIR smoothing (Verbity), allpass-interpolated modulated reads, tanh soft saturation, parallel allpass input diffuser (256 echo paths), Dattorro multi-tap output, output diffusion, M/S stereo width control, progressive ER absorption. 6 presets: Room, Hall, Chamber, Plate, Spring, Cathedral. Full parameter API for custom reverb design. |
Reverb<T> | Convolution reverb with IR loading, pre-delay, auto-resample |
Saturation<T> | 10 algorithms (Tube, Tape, Transformer, SoftClip, HardClip, Exciter, Wavefolder, Bitcrusher, Downsample, MultiStage). Adaptive blend, slew-dependent saturation, oversampling. |
Clipper<T> | 4-mode clipper (Hard/Soft/Analog/GoldenRatio), multi-stage, slew limiter, up to 16x oversampling |
FilterEngine<T> | Cascaded biquads, 9 shapes, 6β48 dB/oct slopes |
CrossoverFilter<T> | Linkwitz-Riley crossover (LR12/24/48), IIR + linear-phase modes |
Chorus<T> | Multi-voice LFO delay, stereo spread, flanger mode |
Phaser<T> | Allpass chain with LFO modulation, configurable stages, stereo LFO spread |
Tremolo<T> | Amplitude modulation with configurable LFO |
Vibrato<T> | Pitch modulation via modulated delay |
RingModulator<T> | Ring modulation with carrier oscillator |
FrequencyShifter<T> | Single-sideband frequency shift via Hilbert transform |
Delay<T> | Interpolated delay with feedback (clean or analog tanh regeneration), ping-pong, filters |
Panner<T> | 6 algorithms: equal-power, binaural (ITD), mid-pan, side-pan, Haas, spectral |
Gain<T> | Smoothed gain with fade, mute, polarity inversion |
AutoGain<T> | Automatic gain compensation based on loudness measurement |
Crossfade<T> | Linear, equal-power, S-curve |
StereoWidth<T> | M/S width control with bass-mono option |
MidSide<T> | Stereo Mid/Side encoding and decoding |
NoiseGenerator<T> | White, pink, and brown noise generation |
DCBlocker<T> | DC offset removal (1-pole or Butterworth order 2β10) |
TapeMachine<T> | Physical tape model: Jiles-Atherton hysteresis at 2x oversampling, NAB/CCIR record/play EQ with exact digital inverses, speed-dependent head-gap/spacing/thickness loss, head bump, common-transport wow & flutter |
TubePreamp<T> | Koren triode stages (12AX7) solved per sample with Newton-Raphson, exact Fender FMV tone stack as a Wave Digital R-type network, power-supply sag |
TransformerModel<T> | Audio transformer coloration: flux-domain Jiles-Atherton core (distortion rises as frequency falls β the LF "bloom"), magnetizing-inductance corner, HF resonance bell |
PitchShifter<T> | Phase vocoder with identity phase locking (Laroche-Dolson), exact tuning, transient phase reset, formant preservation (cepstral lift), stereo-coherent |
GranularProcessor<T> | 64-grain clouds over live input: per-grain pitch/pan/jitter, freeze, equal-power spread |
SpectralDenoiser<T> | Learnable-noise-profile spectral gating with the standard musical-noise defenses |
| Class | Description |
|---|---|
StateVariableFilter<T> | TPT SVF: 8 modes (LP/HP/BP/Notch/AP/Bell/LowShelf/HighShelf), simultaneous multi-output |
LadderFilter<T> | Moog-style 4-pole TPT filter, 6 modes, drive, self-oscillation |
Biquad<T> | TDF-II biquad with 9 coefficient types and lock-free auto-promote of staged coefficients; the filter core is double whatever T is, so a corner far below the sample rate keeps its poles where they were designed |
BiquadCoeffs | Standalone factory for biquad coefficients (LP, HP, BP, Peak, Shelf, Notch, AP, Tilt), always double |
FFTComplex<T> / FFTReal<T> | Radix-2 FFT with SIMD (SSE3/NEON), real-optimised |
Convolver<T> | Partitioned overlap-save FFT convolution |
ZeroLatencyConvolver<T> | Gardner non-uniform partitioning: zero-latency convolution with time-distributed tail FFTs (flat CPU even for second-long IRs) |
wdf::* (WDF.h) | Wave Digital Filter circuit toolkit: R/L/C leaves, series/parallel adaptors, Newton-Raphson diode roots with analytic seeds, and an R-type adaptor (MNA-derived scattering) for non-adaptable topologies |
Hysteresis<T> | Jiles-Atherton magnetic hysteresis with implicit trapezoidal Newton-Raphson solver (tape, transformers) |
ModulationRouter<T> | Block-rate modulation routing: any source callable to any parameter setter, with depth and smoothing |
StateWriter/StateReader | Versioned key/value preset blobs + JSON helpers β every effect implements getState()/setState() |
FIRFilter<T> | FIR engine with windowed-sinc design |
Oversampling<T> | 2xβ16x polyphase half-band Kaiser filters (-80 dB+ rejection), transparent up/down round-trip, exact reported latency |
Oscillator<T> | PolyBLEP (sine, saw, square, triangle) |
WavetableOscillator<T> | Mipmapped wavetable with bandlimited harmonics |
Resampler<T> | Polyphase windowed-sinc sample-rate conversion |
EnvelopeGenerator<T> (ADSREnvelope) | ADSR with exponential curves |
RingBuffer<T> | Power-of-two circular buffer with interpolated read |
SmoothedValue<T> | Parameter smoother (exponential, linear, chase, or disabled) |
Smoothers | 9 smoothing algorithms (linear, exponential, one-pole, asymmetric, slew, SVF, Butterworthβ¦) |
ProcessorChain<T,...> | Zero-overhead compile-time processor chain with per-slot bypass |
SpectralProcessor<T> | STFT-based analysis-modification-synthesis framework |
Dither<T> | TPDF dithering with noise shaping |
DenormalGuard | RAII FTZ/DAZ (x86 SSE, ARM, WebAssembly) |
Interpolation | 5 methods (linear, cubic, Hermite, Lagrange, allpass) |
Hilbert<T> | FIR (windowed-sinc) Hilbert transform for analytic signals β flat magnitude across the audible band |
WindowFunctions<T> | 8 windows (Hann, Hamming, Blackman, Kaiserβ¦) |
DryWetMixer<T> | Parallel dry/wet mixing for effects |
TruePeakDetector<T> | Shared ITU-R BS.1770-4 inter-sample peak detector (used by Compressor, Limiter, LoudnessMeter) |
SpinLock | RT-safe spinlock for thread-safe parameters |
SpscQueue<T> | Lock-free single-producer / single-consumer queue |
AudioSpec | Audio environment descriptor (sample rate, block size, channels) |
AudioBuffer<T> | 32-byte aligned owning buffer (SIMD-ready) |
AudioBufferView<T> | Non-owning view (what processors receive) |
SimdOps | SIMD-accelerated buffer operations (SSE2/AVX/NEON with scalar fallback) |
DspMath | Constants, dB β gain, fast tanh / tan / sin / cos / exp / log / pow10, range mapping |
Phasor<T> | Phase accumulator for LFO and oscillator construction |
SampleAndHold<T> | Sample-and-hold with configurable hold time |
WaveshapeTable<T> | LUT-based waveshaping with linear / cubic interpolation |
AnalogRandom | Analog-flavoured random generators (smooth, noise, jitter) |
AnalogConstants | Reference constants from analog-hardware research (zero runtime cost) |
ProcessorTraits | C++20 concepts: AudioProcessor, SampleProcessor, GeneratorProcessor |
| Class | Description |
|---|---|
LevelFollower<T> | Peak and RMS envelope follower |
EnvelopeFollower<T> | Public attack/release detector (Peak or RMS law) for sidechains, modulation and metering |
SpectrumAnalyzer<T> | Real-time FFT spectrum with peak hold |
LoudnessMeter<T> | EBU R128: momentary, short-term, integrated, LRA, true peak β passes the official EBU test vectors (Tech 3341/3342, BS.1770-5 K-weighting and true-peak interpolator) |
Goertzel<T> | Single-frequency O(N) magnitude detection |
PitchDetector<T> | YIN pitch detection with FFT-accelerated difference function (O(N log N)) |
PitchFollower<T> | Musical pitch tracking source: confidence gating, octave-jump correction, constant-rate semitone glide |
PhaseCorrelation<T> | Stereo correlation/balance meter with a goniometer (vectorscope) point feed |
OnsetDetector<T> | Causal SuperFlux onset detection (log-filtered spectral flux, vibrato-suppressing max filter, Boeck-2012 adaptive peak picker); shared front-end for beat tracking |
| Class | Description |
|---|---|
WavFile | Read/write WAV (PCM 8/16/24/32-bit, float 32/64-bit) |
Mp3File | MPEG-1 Layer III codec β read (CBR/VBR) + write (CBR encoder, 32β320 kbps) |
AudioFile | Abstract base class for custom format implementations |
| Class | Description |
|---|---|
HarmonyConstants | Constexpr musical harmony toolkit: 61 scales (bitmask representation), 15 chord recipes with inversions, MIDI/note conversion, key-aware naming (sharp/flat), diatonic chord generation. Fully constexpr/consteval β generates static tables at compile time. |
ChordDetector<T> | Real-time chord recognition: per-note Goertzel chroma, template matching over ten chord families, bass-note root disambiguation, confidence-gated hold |
Copy the DSPark/ folder into your project. Done.
Requires a C++20 compiler. Tested with MSVC 19.50+, and compatible with GCC 12+, Clang 15+, Emscripten 3+.
Build with optimizations. DSPark is header-only: all DSP code compiles inside your translation units and inherits your build flags. A debug build runs the processors 3-7x slower than release, which matters more here than with libraries that ship precompiled binaries. If an effect seems too slow, check your flags first:
-O2/-O3and-DNDEBUGon GCC/Clang,/O2and/DNDEBUGon MSVC.
DSPark is a DSP framework first, but it ships a complete native plugin layer: the same class that processes your audio becomes a loadable plugin with nothing but this repository β no external SDK to download (Steinberg's official C API header is vendored under its permissive 2025 license).
Sample-accurate parameter automation, state save/restore, soft bypass, latency reporting (including runtime changes), mono/stereo bus negotiation and denormal protection are handled by the layer. The same binary is also a CLAP plugin (DSPARK_CLAP_PLUGIN) and an Audio Unit for Logic Pro (DSPARK_AU_PLUGIN, validated by Apple's auval in CI); presets are byte-portable across all three formats by construction. The optional contract grows with one method each: a host-routable sidechain bus (two-buffer processBlock, examples/plugin_ducker/), MIDI input and instruments (handleMidiEvent + Category::Instrument, examples/plugin_synth/ β an 8-voice synth validated as an aumu music device), host transport for tempo-synced DSP (setTransport), offline render quality switching (setOfflineRendering) and factory presets published to every host's preset browser (factoryPresets). Each capability is proven functionally in CI by dedicated smoke hosts β measured ducking, measured note pitch, measured automation step positions β not just compiled.
For a custom GUI, write it in plain HTML/CSS/JS: the WebView editor layer embeds it in the host window on every format and platform β WebView2 on Windows, WKWebView on macOS, WebKitGTK on Linux/X11 β with a tiny dspark JS bridge for parameters and automation gestures, and a dspark_add_plugin(... EDITOR_HTML ui/editor.html) build step that inlines ordinary separate web files. Every example plugin passes Tracktion's pluginval and clap-validator in CI, and dedicated editor smoke hosts exercise a real web view per platform on every commit.
Start here: the plugin guide documents the complete contract (required and optional methods, what each maps to per format, the threading model, the editor layer per platform, shipping checklists). Inherit dspark::plugin::PluginBase<T> to see every overridable method with safe defaults in one place (examples/plugin_template/), or write a free-standing struct (examples/plugin_saturator/); the WebView editor examples are examples/plugin_webview_editor/ (single file) and examples/plugin_webview_files/ (separate web files).
DSParkLab is an interactive, plugin-style GUI application for real-time testing of every DSPark processor. Load any audio file, enable effects, shape them on an interactive analyzer or with parameter controls, and hear the results instantly.
Features:
Built with Dear ImGui (MIT) and miniaudio (public domain). These dependencies are bundled in DSParkLab/vendor/ and are only used by the testing app β the DSPark framework itself remains 100% dependency-free.
| Platform | Status | Notes |
|---|---|---|
| Windows (MSVC) | Tested in CI | x64 and ARM64, C++20, /W4 (only benign C4324 alignas padding notices) |
| Linux (GCC / Clang) | Tested in CI | x64 and ARM64, C++20, -Wall -Wextra |
| macOS (Clang) | Tested in CI | ARM64, C++20, -Wall -Wextra |
| WebAssembly (Emscripten) | Tested in CI | Zero syscalls in audio path; scalar and SIMD128 |
| iOS / Android | Compatible | ARM NEON denormal flush supported |
| Plugins (VST3 / CLAP / AU) | Native | Built-in plugin layer with WebView editors (guide) |
AudioProcessor, SampleProcessor, GeneratorProcessor), designated initializers, std::numbersprepare()std::atomic with memory_order_relaxed β safe to call from any thread (UI, automation, audio) with zero contentionBiquad::setCoeffs() is consumed automatically by processBlock() and processSample() via a relaxed-load fast path. No external sequencing required.Reverb performance: an Eco engine for constrained targets and direct control over convolution IRs, both prompted by real-world feedback from a synthesizer firmware project (issue #2).
AlgorithmicReverb::setQuality(Quality::Eco) runs a reduced engine (8 FDN lines, control-rate modulation, linear allpass interpolation, leaner output stage) measuring about 3.3x cheaper per block, with the same control set and the same decay calibration. The default Full engine is bit-identical to v1.6.0.setDecayScale() rescales the impulse response's own T60 (estimated from its Schroeder decay curve) and trims the now-silent tail, so shorter decays also cut convolution cost roughly in proportion; setStretch() resamples the IR tape-speed style for larger or smaller spaces. Both always reshape the IR as loaded and republish atomically, exactly like loadIR().The host contract: the plugin layer now covers everything a host can offer an effect or an instrument β each capability one declarative member, each one proven functionally in CI (measured, not just compiled).
handleMidiEvent(MidiEvent) adds a note input to every format (VST3 event bus + IMidiMapping for pitch bend / mod / sustain / pressure, CLAP note ports speaking both CLAP and raw-MIDI dialects, AU MusicDevice selectors), and Category::Instrument builds a true generator: no audio inputs, an aumu Audio Unit, cleared buffers that voices add into. examples/plugin_synth/ β 8 voices, voice stealing, pitch bend, sample-accurate note starts β passes auval and plays a measured 440 Hz in CI.setTransport(TransportInfo) delivers tempo, musical position, time signature, loop points and play state per block, from the VST3 ProcessContext, the CLAP transport event and the AU host callbacks β the basis for tempo-synced delays, LFOs and gates.ChannelSupport restricts it when the DSP is inherently stereo); the sidechain mirrors the main width.setOfflineRendering(bool) switches quality for bounces; factoryPresets publishes to every host's preset browser (VST3 program list, CLAP preset-load + preset-discovery, AU factory presets); host bypass and the active program now persist in the state container; process() runs under DSPark's denormal guard.tools/plugin_probe.cpp encodes what the wrapper delivers into its output, and the smoke hosts measure it β transport DC, the offline sign flip, an automation step landing on its exact sample, note pitch by zero crossings, the latency-changed notification β on every platform, on every commit. pluginval and clap-validator caught two real state-persistence bugs along the way; both fixed and now regression-covered.MIT License. See [LICENSE](LICENSE).
Free to use in commercial and open-source projects. Attribution appreciated.
Cristian Moresi β Software developer and music producer with professional experience in mixing engineering and sound design.
DSPark was created to provide a truly free, professional-grade DSP toolkit accessible to developers at every level of expertise β from desktop app builders to DSP engineers designing embedded audio systems. It is a genuine open-source alternative to commercial audio frameworks, built from the ground up with no dependencies and no compromises.
Contributions are welcome. Please open an issue to discuss proposed changes before submitting a pull request.
Building and testing the framework needs only a C++20 compiler and CMake:
See CONTRIBUTING.md for the full development workflow, the conventions the codebase follows, and what CI checks on every commit.
For bug reports, include: compiler version, platform, minimal reproduction code.