|
DSPark 1.6.1
Header-only audio DSP framework in pure C++20 — zero dependencies
|
Modular dynamic range compressor with analog-modeled ballistics and Hilbert detection. More...
#include "../Core/DspMath.h"#include "../Core/AudioSpec.h"#include "../Core/AudioBuffer.h"#include "../Core/SmoothedValue.h"#include "../Core/RingBuffer.h"#include "../Core/DenormalGuard.h"#include "../Core/Hilbert.h"#include "../Core/TruePeakDetector.h"#include "../Core/StateBlob.h"#include <algorithm>#include <array>#include <atomic>#include <cmath>#include <cstddef>#include <cstdint>#include <numbers>#include <vector>

Go to the source code of this file.
Classes | |
| class | dspark::Compressor< T > |
| High-fidelity modular compressor designed for real-time applications. More... | |
| struct | dspark::Compressor< T >::FeedbackLaw |
| Element law result: static target (dB, <= 0) and its |slope|. More... | |
| struct | dspark::Compressor< T >::FeedbackSolve |
| Semi-implicit solve result: stepped gain and the law's target. More... | |
Namespaces | |
| namespace | dspark |
| Main namespace for the DSPark framework. | |
Modular dynamic range compressor with analog-modeled ballistics and Hilbert detection.
Professional compressor with interchangeable detector, topology, and ballistics character. Gain smoothing runs in the log (dB) domain: the transparent characters use a smoothed branching one-pole (the design recommended by Giannoulis/Massberg/Reiss, JAES 2012), and the analog characters (Opto, FET) run a dual-envelope model with compression-history memory that reproduces the two-stage program-dependent release of the hardware they are named after.
FeedBack operation is calibrated to the observed curve: the gain element's law is the closed-form inverse of the user's static curve, so the settled loop lands exactly on the requested ratio and knee (hardware front panels are marked with observed ratios; a raw feed-forward law inside a feedback loop can never compress past 2:1). With the peak detector the loop is resolved semi-implicitly per sample, which keeps it unconditionally stable down to the FET's 20 us attack.
Features:
Threading: prepare()/reset() from a setup thread only (never concurrent with audio). processBlock()/processSample() from the audio thread that owns the stream. All setters and getState() are safe from any thread (atomic publication; the audio thread consumes changes at block/sample boundaries). Invalid setter values (NaN/Inf, wild enums) are ignored or clamped, so no control-thread input can poison the audio path. getGainReductionDb()/getLatency() are metering/host reads (relaxed).
Dependencies: DspMath.h, AudioSpec.h, AudioBuffer.h, SmoothedValue.h, RingBuffer.h, DenormalGuard.h, Hilbert.h, TruePeakDetector.h, StateBlob.h.
Definition in file Compressor.h.