|
DSPark 1.6.1
Header-only audio DSP framework in pure C++20 — zero dependencies
|
Single-include umbrella header for the DSPark framework. More...
#include "Core/SimdOps.h"#include "Core/DspMath.h"#include "Core/AudioSpec.h"#include "Core/AudioBuffer.h"#include "Core/AnalogConstants.h"#include "Core/TruePeakDetector.h"#include "Core/SpinLock.h"#include "Core/SpscQueue.h"#include "Core/Biquad.h"#include "Core/DryWetMixer.h"#include "Core/Smoothers.h"#include "Core/AnalogRandom.h"#include "Core/Oscillator.h"#include "Core/Oversampling.h"#include "Core/FFT.h"#include "Core/WindowFunctions.h"#include "Core/MinBlepTable.h"#include "Core/FIRFilter.h"#include "Core/Convolver.h"#include "Core/ZeroLatencyConvolver.h"#include "Core/WDF.h"#include "Core/ModulationRouter.h"#include "Core/StateBlob.h"#include "Core/Hysteresis.h"#include "Core/Resampler.h"#include "Core/EnvelopeGenerator.h"#include "Core/Dither.h"#include "Core/SmoothedValue.h"#include "Core/ProcessorTraits.h"#include "Core/ProcessorChain.h"#include "Core/DenormalGuard.h"#include "Core/Interpolation.h"#include "Core/Phasor.h"#include "Core/SampleAndHold.h"#include "Core/RingBuffer.h"#include "Core/WaveshapeTable.h"#include "Core/WavetableOscillator.h"#include "Core/Hilbert.h"#include "Core/LadderFilter.h"#include "Core/StateVariableFilter.h"#include "Core/SpectralProcessor.h"#include "Effects/MidSide.h"#include "Effects/Saturation.h"#include "Effects/Delay.h"#include "Effects/Filters.h"#include "Effects/Panner.h"#include "Effects/Gain.h"#include "Effects/DCBlocker.h"#include "Effects/Crossfade.h"#include "Effects/StereoWidth.h"#include "Effects/Compressor.h"#include "Effects/Limiter.h"#include "Effects/NoiseGate.h"#include "Effects/Equalizer.h"#include "Effects/Reverb.h"#include "Effects/Chorus.h"#include "Effects/Phaser.h"#include "Effects/AlgorithmicReverb.h"#include "Effects/NoiseGenerator.h"#include "Effects/Tremolo.h"#include "Effects/Vibrato.h"#include "Effects/RingModulator.h"#include "Effects/FrequencyShifter.h"#include "Effects/DeEsser.h"#include "Effects/AutoGain.h"#include "Effects/CrossoverFilter.h"#include "Effects/Expander.h"#include "Effects/TransientDesigner.h"#include "Effects/DynamicEQ.h"#include "Effects/MultibandCompressor.h"#include "Effects/Clipper.h"#include "Effects/PitchShifter.h"#include "Effects/TapeMachine.h"#include "Effects/TubePreamp.h"#include "Effects/TransformerModel.h"#include "Effects/GranularProcessor.h"#include "Effects/SpectralDenoiser.h"#include "Analysis/LevelFollower.h"#include "Analysis/SpectrumAnalyzer.h"#include "Analysis/LoudnessMeter.h"#include "Analysis/Goertzel.h"#include "Analysis/PitchDetector.h"#include "Analysis/PitchFollower.h"#include "Analysis/PhaseCorrelation.h"#include "Analysis/EnvelopeFollower.h"#include "Analysis/OnsetDetector.h"#include "IO/AudioFile.h"#include "IO/WavFile.h"#include "IO/Mp3File.h"#include "Music/HarmonyConstants.h"#include "Music/ChordDetector.h"Go to the source code of this file.
Single-include umbrella header for the DSPark framework.
A complete, standalone audio DSP framework in pure C++20. Zero external dependencies - only the C++ standard library. Works on any platform: Windows, macOS, Linux, WebAssembly, iOS, Android.
This is a header-only library. No compilation, no linking, no build system required. Just add the DSPark/ folder to your project's include path.
DSPark/ folder into your project directory (e.g., MyApp/libs/DSPark/).DSPark/ (e.g., $(ProjectDir)libs).The framework uses no platform-specific APIs - it compiles directly with Emscripten. Pair with the Web Audio API's AudioWorklet for real-time processing.
Add the DSPark/ include path to your VST3 project. In your processor class:
Every processor in this framework follows the same three-step pattern:
prepare(AudioSpec) once before processing. This is the only step that may allocate memory. Call again if sample rate or block size changes.process() / processBlock() / processSample() in your audio callback. These methods are real-time safe (zero allocations, no locks).Before processing, you tell each processor about your audio setup:
resize(), 32-byte aligned for SIMD. Use this for internal storage.This example shows how to set up a processing chain in a real-time audio application (Windows Forms, Qt, standalone app, etc.). Your audio driver (WASAPI, CoreAudio, ALSA, etc.) calls your callback with raw float pointers.
Load a WAV file, process it, and save the result. No audio driver needed.
Convert a WAV file to MP3 with processing applied:
For files too large to fit in memory, process in blocks (streaming):
| Class | Header | Purpose |
|---|---|---|
Equalizer<T> | Effects/Equalizer.h | Multi-band parametric EQ (Peak/Shelf/LP/HP/Notch, 1-16 bands) |
FilterEngine<T> | Effects/Filters.h | Multi-mode cascaded filter (LP/HP/BP/Peak/Shelf/Notch, 6-48 dB/oct) |
Saturation<T> | Effects/Saturation.h | 10 saturation algorithms (tube, tape, transformer, wavefolder...) |
Delay<T> | Effects/Delay.h | Delay line with interpolation, feedback filters, ping-pong |
Reverb<T> | Effects/Reverb.h | Convolution reverb with IR loading, pre-delay, dry/wet |
Chorus<T> | Effects/Chorus.h | Chorus/flanger with multi-voice LFO, stereo spread |
Phaser<T> | Effects/Phaser.h | Allpass phaser with configurable stages, feedback, LFO |
Panner<T> | Effects/Panner.h | 6 stereo panning algorithms (equal-power, binaural, Haas, spectral) |
MidSide<T> | Effects/MidSide.h | Stereo Mid/Side encoding and decoding |
Gain<T> | Effects/Gain.h | Smoothed gain with fade, mute, polarity inversion |
DCBlocker<T> | Effects/DCBlocker.h | DC offset removal (1-pole or Butterworth order 2-10) |
Crossfade<T> | Effects/Crossfade.h | Crossfade with linear, equal-power, S-curve |
StereoWidth<T> | Effects/StereoWidth.h | Stereo width via M/S with bass-mono option |
Compressor<T> | Effects/Compressor.h | Modular compressor (3 detectors, 2 topologies, 4 characters, ext. sidechain) |
Limiter<T> | Effects/Limiter.h | ISP true-peak brickwall limiter with adaptive release |
NoiseGate<T> | Effects/NoiseGate.h | Noise gate with hysteresis, hold, duck mode, ext. sidechain |
Expander<T> | Effects/Expander.h | Downward expander with ratio, hysteresis, ext. sidechain |
CrossoverFilter<T> | Effects/CrossoverFilter.h | Linkwitz-Riley crossover (2-12 bands, LR12/24/48, IIR + linear-phase) |
MultibandCompressor<T> | Effects/MultibandCompressor.h | Multi-band compressor (crossover split + per-band Compressor) |
DynamicEQ<T> | Effects/DynamicEQ.h | Per-band dynamic EQ (above/below threshold, ext. sidechain) |
TransientDesigner<T> | Effects/TransientDesigner.h | Dual-envelope transient shaper (attack/sustain control) |
AlgorithmicReverb<T> | Effects/AlgorithmicReverb.h | FDN reverb: Room/Hall/Chamber/Plate/Spring/Cathedral presets |
NoiseGenerator<T> | Effects/NoiseGenerator.h | White/pink/brown noise generator (AudioProcessor contract) |
Tremolo<T> | Effects/Tremolo.h | LFO amplitude modulation with stereo auto-pan option |
Vibrato<T> | Effects/Vibrato.h | Pitch modulation via LFO-driven delay line |
RingModulator<T> | Effects/RingModulator.h | Ring modulation (signal x carrier) with mix control |
FrequencyShifter<T> | Effects/FrequencyShifter.h | Constant-Hz frequency shift via Hilbert transform |
PitchShifter<T> | Effects/PitchShifter.h | Phase-vocoder pitch shift +/-12 st (identity phase locking) |
TapeMachine<T> | Effects/TapeMachine.h | Physical tape: JA hysteresis, NAB/CCIR EQ, losses, wow/flutter |
TubePreamp<T> | Effects/TubePreamp.h | Koren 12AX7 stages, WDF FMV tone stack (R-type), supply sag |
TransformerModel<T> | Effects/TransformerModel.h | Audio transformer: flux-domain JA hysteresis, LF bloom, HF bell |
GranularProcessor<T> | Effects/GranularProcessor.h | Granular clouds/freeze: per-grain pitch, jitter, stereo spread |
SpectralDenoiser<T> | Effects/SpectralDenoiser.h | Learnable-profile spectral gating noise reduction |
ChordDetector<T> | Music/ChordDetector.h | Goertzel chroma + template chord recognition with confidence |
DeEsser<T> | Effects/DeEsser.h | Split-band de-esser with dynamic sibilance detection |
AutoGain<T> | Effects/AutoGain.h | Automatic gain compensation for honest A/B comparison |
Clipper<T> | Effects/Clipper.h | Multi-mode clipper (Hard/Soft/Analog/GoldenRatio, oversampling) |
LadderFilter<T> | Core/LadderFilter.h | Moog-style 4-pole resonant filter (TPT, 6 modes, drive) |
StateVariableFilter<T> | Core/StateVariableFilter.h | TPT SVF: LP/HP/BP/Notch/AP/Bell/Shelf, multi-output, mod-friendly |
Oversampling<T> | Core/Oversampling.h | 2x-16x oversampling with FIR half-band Kaiser filters (-80 dB+) |
Oscillator<T> | Core/Oscillator.h | PolyBLEP oscillator (sine, saw, square, triangle; minBLEP hard sync) |
MinBlepTable<T> | Core/MinBlepTable.h | Minimum-phase band-limited step residual (cepstral, FFT-built) |
WavetableOscillator<T> | Core/WavetableOscillator.h | Mipmapped wavetable oscillator (bandlimited) |
DryWetMixer<T> | Core/DryWetMixer.h | Dry/wet parallel mix for effects |
| Class | Header | Purpose |
|---|---|---|
LevelFollower<T> | Analysis/LevelFollower.h | Peak and RMS envelope follower |
SpectrumAnalyzer<T> | Analysis/SpectrumAnalyzer.h | Real-time FFT spectrum analyser with peak hold |
LoudnessMeter<T> | Analysis/LoudnessMeter.h | EBU R128 LUFS metering (momentary/short/integrated) |
Goertzel<T> | Analysis/Goertzel.h | Single-frequency O(N) magnitude detection |
PitchDetector<T> | Analysis/PitchDetector.h | YIN monophonic pitch detection with MIDI/cents output |
PitchFollower<T> | Analysis/PitchFollower.h | Gated, octave-safe, glide-smoothed pitch tracking source |
PhaseCorrelation<T> | Analysis/PhaseCorrelation.h | Stereo correlation/balance meter + goniometer feed |
EnvelopeFollower<T> | Analysis/EnvelopeFollower.h | Peak/RMS envelope source with per-channel readouts |
OnsetDetector<T> | Analysis/OnsetDetector.h | Causal SuperFlux onset detection (Boeck-2012 picker, shared beat front-end) |
| Class | Header | Purpose |
|---|---|---|
AudioFile | IO/AudioFile.h | Abstract reader/writer interface + AudioFileInfo metadata |
WavFile | IO/WavFile.h | Read/write WAV files (PCM 8/16/24/32, float 32/64) |
Mp3File | IO/Mp3File.h | MPEG-1 Layer III codec - read (CBR/VBR) + write (CBR encoder) |
| Class | Header | Purpose |
|---|---|---|
harmony::* | Music/HarmonyConstants.h | 61 scales, 15 chords, MIDI, note naming, diatonic generation |
| Class | Header | Purpose |
|---|---|---|
AudioBuffer<T> | Core/AudioBuffer.h | Owning audio buffer (32-byte aligned, SIMD-ready) |
AudioBufferView<T> | Core/AudioBuffer.h | Non-owning view – what processors receive |
AudioSpec | Core/AudioSpec.h | Audio environment descriptor (rate, block, channels) |
Biquad<T> | Core/Biquad.h | Single biquad filter with 9 coefficient types |
BiquadCoeffs | Core/Biquad.h | Filter coefficient calculator (Audio EQ Cookbook) |
FFTReal<T> | Core/FFT.h | Radix-2 FFT with SIMD (SSE2/NEON), real-optimised |
FIRFilter<T> | Core/FIRFilter.h | FIR filter with windowed-sinc design |
Convolver<T> | Core/Convolver.h | Partitioned overlap-save FFT convolution |
ZeroLatencyConvolver<T> | Core/ZeroLatencyConvolver.h | Gardner non-uniform convolution (zero latency, flat CPU) |
wdf::* | Core/WDF.h | Wave digital filters: R/L/C, adaptors, NR diode roots |
Hysteresis<T> | Core/Hysteresis.h | Jiles-Atherton magnetic hysteresis (implicit NR solver) |
ModulationRouter<T> | Core/ModulationRouter.h | Block-rate modulation routing: sources to parameter setters |
StateWriter/StateReader | Core/StateBlob.h | Versioned preset blobs + JSON helpers (getState/setState) |
Resampler<T> | Core/Resampler.h | Polyphase windowed-sinc sample rate converter |
WindowFunctions<T> | Core/WindowFunctions.h | 8 window functions (Hann, Kaiser, Blackman...) |
Smoothers | Core/Smoothers.h | 9 parameter smoothing algorithms |
EnvelopeGenerator<T> | Core/EnvelopeGenerator.h | ADSR envelope for synthesis and dynamics |
Dither<T> | Core/Dither.h | TPDF dithering with noise shaping |
DenormalGuard | Core/DenormalGuard.h | RAII denormal flush (SSE FTZ/DAZ, ARM FZ) |
Interpolation | Core/Interpolation.h | 5 interpolation methods (linear to Lagrange) |
Phasor<T> | Core/Phasor.h | Phase accumulator for oscillators/LFOs |
RingBuffer<T> | Core/RingBuffer.h | Power-of-two circular buffer with interp. read |
SampleAndHold<T> | Core/SampleAndHold.h | S&H for bit-crush and stepped modulation |
WaveshapeTable<T> | Core/WaveshapeTable.h | Table-lookup waveshaper with presets |
Hilbert<T> | Core/Hilbert.h | Allpass Hilbert transform for analytic signals |
TruePeakDetector<T> | Core/TruePeakDetector.h | Shared ITU-R BS.1770-4 inter-sample peak detector |
AnalogConstants | Core/AnalogConstants.h | Analog-hardware reference constants (zero runtime cost) |
SpinLock | Core/SpinLock.h | RT-safe spinlock for thread-safe parameters |
SpscQueue<T> | Core/SpscQueue.h | Lock-free single-producer/single-consumer queue |
AnalogRandom | Core/AnalogRandom.h | Analog-style noise (white/pink/brown) |
SmoothedValue<T> | Core/SmoothedValue.h | Parameter smoother (exponential, linear, chase, disabled) |
ProcessorChain<T,...> | Core/ProcessorChain.h | Zero-overhead compile-time processor chain with per-slot bypass |
SpectralProcessor<T> | Core/SpectralProcessor.h | STFT analysis-modification-synthesis with user callback |
DspMath | Core/DspMath.h | dB/gain conversions, fastTanh, constants |
SimdOps | Core/SimdOps.h | SIMD-accelerated buffer ops (SSE2/AVX/NEON/scalar) |
std::atomic with memory_order_relaxed, callable from any thread with zero contention.#include.dspark namespace.plugin/ and is NOT pulled in by this umbrella: include plugin/DSParkPlugin.h and the format headers explicitly when building a plugin. See docs/plugins.md.The framework defines C++20 concepts in ProcessorTraits.h that formalise the processor interface. These are compile-time contracts - zero overhead, no vtable, clear error messages if you forget a method.
All processors in this framework satisfy AudioProcessor. You can use these concepts in your own code to write generic functions or verify your classes:
ProcessorChain lets you combine multiple processors into a single unit with zero runtime overhead. All dispatch is resolved at compile time via std::tuple and fold expressions.
Saturation and WaveshapeTable support integrated oversampling to reduce aliasing from harmonic generation. Just call setOversampling():
Every processor uses a single API with three levels of depth:
Quick reference for common DSP terms used throughout this framework:
| Term | Meaning |
|---|---|
| Sample rate | Number of audio samples per second (e.g., 44100, 48000 Hz). |
| dB (decibel) | Logarithmic unit for loudness. +6 dB = double amplitude. |
| dBFS | Decibels relative to full scale. 0 dBFS = max digital level. |
| dBTP | Decibels True Peak - accounts for inter-sample peaks. |
| Gain | Amplitude multiplier. 1.0 = unity (no change). |
| Q factor | Filter bandwidth. Low Q = wide, high Q = narrow/resonant. |
| Nyquist | Maximum representable frequency = sampleRate / 2. |
| FFT | Fast Fourier Transform - converts time domain to frequency. |
| Biquad | 2nd-order IIR filter - the workhorse of audio EQ. |
| IIR / FIR | Infinite/Finite Impulse Response - two fundamental filter types. |
| Oversampling | Processing at a higher sample rate to reduce aliasing. |
| Aliasing | Distortion from frequencies above Nyquist folding back. |
| Threshold | Level (dB) above which a compressor/limiter begins acting. |
| Ratio | Compression ratio. 4:1 means 4 dB input over threshold = 1 dB output. |
| Attack | Time for compressor to reach full compression after threshold. |
| Release | Time for compressor to return to unity after signal drops. |
| Knee | Transition region around threshold. Soft knee = gradual onset. |
| Makeup gain | Gain applied after compression to restore perceived loudness. |
| Lookahead | Delay allowing the processor to "see" transients in advance. |
| ISP | Inter-Sample Peak - peak that occurs between digital samples. |
| LUFS | Loudness Unit Full Scale - perceptual loudness measurement. |
| Dry/Wet | Unprocessed/processed signal. Mix 50/50 = parallel processing. |
| LFO | Low Frequency Oscillator - modulation source (0.1-20 Hz). |
| IR | Impulse Response - acoustic fingerprint of a space or device. |
| Denormal | Tiny float values that cause CPU spikes in IIR filters. |
| PolyBLEP | Polynomial Band-Limited Step - anti-aliasing for oscillators. |
| M/S | Mid/Side encoding. Mid = (L+R)/2, Side = (L-R)/2. |
| Allpass | Filter that changes phase without affecting magnitude. |
Definition in file DSPark.h.