DSPark 1.9.0
Header-only C++20 DSP for real-time and offline audio
Loading...
Searching...
No Matches
dspark::Compressor< T > Class Template Reference

High-fidelity modular compressor designed for real-time applications. More...

#include <Compressor.h>

Collaboration diagram for dspark::Compressor< T >:

Classes

struct  AsymDrift
 One channel's walk: smoothed draws, followed in a line between them. More...
 
struct  BalanceBands
 State of the two bands the balance of one channel's key is read from. More...
 
struct  CharacterProfile
 What makes a character: the numbers one engine reads. More...
 
struct  ChunkParams
 Parameter values of a block whose smoothers are settled. More...
 
struct  FeedbackLaw
 Element law result: static target (dB, <= 0) and its |slope|. More...
 
struct  FeedbackSolve
 Semi-implicit solve result: stepped gain and the law's target. More...
 
struct  FeedForwardConfig
 Per-block routing of the feed-forward block path. More...
 
struct  GainPathConfig
 Per-block routing of the gain path (see gainPath()). More...
 
struct  InterpHistory
 History of the key of one channel, mirrored so its window is contiguous. More...
 
struct  Layers
 What the two layers of a layered character ask for at a level (dB). More...
 
struct  LookaheadRamp
 The lookahead as a ramp (LookaheadShape::Ramp). More...
 
struct  LoopCoeffs
 Coefficients of one step of the semi-implicit loop. More...
 
struct  MakeupModelKey
 Everything the analytic makeup depends on: it is worked out again only when one of these changes. More...
 
struct  ProgramCoeffs
 The two coefficients of a frame. More...
 
struct  ProgramState
 State of one gain computer under programme-dependent timing. More...
 
struct  ProgramTiming
 The weights of a block (zero where the routing leaves the times fixed). More...
 
struct  SlidingDeepest
 The deepest gain change of a sliding window (HoldMode::EveryPeak). More...
 

Public Types

enum class  DetectorType {
  Peak , Rms , TruePeak , SplitPolarity ,
  Hilbert , Hybrid
}
 Level detection methodologies. More...
 
enum class  Topology { FeedForward , FeedBack }
 Signal routing topology for the detector sidechain. More...
 
enum class  Character {
  Clean , Opto , FET , Varimu ,
  Layered
}
 Time-constant behavior and release curve shape. More...
 
enum class  Mode { Downward , Upward , Both , Leveler }
 Processing direction. More...
 
enum class  CleanBallistics { Branching , Decoupled }
 Ballistics of the Clean character in feed-forward (see setCleanBallistics). More...
 
enum class  AutoMakeupMode { Off , Static , Adaptive , Analytic }
 Automatic makeup-gain behavior (Static and Adaptive apply in Downward mode). More...
 
enum class  Precision { Standard , High }
 How finely the control signal is computed (see setPrecision()). More...
 
enum class  LinkMode { Loudest , Dominant }
 What the linked level of a stereo pair reads (see setLinkMode()). More...
 
enum class  Route {
  Stereo , MidSide , Mid , Side ,
  MidKeysSide , SideKeysMid
}
 What of a stereo pair the compressor works on (see setRoute()). More...
 
enum class  LookaheadShape { Lead , Ramp }
 How the lookahead brings a reduction in (see setLookaheadShape()). More...
 
enum class  RangeShape { Corner , Asymptotic , Local }
 How the gain change meets the range (see setRangeShape()). More...
 
enum class  StagePosition { Off , Before , After }
 Where the analog colour stage sits (see setCharacterStage()). More...
 
enum class  HoldMode { Deepest , EveryPeak }
 What the hold keeps (see setHoldMode()). More...
 
enum class  OptoCell { TwoStage , ThreeStage }
 The optical cell of the Opto character (see setOptoCell()). More...
 
using StageSettings = typename CharacterStage< T >::Settings
 The settings of the colour stage (Core/CharacterStage.h).
 
using KeyEq = KeyEqualizer< T, 16 >
 The equalizer of the key (see setSidechainBand()).
 
using KeyBand = typename KeyEq::Band
 The settings of one band of the key equalizer.
 
using KeyShape = typename KeyEq::Shape
 What a band of the key equalizer does.
 
using KeyPlacement = typename KeyEq::Placement
 The part of a two-channel key a band of the key equalizer acts on.
 

Public Member Functions

 ~Compressor ()=default
 
void prepare (const AudioSpec &spec)
 Allocates buffers and initializes internal DSP state.
 
void prepare (double sampleRate) noexcept
 Prepares the compressor using sample rate only (backward compatibility).
 
void processBlock (AudioBufferView< T > buffer) noexcept
 Processes an audio buffer in-place using its own signal as the sidechain.
 
void processBlock (AudioBufferView< T > audio, AudioBufferView< T > sidechain) noexcept
 Processes audio with an independent external sidechain.
 
T processSample (T input, int channel) noexcept
 Processes a single sample on one channel.
 
void reset () noexcept
 Resets all internal DSP history, states, and buffers to neutral.
 
void setThreshold (T dB) noexcept
 Sets the compression threshold in dB.
 
void setRatio (T ratio) noexcept
 Sets the compression ratio (1.0 = off, >20.0 = limiting).
 
void setAttack (T ms) noexcept
 Sets the attack time in milliseconds.
 
void setRelease (T ms) noexcept
 Sets the release time in milliseconds (clamped to >= 1 ms: below that the envelope stops smoothing at all and the gain path degenerates into a waveshaper).
 
void setKnee (T dB) noexcept
 Sets knee width in dB (0 = hard knee, >0 = soft knee).
 
void setMakeupGain (T dB) noexcept
 Sets manual static makeup gain in dB.
 
void setAutoMakeup (AutoMakeupMode mode) noexcept
 Selects the automatic makeup behavior (default: Off).
 
void setAutoMakeup (bool on) noexcept
 Convenience overload: true selects Adaptive, false turns auto makeup off.
 
void setMode (Mode mode) noexcept
 Sets the curve of the gain computer (Downward, Upward, Both or Leveler).
 
void setLift (T belowDb, T ratio, T rangeDb) noexcept
 Sets the upward half of Mode::Both: what lies under a second, lower threshold is raised.
 
T getLiftBelow () const noexcept
 Distance of the lower threshold of Mode::Both under the main one, in dB (setLift()).
 
T getLiftRatio () const noexcept
 Ratio of the rise of Mode::Both (setLift()).
 
T getLiftRange () const noexcept
 The most Mode::Both raises, in dB (setLift()).
 
void setStereoLink (T amount) noexcept
 Sets stereo linking amount (0.0 = unlinked dual mono, 1.0 = fully linked).
 
void setLinkMode (LinkMode mode) noexcept
 Chooses how a stereo pair is linked.
 
LinkMode getLinkMode () const noexcept
 
void setRoute (Route route) noexcept
 Chooses what of a stereo pair is compressed, and from which part of the key.
 
Route getRoute () const noexcept
 What of a stereo pair is compressed (setRoute()).
 
void setMidSideFocus (T focus) noexcept
 In Route::MidSide, how the compression leans to the middle or to the sides, -1 to 1: at 0 (the default) each part takes its whole gain; toward -1 the sides take less of theirs (their reduction and makeup in decibels scaled by 1 + focus), at -1 only the middle is compressed and the sides come out as they went in; toward 1 the same for the middle. The detectors and the gain loop are those of the route, so the focus sweeps without a step: it moves across each block, sample by sample. Non-finite values are ignored. State key "midSideFocus" (absent = 0).
 
T getMidSideFocus () const noexcept
 
void setMix (T dryWet) noexcept
 Sets dry/wet balance for parallel (New York) compression (1.0 = fully wet).
 
void setLookahead (T ms) noexcept
 Sets lookahead time in ms (0 = off, max = 10ms).
 
void setMaxLookahead (T ms) noexcept
 Keeps a latency of its own for the lookahead, so the lookahead can move without the latency changing.
 
T getMaxLookahead () const noexcept
 The latency kept for the lookahead, in ms (0: none; see setMaxLookahead()).
 
void setLookaheadShape (LookaheadShape shape) noexcept
 Chooses how the lookahead brings a reduction in (Lead by default).
 
LookaheadShape getLookaheadShape () const noexcept
 
void setFeedbackKeyed (bool on) noexcept
 In FeedBack, runs the loop on the key ahead of the audio.
 
bool isFeedbackKeyed () const noexcept
 
void setAutoThreshold (bool on) noexcept
 Makes the threshold count from the key's own recent peak instead of from full scale.
 
bool isAutoThreshold () const noexcept
 Whether the threshold counts from the key's recent peak (setAutoThreshold()).
 
T getThresholdInUseDb () const noexcept
 The threshold in use, in dBFS (metering; any thread): the set one, or with setAutoThreshold() the key's recent peak plus it.
 
void setAmount (T amount) noexcept
 Sets how much of the gain change is applied, as a scale of its decibels.
 
T getAmount () const noexcept
 The share of the gain change that is applied (setAmount()).
 
void setSoftRange (bool on) noexcept
 Makes the gain change approach the range without a corner.
 
bool isSoftRange () const noexcept
 Whether the gain change meets the range without a corner (setSoftRange(), setRangeShape()).
 
void setRangeShape (RangeShape shape) noexcept
 Selects how the gain change meets the range.
 
RangeShape getRangeShape () const noexcept
 How the gain change meets the range (setRangeShape()).
 
void setPrecision (Precision precision) noexcept
 Selects how finely the control signal is computed (default: Standard).
 
Precision getPrecision () const noexcept
 How finely the control signal is computed (see setPrecision()).
 
void setCharacterStage (StagePosition position) noexcept
 Puts an analog colour stage before or after the compression.
 
StagePosition getCharacterStage () const noexcept
 Where the colour stage sits (see setCharacterStage()).
 
void setCharacterStageSettings (const StageSettings &settings) noexcept
 Sets drive, emphasis, asymmetry, drift, sag and noise of the colour stage. Any thread.
 
StageSettings getCharacterStageSettings () const noexcept
 The settings of the colour stage.
 
void setProgramRelease (T amount) noexcept
 Makes the release depend on how long the compressor has been working.
 
T getProgramRelease () const noexcept
 Weight of the programme-dependent release (see setProgramRelease()).
 
void setAdaptiveAttack (T amount) noexcept
 Makes the attack depend on how far the target is.
 
T getAdaptiveAttack () const noexcept
 Weight of the target-dependent attack (see setAdaptiveAttack()).
 
void setSpectralTiming (T amount) noexcept
 Makes attack and release follow the spectral balance of the key.
 
T getSpectralTiming () const noexcept
 Weight of the spectral balance on the times (see setSpectralTiming()).
 
void setAttackEmphasis (T amount) noexcept
 Deepens or softens the gain change while it attacks.
 
T getAttackEmphasis () const noexcept
 Emphasis of the attack (see setAttackEmphasis()).
 
void setDetector (DetectorType type) noexcept
 Changes the level detection algorithm (Peak, RMS, TruePeak, SplitPolarity, Hilbert, Hybrid).
 
void setHoldTime (T ms) noexcept
 Sets the gain-reduction hold time.
 
void setHoldMode (HoldMode mode) noexcept
 Chooses what the hold keeps (Deepest by default).
 
HoldMode getHoldMode () const noexcept
 
void setRange (T dB) noexcept
 Limits the maximum gain change the compressor may apply.
 
void setTopology (Topology topo) noexcept
 Changes signal routing topology (FeedForward or FeedBack).
 
void setCharacter (Character type) noexcept
 Changes ballistics and envelope behavior character.
 
void setOptoCell (OptoCell cell) noexcept
 Chooses how the cell of the Opto character remembers.
 
OptoCell getOptoCell () const noexcept
 
void setCharacterColor (T amount) noexcept
 Sets the amount of the character's harmonic signature (0 to 1).
 
void setGainSmoothing (T ms) noexcept
 Smooths the gain after the ballistics (milliseconds; 0, the default, is off).
 
T getGainSmoothing () const noexcept
 The smoothing of the gain after the ballistics, in milliseconds.
 
void setReleaseLanding (T ms) noexcept
 Makes the last decibels of a release come back slowly (milliseconds; 0, the default, is off).
 
T getReleaseLanding () const noexcept
 The landing of the release, in milliseconds (setReleaseLanding()).
 
void setControlNetwork (T depthDb, T cornerHz=T(10)) noexcept
 A lead-lag network in the control path: only a part of each fast move of the gain is applied at once.
 
T getControlNetworkDepth () const noexcept
 Depth of the network in the control path, in dB (setControlNetwork()).
 
T getControlNetworkCorner () const noexcept
 Corner of the network in the control path, in Hz (setControlNetwork()).
 
void setReductionTone (T lowDb, T highDb) noexcept
 Makes the tone change with the reduction.
 
T getReductionToneLow () const noexcept
 Gain under 200 Hz of the tone that follows the reduction, in dB (setReductionTone()).
 
T getReductionToneHigh () const noexcept
 Its gain over 4 kHz, in dB.
 
void setControlLeak (T amount) noexcept
 Lets the moves of the gain leak into the audio as low thumps (0, the default, is off).
 
T getControlLeak () const noexcept
 How much of the moves of the gain leaks into the audio (setControlLeak()).
 
void setDetectorAsymmetry (T amount) noexcept
 Makes the detector read the two halves of the wave differently (0, the default, is off).
 
T getDetectorAsymmetry () const noexcept
 How differently the detector reads the two halves of the wave (setDetectorAsymmetry()).
 
void setDetectorDrift (T amount) noexcept
 Lets the detector's asymmetry wander slowly at random, as the balance of a rectifier does with its temperature (0, the default, holds it still).
 
T getDetectorDrift () const noexcept
 How far the detector's asymmetry wanders (setDetectorDrift()).
 
void setCleanBallistics (CleanBallistics mode) noexcept
 Selects the Clean character's feed-forward ballistics.
 
CleanBallistics getCleanBallistics () const noexcept
 Returns the Clean character's feed-forward ballistics.
 
T getCharacterColor () const noexcept
 Returns the character colour amount (see setCharacterColor).
 
void setSidechainHPF (bool enabled, T cutoffHz=T(80)) noexcept
 Toggles the internal sidechain high-pass filter.
 
void setSidechainBand (int band, const KeyBand &settings) noexcept
 Sets a band of the equalizer of the key.
 
KeyBand getSidechainBand (int band) const noexcept
 The settings of a band of the key equalizer.
 
KeyEq::Response getSidechainResponse () const noexcept
 The curve of the key equalizer, for a display: build it when the bands change and read each frequency from it.
 
void setSidechainListen (bool on) noexcept
 Plays the key instead of the compressed audio.
 
bool isSidechainListen () const noexcept
 Whether the key is being played instead of the audio.
 
void setRemovalListen (bool on) noexcept
 Removal listen: the output is what the compression takes out, the aligned input minus the compressed signal before the makeup gain (the mix does not apply). A monitoring control, not in the state.
 
bool isRemovalListen () const noexcept
 
void setRmsWindow (T ms) noexcept
 Sets the RMS analysis window size in milliseconds.
 
T getGainReductionDb () const noexcept
 Returns current active gain reduction in dB (negative value).
 
DetectorType getDetector () const noexcept
 Returns the currently active detector type.
 
Topology getTopology () const noexcept
 Returns the currently active topology.
 
Character getCharacter () const noexcept
 Returns the currently active character.
 
int getLatency () const noexcept
 Returns total processing latency in samples.
 
std::vector< uint8_t > getState () const
 Serializes the parameter state (setup/UI threads; allocates).
 
bool setState (const uint8_t *data, size_t size)
 Restores parameters from a blob (tolerant; rejects foreign ids).
 

Static Public Attributes

static constexpr double kReductionToneLowHz = 200.0
 Corner of the low shelf of the tone that follows the reduction, in Hz (setReductionTone()).
 
static constexpr double kReductionToneHighHz = 4000.0
 Corner of its high shelf, in Hz.
 
static constexpr int kKeyBands = KeyEq::kBands
 Bands of the key equalizer.
 

Protected Types

enum class  Colour { None , SecondOrder , PushPull }
 The harmonic signature a character can add (setCharacterColor()). More...
 

Protected Member Functions

void processBlockImpl (AudioBufferView< T > audio, AudioBufferView< T > sidechain) noexcept
 Core DSP loop executing sidechain detection, linking, ballistics, and gain application.
 
void processFeedForward (AudioBufferView< T > &audio, AudioBufferView< T > &sidechain, int nCh, int nS, int scCh, const FeedForwardConfig &ff, const ChunkParams &constants) noexcept
 Feed-forward block path, run in passes over chunks of frames.
 
void copyGainStateFromChannel0 (int nCh) noexcept
 Copies channel 0's gain-computer state to channels [1, nCh).
 
void runGainRecursion (T *inDb, T *out, int m, int ch, const FeedForwardConfig &ff, const T *thr, const T *rat, const T *kn, const T *dryIn, const double *balance) noexcept
 The serial part of the feed-forward path for one gain channel: Upward guard, static curve, hold/range and ballistics over a chunk, with the channel's state held in locals.
 
T gainPath (T inputDb, int ch, const GainPathConfig &cfg, T thresh, T ratio, T knee) noexcept
 Static curve plus character ballistics for one channel's state.
 
T partWeight (int ch, int idx, int n) const noexcept
 
void applyGain (AudioBufferView< T > &audio, int ch, int i, T gainLin, T grDb, int activeLookahead, Character charType, T colorAmt, T makeupLin, T mixVal, T outLin) noexcept
 Applies the frame's gain to one channel: lookahead, FET colour, feedback history, makeup and the parallel mix.
 
void updateTimeConstants (T fs) noexcept
 Pre-calculates recursive exponential decay coefficients.
 
T applyHoldAndRange (T targetGR_Db, int ch) noexcept
 Applies the hold and range stages to the static gain target (dB).
 
T rampedIn (T grDb, int g, int length, bool run) noexcept
 A gain change through the lookahead's ramp of its gain computer, or as it came.
 
SlidingDeepest * holdWindow (int ch) const noexcept
 
T makeupToGain (T makeupDb) noexcept
 Makeup dB to linear, cached: the makeup is shared by every channel of a frame and constant unless automated or adaptive. Same value as a direct decibelsToGain() call.
 
double linkCorrelation (T keyL, T keyR) noexcept
 
void flushLinkCovariance () noexcept
 
T detectLevel (T sample, int ch, DetectorType detType) noexcept
 Computes level detection in Decibels.
 
T detectLevelLinear (T sample, int ch, DetectorType detType) noexcept
 Computes the detected level as a linear magnitude (>= 0).
 
void runStage (CharacterStage< T > &stage, double &weight, bool wanted, AudioBufferView< T > buffer) noexcept
 Runs one place of the colour stage over a block, fading its share towards whether it is wanted (20 ms). Idle, it costs nothing; it starts from clean memory when it comes in.
 
T computeGain (T inputDb, T thresh, T ratio, T knee, Character charType, Mode modeType, T guardDb) const noexcept
 Calculates static target gain reduction based on knee and ratio.
 
T lift (T inputDb, T thresh, T knee, T guardDb) const noexcept
 The upward half of Mode::Both: the rise under the lower threshold, up to its range.
 
double layeredStep (T inputDb, T thresh, T ratio, T knee, const CharacterProfile &profile, T range, int holdN, int soft, T &held, int &counter, double &level, double &peak, SlidingDeepest *window=nullptr) const noexcept
 One frame of a layered character: hold and range on the whole target, each layer towards its part of it, and their sum.
 
void syncLayerState (bool layered) noexcept
 Seats the two layers on the gain as it stands when a layered character engages. Audio thread only.
 
bool syncAudioPath () noexcept
 Takes the settings of the audio path that are not the plain gain (the tone that follows the reduction, the leak of the control, the asymmetry of the detector). Audio thread only.
 
bool lopsidedDetector () const noexcept
 Whether the detector reads the two halves of the wave differently (an asymmetry or its drift).
 
T gained (T input, T gain, int ch) noexcept
 The gain on one sample of a channel when it is not a plain product: through the tone that follows the reduction, and with what leaks of the control.
 
T asymmetric (T key, int ch) noexcept
 The key with a share of its own crest added, scaled so that the half the share favours still reads the crest.
 
bool shapesGain () const noexcept
 Whether anything stands between the ballistics and the gain: the landing, the network or the smoothing.
 
T smoothedGain (T grDb, int ch) noexcept
 One frame of what stands between the ballistics and the gain on a channel (dB): the landing of the release, the network of the control path and the two smoothing sections, those that are on.
 
void syncGainSmoothing (bool) noexcept
 Seats each of those stages on the gain as it stands when it engages. Audio thread only.
 
T computeGainUpward (T inputDb, T thresh, T ratio, T knee, T guardDb) const noexcept
 Upward compression curve calculation.
 
FeedbackLaw computeGainFeedback (T outDb, T thresh, T ratio, T knee, Character charType) const noexcept
 Feedback target for detectors with memory (explicit path).
 
FeedbackSolve solveFeedbackGain (T inDb, T k, T effB, T thresh, T ratio, T knee, Character charType) const noexcept
 Solves one feedback ballistics step against the current input.
 
T applyBallisticsFeedbackImplicit (T inDb, int ch, Character charType, T thresh, T ratio, T knee) noexcept
 Feedback ballistics with the loop resolved semi-implicitly.
 
T stepImplicit (T inDb, int ch, Character charType, T thresh, T ratio, T knee, const LoopCoeffs &coeffs) noexcept
 One step of the semi-implicit loop on the channel's envelopes: the blended gain it leaves, before hold and range.
 
T boundImplicit (T shown, int ch) noexcept
 Hold and range of the semi-implicit loop.
 
T applyBallistics (T targetGrDb, int ch, bool splitAdaptive, T loopSlope=T(-1), double loopDelay=0.0) noexcept
 Smooths the static gain target with the active character's ballistics.
 
double ballisticsStep (double tgt, double &fast, double &slow, double &mid, double &deep, double attCoeff, double relCoeff) const noexcept
 Branching ballistics on explicit state (shared by both block paths): the fast envelope, plus the Opto/FET memory stage.
 
double ballisticsCore (double tgt, double &fast, double &slow, double &mid, double &deep, double attCoeff, double relCoeff, double chargeCoeff, double slowRelCoeff, double midChargeCoeff, double midRelCoeff) const noexcept
 ballisticsStep() with the coefficients of the memory stage given too.
 
void syncAdaptiveMakeup (bool adaptive) noexcept
 The adaptive makeup envelope only runs while adaptive makeup is active; when it engages it starts from the current gain change (the settled value of a tracker that had kept running). Audio thread only.
 
double feedbackDetectorDelay (DetectorType detType) const noexcept
 Delay of the detector as an explicit feedback loop sees it, in samples: the RMS window (its reading of a level step completes one window later). The other detectors respond within a few samples, which the base cap of the loop advance already covers.
 
bool useDecoupled (Character charType, Topology topoEff) const noexcept
 The Clean character in feed-forward runs the decoupled detector when setCleanBallistics() selected it.
 
void syncDecoupledState (bool decoupled) noexcept
 Seats the decoupled hold stage on the current gain when the decoupled path engages (character or topology change), so the switch does not replay a stale hold value. Audio thread only.
 
T applyBallisticsDecoupled (T targetGrDb, int ch, bool splitAdaptive) noexcept
 Decoupled ballistics for the Clean character in feed-forward operation (after the smooth decoupled peak detector of Giannoulis, Massberg and Reiss, JAES 2012).
 
double decoupledStep (double tgt, double &hold, double &fast, double holdCoeff) const noexcept
 One decoupled step on explicit state (see applyBallisticsDecoupled).
 
bool usePrecision (Topology topoEff, bool fbImplicit, bool splitAdaptive) const noexcept
 Whether the control signal runs at Precision::High with this routing: feed-forward, and feedback solved against the input.
 
void syncPrecisionState (bool precise) noexcept
 Seats the history of the precise path when it engages: it starts from the gain that is sounding and from silence at the detector. Audio thread only.
 
void detectorPoints (T sample, int ch, T *points) noexcept
 The rectified key at kDetectorPoints points per sample.
 
T heldBack (T grDb, int g, double delay, bool run) noexcept
 The gain as it is heard with a latency kept for the lookahead: older by the difference (see setMaxLookahead()).
 
double slideGainDelay (int target) noexcept
 The delay of the gain line this frame. It slides to its target kGainDelaySlide of a sample per sample, so a lookahead that moves inside the latency kept for it leaves no step in the gain (the first frame after prepare() or reset() starts at the target).
 
T gainPathPrecise (const T *levelDb, int count, int ch, const GainPathConfig &cfg, T thresh, T ratio, T knee) noexcept
 The gain of one frame at Precision::High, for one gain computer.
 
ProgramTiming programTiming (Character charType, Topology topoEff, bool decoupled, bool splitAdaptive) const noexcept
 The weights for this routing: the Clean and Varimu characters in feed-forward with Branching ballistics.
 
void syncProgramState (bool active) noexcept
 Seats the measures on the gain that is sounding when the programme-dependent timing engages. Audio thread only.
 
void balanceBands (T key, int ch, double &lowSq, double &highSq) noexcept
 Feeds one channel's key to the two bands of the balance and adds their squares to the frame's.
 
double balanceAdvance (double lowSq, double highSq) noexcept
 Smooths the frame's two powers and returns the balance of the key: -1 all low, +1 all high, 0 the same in both (or silence).
 
ProgramCoeffs programCoeffs (double target, double fast, ProgramState &state, double balance, double share) const noexcept
 The attack and release coefficients of a frame under programme-dependent timing, and the advance of its measures.
 
double programShape (double gain, ProgramState &state) const noexcept
 The gain with the emphasis of the attack: what it is under its own smoothed course while it falls, added again (or taken off).
 
double programStep (double target, double &fast, ProgramState &state, double balance) const noexcept
 One step of the branching follower with programme-dependent timing (the single envelope of Clean and Varimu).
 
T analyticMakeupDb (Character charType, Mode modeType, DetectorType detType, bool decoupled, bool loop) noexcept
 Target of the analytic makeup, in dB, for a routing that is already known (the solve only runs when a setting changed).
 
T analyticTarget () noexcept
 Target of the analytic makeup for the settings as they stand (0 dB when another makeup mode is selected).
 
T solveMakeupModel (const MakeupModelKey &key) const noexcept
 The analytic makeup: minus the gain the ballistics settle on over dense programme.
 
void updateHpfCoefficients () noexcept
 Updates the normalized DC-blocker / High-pass filter coefficients.
 
T applySidechainHPF (T input, int ch) noexcept
 Applies sidechain filtering for a specific channel.
 
void updateRmsWindow () noexcept
 Safely recalculates the RMS window size ensuring zero heap allocations.
 

Static Protected Member Functions

template<typename E >
static E clampEnum (E value, E last) noexcept
 Clamps an enum to its valid [first, last] range.
 
static T weightedGain (T g, T w) noexcept
 A linear gain with its decibels scaled by w: 1 at w = 0, itself at w = 1.
 
static T holdAndRange (T targetGR_Db, T range, int holdSamples, T &held, int &counter, int soft=0, SlidingDeepest *window=nullptr, int perSample=1) noexcept
 Hold and range on explicit state (shared by both block paths).
 
static T detectorSafe (T x) noexcept
 A non-finite sample reads as silence in the detector: it would otherwise latch in the recursive detector, filter and envelope state.
 
static T dominantLevel (T levelL, T levelR, double rho2) noexcept
 
static constexpr CharacterProfile profileOf (Character type) noexcept
 The profile of a character.
 
static constexpr Topology topologyFor (const CharacterProfile &profile, Topology asked) noexcept
 The topology a character runs in when the user asks for one.
 
static constexpr bool isLayered (const CharacterProfile &profile, Mode modeType) noexcept
 Whether a character runs its two layers: it has them, and the mode is Downward.
 
static constexpr DetectorType detectorFor (const CharacterProfile &profile, DetectorType asked) noexcept
 The detector a character reads with when the user asks for one.
 
static T effectiveRatioFor (Character charType, T ratio, T excessDb) noexcept
 Level-dependent effective ratio of the character (Varimu grows).
 
static T effectiveKneeFor (Character charType, T knee) noexcept
 Physical knee floor of the character (dB).
 
static constexpr Mode modeIn (Mode asked, Topology topoEff) noexcept
 The mode a routing runs: the two-way and the levelling curves are feed-forward ones, and in a loop the curve is the ratio's.
 
static constexpr bool reducesOnly (Mode modeType) noexcept
 Whether a mode only ever takes level off (the automatic makeups that add it back apply).
 
static T levelerCurve (T inputDb, T thresh) noexcept
 The levelling curve: the gain 1 / (1 + level / threshold), in decibels. Nothing far under the threshold, 6 dB at it, and all that the level is over it far above.
 
static T downwardCurve (T inputDb, T thresh, T ratio, T knee, Character charType) noexcept
 Downward static curve with the character's knee floor and ratio law (see computeGain).
 
static T kneeCurve (T inputDb, T thresh, T slope, T knee) noexcept
 A threshold, a slope (1 - 1/ratio) and a quadratic knee: the gain change at a level, in decibels.
 
static Layers layeredCurve (T inputDb, T thresh, T ratio, T knee, const CharacterProfile &profile) noexcept
 The curves of the two layers.
 
static double pacedStep (double envelope, double target, double attackRate, double releaseRate, double attackPace, double releasePace) noexcept
 One step of a follower whose time grows with the distance to its target: far away it moves at a steady pace, close by like a one-pole.
 
static T pushPullElement (T input, T gain, T amount) noexcept
 The gain of a variable-mu stage applied by its own curve: two halves in push-pull, biased so that the slope of the pair at rest is the gain asked for.
 
static bool rectifies (DetectorType detType) noexcept
 Whether a detector rectifies the key (the ones an asymmetry makes sense for).
 
static double driftUniform (std::uint32_t &s) noexcept
 A uniform draw in [-1, 1) (xorshift32).
 
static FeedbackLaw elementLaw (T eOut, T r, T w) noexcept
 Downward element law for feedback detection, per output level.
 
static FeedbackLaw computeGainFeedbackUpward (T outDb, T thresh, T ratio, T knee, T guardDb) noexcept
 Upward element law for feedback detection, per output level.
 
static bool atRest (double envelope, double target) noexcept
 An envelope within 1e-4 dB of no gain change, heading there: it is put on it, to end the asymptotic tail of a release.
 
static double branchingStep (double y, double tgt, double cDown, double cUp) noexcept
 Branch-free branching one-pole step toward tgt: coefficient cDown while the state is above the target (the gain falls), cUp otherwise.
 
static double decoupledCore (double tgt, double &hold, double &fast, double holdCoeff, double attCoeff, double smoothCoeff) noexcept
 decoupledStep() with the coefficients of the smoothing stage given too.
 
static double decoupledHoldTau (double releaseMs, double smoothMs) noexcept
 Time constant of the decoupled hold stage (ms) so that the series release of the hold stage and the smoothing pole passes t63 at releaseMs.
 
static bool readsBetweenSamples (DetectorType detType) noexcept
 The detectors that rectify: at Precision::High they read the key between the samples too.
 
static double restingGain (const double *target, const double *weight, int count, double attackRate, double releaseRate) noexcept
 Where a branching follower rests over a set of weighted targets.
 
static double windowSpreadDb (double windowMs) noexcept
 Spread of what an RMS window reads over dense programme: the standard deviation of its level, in dB.
 
static double referenceOverRmsDb (const MakeupModelKey &key) noexcept
 How far over the RMS of dense programme the reference of the automatic threshold rests, for each detector (dB).
 

Protected Attributes

AudioSpec spec_ {}
 Active audio environment specification.
 
double sampleRate_ = 0
 Cached operating sample rate.
 
std::atomic< T > threshold_ { T(-20) }
 Threshold in dB.
 
std::atomic< T > ratio_ { T(4) }
 Ratio (e.g., 4 = 4:1).
 
std::atomic< T > attackMs_ { T(5) }
 Attack time in milliseconds.
 
std::atomic< T > releaseMs_ { T(100) }
 Release time in milliseconds.
 
std::atomic< T > kneeWidth_ { T(0) }
 Knee width in dB.
 
std::atomic< T > makeupGain_ { T(0) }
 Static makeup gain in dB.
 
std::atomic< T > stereoLink_ { T(1) }
 Stereo linking amount (0 to 1).
 
std::atomic< LinkMode > linkMode_ { LinkMode::Loudest }
 What the linked level reads.
 
double linkCoeff_ = 0.0
 One-pole coefficient of the key's covariance (20 ms).
 
double linkLL_ = 0.0
 
double linkRR_ = 0.0
 
double linkLR_ = 0.0
 The key's covariance (dominant link).
 
std::atomic< T > mix_ { T(1) }
 Wet/Dry mix (1 = full wet).
 
std::atomic< T > lookaheadMs_ { T(0) }
 Lookahead latency target in ms.
 
std::atomic< T > characterColor_ { T(0) }
 Character harmonic amount (0 to 1).
 
std::atomic< AutoMakeupMode > autoMakeupMode_ { AutoMakeupMode::Off }
 Auto-makeup behavior.
 
std::atomic< DetectorType > detectorType_ { DetectorType::Peak }
 Selected detection method.
 
std::atomic< Topology > topology_ { Topology::FeedForward }
 Selected topology.
 
std::atomic< Character > character_ { Character::Clean }
 Selected ballistics.
 
std::atomic< OptoCell > optoCell_ { OptoCell::TwoStage }
 Cell of the Opto character.
 
std::atomic< CleanBallistics > cleanBallistics_ { CleanBallistics::Branching }
 Clean feed-forward ballistics.
 
std::atomic< Mode > mode_ { Mode::Downward }
 Selected compression mode.
 
T autoMakeupCoeff_ = T(0.9995)
 Auto-makeup tracking factor.
 
T autoMakeupEnv_ = T(0)
 Smoothed internal auto-makeup envelope.
 
T cachedMakeupDb_ = T(0)
 Last makeup converted by makeupToGain().
 
T cachedMakeupLin_ = T(1)
 Its linear gain.
 
std::atomic< bool > timeConstantsDirty_ { true }
 Coefficients need a recompute.
 
double charAttCoeff_ = 0.0
 Attack coefficient of the fast envelope.
 
double charRelCoeff_ = 0.0
 Release coefficient (fast stage).
 
double charSlowRelCoeff_ = 0.0
 Release coefficient of the memory stage.
 
double charMidRelCoeff_ = 0.0
 Release coefficient of the medium memory (three-stage cell).
 
double charMidChargeCoeff_ = 0.0
 Charge coefficient of the medium memory.
 
bool threeStage_ = false
 The audio thread runs the three-stage cell.
 
double charChargeCoeff_ = 0.0
 History charge coefficient of the memory stage.
 
T charFastWeight_ = T(1)
 Fast/slow blend (1 = single envelope).
 
SmoothedValue< T > thresholdSmooth_
 De-zippered threshold.
 
SmoothedValue< T > ratioSmooth_
 De-zippered ratio.
 
SmoothedValue< T > kneeSmooth_
 De-zippered knee.
 
SmoothedValue< T > makeupSmooth_
 De-zippered makeup gain (dB).
 
SmoothedValue< T > mixSmooth_
 De-zippered parallel mix.
 
SmoothedValue< T > colorSmooth_
 De-zippered character colour amount.
 
T fetDcCoeff_ = T(0)
 ~10 Hz DC-tracking coefficient.
 
std::array< T, kMaxChannels > fetDcState_ {}
 Per-channel DC estimate of wet^2.
 
std::array< double, kMaxChannels > envFastDb_ {}
 Fast gain envelope per channel (dB).
 
std::array< double, kMaxChannels > envSlowDb_ {}
 Slow memory envelope per channel (dB).
 
std::array< double, kMaxChannels > envMidDb_ {}
 Medium memory of the three-stage cell per channel (dB).
 
std::array< double, kMaxChannels > envDeepDb_ {}
 Deep memory of the three-stage cell per channel (dB).
 
std::array< double, kMaxChannels > envHoldDb_ {}
 Decoupled hold stage per channel (dB).
 
double decHoldCoeff_ = 0.0
 Decoupled hold-stage release coefficient.
 
double decSmoothCoeff_ = 0.0
 Decoupled smoothing pole, release side.
 
bool decoupledActive_ = false
 The decoupled path ran last (audio thread).
 
std::array< double, kMaxChannels > layerLevelDb_ {}
 
std::array< double, kMaxChannels > layerPeakDb_ {}
 
double layerAttRate_ = 0.0
 
double layerRelRate_ = 0.0
 
double peakAttRate_ = 0.0
 
double peakRelRate_ = 0.0
 
bool layeredActive_ = false
 The layers ran last (audio thread).
 
std::atomic< T > gainSmoothMs_ { T(0) }
 Smoothing of the gain (0: off).
 
double gainSmoothRate_ = 0.0
 Coefficient of each of its two sections (0: off).
 
std::array< double, kMaxChannels > gainSmoothA_ {}
 
std::array< double, kMaxChannels > gainSmoothB_ {}
 
bool gainSmoothActive_ = false
 The smoothing ran last (audio thread).
 
std::atomic< T > landingMs_ { T(0) }
 Landing of the release (0: off).
 
double landingRate_ = 0.0
 Its coefficient when it is on the gain it follows (0: off).
 
std::array< double, kMaxChannels > landingDb_ {}
 
bool landingActive_ = false
 
std::atomic< T > networkDepthDb_ { T(0) }
 Depth of the network of the control path (0: off).
 
std::atomic< T > networkCornerHz_ { T(10) }
 Its corner.
 
double networkShare_ = 1.0
 Share of a fast move applied at once (1: off).
 
double networkRate_ = 0.0
 Coefficient of its low-pass.
 
std::array< double, kMaxChannels > networkLow_ {}
 
bool networkActive_ = false
 
std::atomic< T > toneLowDb_ { T(0) }
 
std::atomic< T > toneHighDb_ { T(0) }
 setReductionTone().
 
std::atomic< T > controlLeak_ { T(0) }
 setControlLeak().
 
std::atomic< T > detectorAsymmetry_ { T(0) }
 setDetectorAsymmetry().
 
Biquad< T, kMaxChannels > toneLow_ {}
 
Biquad< T, kMaxChannels > toneHigh_ {}
 The filter F of the tone (audio thread).
 
T toneLowIn_ = T(0)
 
T toneHighIn_ = T(0)
 The gains those were designed for.
 
bool toneActive_ = false
 The tone is in the path.
 
T leakAmount_ = T(0)
 The leak as the audio thread took it.
 
T leakCoeff_ = T(0)
 
std::array< T, kMaxChannels > leakBase_ {}
 The slow copy of each channel's gain.
 
T asymAmount_ = T(0)
 The asymmetry as the audio thread took it.
 
T asymDecay_ = T(0)
 
std::array< T, kMaxChannels > asymCrest_ {}
 The crest of each channel's key.
 
std::atomic< T > detectorDrift_ { T(0) }
 setDetectorDrift().
 
T driftAmount_ = T(0)
 The drift as the audio thread took it.
 
double asymDriftRate_ = 0.0
 
double asymDriftScale_ = 1.0
 
std::array< AsymDrift, kMaxChannels > asymDrift_ {}
 
std::array< T, kMaxChannels > asymNow_ {}
 Each channel's asymmetry with its drift.
 
bool audioExtras_ = false
 The gain is not a plain product (tone or leak).
 
std::atomic< Route > route_ { Route::Stereo }
 
std::atomic< T > midSideFocus_ { T(0) }
 
std::array< T, 2 > partFrom_ { T(1), T(1) }
 
std::array< T, 2 > partTo_ { T(1), T(1) }
 
bool parted_ = false
 
Route routeIn_ = Route::Stereo
 The route the states carry (audio thread).
 
bool routeWas_ = false
 The last block ran a route.
 
int routeBlock_ = 0
 
int routeReach_ = 0
 
AudioBuffer< T > routeKey_
 A key given apart, as its middle and its sides.
 
RingBuffer< T > routeDelay_
 The part that is not treated waits here.
 
std::atomic< T > liftBelow_ { T(30) }
 
std::atomic< T > liftRatio_ { T(2) }
 
std::atomic< T > liftRange_ { T(6) }
 
T liftBelowDb_ = T(30)
 
T liftRatioIn_ = T(2)
 
T liftRangeDb_ = T(6)
 
bool adaptiveMakeupActive_ = false
 Adaptive makeup ran last (audio thread).
 
std::array< T, kMaxChannels > upwardGuardDb_ {}
 Peak-held sustained level (Upward guard).
 
T upwardGuardDecay_ = T(0.00125)
 Guard decay per sample (60 dB/s).
 
std::array< T, kMaxChannels > fbLastOutput_ {}
 
std::array< std::array< T, 4 >, kMaxChannels > pointLevelDb_ {}
 Detected level per channel and point of the frame (dB).
 
std::array< RingBuffer< T >, kMaxChannels > lookaheadBuffers_ {}
 Lookahead delay lines.
 
int lookaheadSamples_ = 0
 Active lookahead latency in samples.
 
std::array< HilbertIIR< double >, kMaxChannels > hilbertDetectors_ {}
 Zero-latency analytic pairs for detection.
 
std::atomic< bool > scHpfEnabled_ { false }
 HPF toggle.
 
std::atomic< T > scHpfFreq_ { T(80) }
 HPF Cutoff frequency.
 
std::atomic< bool > scHpfDirty_ { true }
 Coefficients need a recompute.
 
T scHpfB1_ = T(0)
 HPF internal feedback coefficient.
 
T scHpfA0_ = T(0)
 HPF normalized feedforward coefficient.
 
std::array< T, kMaxChannels > scHpfState_ {}
 HPF y[n-1] state.
 
std::array< T, kMaxChannels > scHpfPrev_ {}
 HPF x[n-1] state.
 
KeyEq keyEq_
 Equalizer of the key, after the high-pass.
 
KeyMonitor< T, 16 > keyMonitor_
 The listened key: late by the latency, under full scale.
 
std::atomic< bool > scListen_ { false }
 The key goes out instead of the audio.
 
std::atomic< bool > removalListen_ { false }
 The output is what the compression takes out.
 
std::array< T, kMaxChannels > splitPosEnv_ {}
 Positive half-wave tracking.
 
std::array< T, kMaxChannels > splitNegEnv_ {}
 Negative half-wave tracking.
 
T splitDetAttCoeff_ = T(0.6)
 Detector attack coefficient (sample-rate derived).
 
T splitDetRelCoeff_ = T(0.99)
 Detector release coefficient (sample-rate derived).
 
T rmsWindowMs_ = T(10)
 Active RMS length in ms (audio-thread copy).
 
std::atomic< T > rmsWindowMsAtomic_ { T(10) }
 Control-thread published target.
 
std::atomic< bool > rmsWindowDirty_ { false }
 Applied at the next block.
 
int rmsWindowSamples_ = 0
 Active RMS length in samples.
 
std::array< std::vector< T >, kMaxChannels > rmsBuffers_
 Pre-allocated RMS sliding windows.
 
std::array< T, kMaxChannels > rmsSums_ {}
 Running sums for RMS.
 
std::array< int, kMaxChannels > rmsIndices_ {}
 Write heads for RMS buffers.
 
std::array< int, kMaxChannels > rmsRecomputeCounters_ {}
 Re-summation counters.
 
TruePeakDetector< T, kMaxChannels > truePeak_
 
std::atomic< T > holdMs_ { T(0) }
 Gain-hold time in ms (0 = off).
 
std::atomic< T > rangeDb_ { T(100) }
 Max |gain change| in dB.
 
int holdSamples_ = 0
 
std::array< int, kMaxChannels > holdCounters_ {}
 
std::array< T, kMaxChannels > heldGrDb_ {}
 
std::atomic< HoldMode > holdMode_ { HoldMode::Deepest }
 
std::unique_ptr< SlidingDeepest[]> holdWindows_
 One window per gain computer (HoldMode::EveryPeak).
 
int holdWindowFor_ = -1
 The hold length the windows are set for.
 
bool holdEveryPeak_ = false
 The hold mode as the audio thread took it.
 
std::atomic< bool > autoThreshold_ { false }
 The threshold counts from the key's own recent peak.
 
std::atomic< T > thresholdInUseDb_ { T(0) }
 With the automatic threshold, the threshold of the last sample (metering).
 
std::array< double, kMaxChannels > autoRefDb_ {}
 That reference per channel (the linked one in slot 0), in dB.
 
double autoRefFall_ = 0.0
 Its fall per sample, in dB.
 
std::atomic< T > maxLookaheadMs_ { T(0) }
 Latency kept for the lookahead (0: the lookahead itself).
 
int latencySamples_ = 0
 Delay of the audio in feed-forward (audio thread).
 
std::array< RingBuffer< T >, kMaxChannels > gainDelay_ {}
 Holds the gain back while the lookahead is shorter than the latency.
 
double gainDelayNow_ = -1.0
 The gain line's delay now, in samples (negative: not started).
 
bool latencyKept_ = false
 A latency is kept for the lookahead (audio thread).
 
std::atomic< LookaheadShape > lookaheadShape_ { LookaheadShape::Lead }
 
std::atomic< bool > feedbackKeyed_ { false }
 A feedback loop runs on the key ahead of the audio.
 
std::vector< LookaheadRamp > lookaheadRamps_
 One ramp per gain computer of the layout (LookaheadShape::Ramp).
 
int rampCount_ = 0
 Ramps prepared.
 
bool rampShape_ = false
 The shape as the audio thread took it.
 
bool rampActive_ = false
 The ramp ran in the last block.
 
std::atomic< T > amount_ { T(1) }
 Share of the gain change that is applied, in dB.
 
SmoothedValue< T > amountSmooth_
 De-zippered amount.
 
std::atomic< int > rangeShape_ { 0 }
 How the gain change meets the range (a RangeShape).
 
std::atomic< Precision > precision_ { Precision::Standard }
 How finely the control signal is computed.
 
bool precisionActive_ = false
 The precise path ran last (audio thread).
 
std::atomic< StagePosition > stagePosition_ { StagePosition::Off }
 
CharacterStage< T > stageBefore_
 The input amplifier.
 
CharacterStage< T > stageAfter_
 The output amplifier.
 
AudioBuffer< T > stageScratch_
 The coloured copy while a place fades.
 
std::vector< double > stageFade_
 The share of the colour, per sample of the fade.
 
double stageFadeStep_ = 0.0
 Its change per sample (20 ms end to end).
 
double stageWeightBefore_ = 0.0
 Share of the input stage (audio thread).
 
double stageWeightAfter_ = 0.0
 Share of the output stage (audio thread).
 
T interpPhase_ [kDetectorPoints - 1][kInterpTaps] = {}
 Interpolation phases (prepare()).
 
std::array< InterpHistory, kMaxChannels > interp_ {}
 Their history per channel.
 
std::array< double, kMaxChannels > precLevel_ {}
 Last level of the solved loop (dB).
 
std::array< double, kMaxChannels > precTarget_ {}
 Last gain target, after hold and range (dB).
 
double rawAttCoeff_ = 0.0
 Attack coefficient as it is observed (before a loop's own speed).
 
double subAttCoeff_ = 0.0
 Attack coefficient of an eighth of a sample.
 
double subRelCoeff_ = 0.0
 Release coefficient of an eighth of a sample.
 
double subSlowRelCoeff_ = 0.0
 Memory-stage release coefficient of an eighth of a sample.
 
double subChargeCoeff_ = 0.0
 Memory-stage charge coefficient of an eighth of a sample.
 
double subMidRelCoeff_ = 0.0
 Medium-memory release coefficient of an eighth of a sample.
 
double subMidChargeCoeff_ = 0.0
 Medium-memory charge coefficient of an eighth of a sample.
 
double subDecHoldCoeff_ = 0.0
 Decoupled hold coefficient of an eighth of a sample.
 
double subDecSmoothCoeff_ = 0.0
 Decoupled smoothing coefficient of an eighth of a sample.
 
std::atomic< T > programRelease_ { T(0) }
 Weight of the sustained reduction on the release.
 
std::atomic< T > adaptiveAttack_ { T(0) }
 Weight of the closeness of the target on the attack.
 
std::atomic< T > spectralTiming_ { T(0) }
 Weight of the balance of the key on both times.
 
std::atomic< T > attackEmphasis_ { T(0) }
 Emphasis of the attack.
 
ProgramTiming program_ {}
 The weights of the block (audio thread).
 
bool programActive_ = false
 They acted last (audio thread).
 
std::array< ProgramState, kMaxChannels > programState_ {}
 Measures per gain computer.
 
std::array< BalanceBands, kMaxChannels > balanceBands_ {}
 Bands of the key per channel.
 
double balanceLow_ = 0.0
 Smoothed power of the low band.
 
double balanceHigh_ = 0.0
 Smoothed power of the high band.
 
double balance_ = 0.0
 Their balance, -1 to +1.
 
double attackX_ = 0.0
 The attack as a decay per sample (-ln of its coefficient).
 
double releaseX_ = 0.0
 The release as a decay per sample.
 
double subRate_ = 0.0
 Pole of the split at kBalanceFloorHz.
 
double lowRate_ = 0.0
 Pole of the split at kBalanceLowHz.
 
double midRate_ = 0.0
 Pole of the split at kBalanceHighHz.
 
double highRate_ = 0.0
 Pole of the split at kBalanceCeilingHz.
 
double balanceRate_ = 0.0
 Pole of the smoothing of the two powers.
 
double sustainRate_ = 0.0
 Pole of the follower of the depth.
 
double emphasisRate_ = 0.0
 Pole of the smoothing the emphasis measures against.
 
std::array< double, kMaxChannels > hybridMeanSq_ {}
 Mean square of the key.
 
double hybridRate_ = 0.0
 Its pole (the time of the RMS window).
 
SmoothedValue< T > analyticSmooth_
 De-zippered analytic makeup (dB).
 
MakeupModelKey makeupKey_ {}
 Settings of the cached result.
 
T makeupModelDb_ = T(0)
 The cached result (dB).
 
std::atomic< T > gainReductionDb_ { T(0) }
 Publicly readable Gain Reduction meter.
 

Static Protected Attributes

static constexpr int kMaxChannels = 16
 
static constexpr int kChunk = 32
 Frames per pass of the feed-forward path.
 
static constexpr T kNoLimit = std::numeric_limits<T>::infinity()
 
static constexpr double kOptoThreeFastRelease = 0.725
 
static constexpr double kOptoMidShare = 0.625
 
static constexpr double kOptoMidRelease = 5.0
 
static constexpr double kOptoMidCharge = 1.0
 
static constexpr double kOptoMidChargeFloorMs = 30.0
 
static constexpr double kOptoMidChargeCeilMs = 1000.0
 
static constexpr std::array< CharacterProfile, 5 > kProfiles
 The characters, in the order of Character.
 
static constexpr T kFetColorH2 = T(0.028)
 
static constexpr double kPushPullRest = 0.98
 
static constexpr double kPushPullDrive = 2.0
 
static constexpr double kLandingPaceDb = 0.5
 Decibels behind that make the landing e times faster.
 
static constexpr double kLeakCornerHz = 5.0
 High-pass the gain leaks through.
 
static constexpr double kLeakLevel = 0.05
 What a gain that moves by 1 leaks, at an amount of 1.
 
static constexpr double kAsymCrestSeconds = 0.05
 Fall of the crest the asymmetric detector adds.
 
static constexpr double kAsymDrift = 0.1
 Deviation of the asymmetry at full drift.
 
static constexpr double kAsymDriftHz = 0.25
 Corner of each of the walk's two smoothings.
 
static constexpr int kAsymDriftTick = 64
 Frames between draws.
 
static constexpr int kStageKeyRoom = 64
 Samples kept for the colour stage's latency in the listened key.
 
static constexpr int kRmsRecomputePeriod = 4096
 Re-summation interval to halt drift.
 
static constexpr double kAutoRefFallDb = 1.0
 dB per second the reference of the automatic threshold falls.
 
static constexpr double kGainDelaySlide = 0.25
 Samples per sample the gain line's delay moves to a new lookahead.
 
static constexpr double kLocalRangeStretchDb = 6.0
 Width of the bend of RangeShape::Local, at most.
 
static constexpr int kSubsteps = 8
 Steps of the ballistics per sample at Precision::High.
 
static constexpr int kDetectorPoints = 4
 Points the rectifying detectors read per sample there.
 
static constexpr int kInterpTaps = 16
 Samples each point between samples is read from.
 
static constexpr int kDetectorDelay = kInterpTaps / 2 - 1
 Samples those points are late.
 
static constexpr double kInterpBeta = 6.5
 Kaiser window of the interpolation.
 
static constexpr double kSustainReleases = 15.0
 Follower of the depth of the gain change, in release times.
 
static constexpr double kSustainFloorSeconds = 0.1
 It is never shorter than this,.
 
static constexpr double kSustainCeilSeconds = 60.0
 nor longer than this.
 
static constexpr double kSustainFloorDb = 0.5
 Depth under which a reduction does not count as sustained.
 
static constexpr double kReleaseStretch = 7.0
 The release grows up to 1 + this.
 
static constexpr double kAttackStretch = 3.0
 The attack grows up to 1 + this.
 
static constexpr double kFullAttackDb = 6.0
 Distance to the target from which the attack is the knob's.
 
static constexpr double kEmphasisAttacks = 6.0
 Smoothing the emphasis of the attack measures against, in attack times.
 
static constexpr double kEmphasisFloorSeconds = 0.002
 It is never shorter than this,.
 
static constexpr double kEmphasisCeilSeconds = 0.5
 nor longer than this.
 
static constexpr double kBalanceFloorHz = 30.0
 The low band of the balance starts here.
 
static constexpr double kBalanceLowHz = 200.0
 And ends here.
 
static constexpr double kBalanceHighHz = 2500.0
 The high band starts here.
 
static constexpr double kBalanceCeilingHz = 16000.0
 And ends here.
 
static constexpr double kBalanceSeconds = 0.05
 Smoothing of the two powers.
 
static constexpr double kBalanceSilence = 1e-24
 Summed power under which the balance is 0.
 
static constexpr int kMakeupNodes = 48
 Levels of the programme that are weighed.
 
static constexpr double kMakeupReach = 4.8
 They reach this many times its RMS.
 
static constexpr double kNominalRmsDb = -18.0
 RMS the programme is taken at (dBFS).
 
static constexpr double kSustainedOverRmsDb = 10.0
 Its sustained level over the RMS (Upward guard, dB).
 
static constexpr double kPeakReferenceDb = 12.35
 Automatic-threshold reference over the RMS, rectified.
 
static constexpr double kTruePeakReferenceDb = 12.5
 The same for TruePeak.
 
static constexpr double kEnvelopeReferenceDb = 13.2
 The same for the Hilbert detector.
 
static constexpr double kTruePeakSamples = 2.6
 Independent samples the TruePeak reading is the largest of.
 
static constexpr double kEnvelopeLiftDb = 0.6
 What the Hilbert detector reads over the envelope (dB).
 
static constexpr double kMakeupLimitDb = 40.0
 Bound of the result (dB).
 

Detailed Description

template<FloatType T>
class dspark::Compressor< T >

High-fidelity modular compressor designed for real-time applications.

This class avoids virtual dispatch entirely by utilizing branch-predicted enum switches on pre-cached atomic states. Parameter changes are internally smoothed to prevent audio artifacts. Processing is strictly allocation-free after the initial prepare() call.

Note
The gain path runs at the host rate on purpose. Its gain-modulation aliasing grows with speed and depth: with the Hilbert or RMS detector it stays near -94 dBc, the Peak detector at a 0.1 ms attack reaches -53 dBc, and the FET character at its 20 us minimum attack measures -55 dBc (ratio 4, 6 dB over the threshold) to -41 dBc (ratio 20, 30 dB over), worst on tones near 18 kHz. Products that need less can wrap this compressor in an oversampled section like any other stage with Core/Oversampling: one resampler for the whole section instead of one per module (see docs/cookbook.md, "Oversampling a nonlinear section"). setPrecision(High) lowers those lines by 20 to 40 dB at the host rate, working out only the control signal between the samples (the Peak detector at a 0.1 ms attack then reaches -66 dBc at 18 kHz and the FET character -66 dBc, at 7 samples of latency).
Template Parameters
TFloating-point sample type (float or double).

Definition at line 103 of file Compressor.h.

Member Typedef Documentation

◆ KeyBand

template<FloatType T>
using dspark::Compressor< T >::KeyBand = typename KeyEq::Band

The settings of one band of the key equalizer.

Definition at line 1777 of file Compressor.h.

◆ KeyEq

template<FloatType T>
using dspark::Compressor< T >::KeyEq = KeyEqualizer<T, 16>

The equalizer of the key (see setSidechainBand()).

Definition at line 1775 of file Compressor.h.

◆ KeyPlacement

template<FloatType T>
using dspark::Compressor< T >::KeyPlacement = typename KeyEq::Placement

The part of a two-channel key a band of the key equalizer acts on.

Definition at line 1781 of file Compressor.h.

◆ KeyShape

template<FloatType T>
using dspark::Compressor< T >::KeyShape = typename KeyEq::Shape

What a band of the key equalizer does.

Definition at line 1779 of file Compressor.h.

◆ StageSettings

template<FloatType T>
using dspark::Compressor< T >::StageSettings = typename CharacterStage<T>::Settings

The settings of the colour stage (Core/CharacterStage.h).

Definition at line 1222 of file Compressor.h.

Member Enumeration Documentation

◆ AutoMakeupMode

template<FloatType T>
enum class dspark::Compressor::AutoMakeupMode
strong

Automatic makeup-gain behavior (Static and Adaptive apply in Downward mode).

Enumerator
Off 

Manual makeup only (setMakeupGain).

Static 

Textbook auto makeup (Giannoulis, Massberg & Reiss, JAES 2012): a constant offset equal to half the static gain reduction of a 0 dBFS signal, derived from the (smoothed) threshold/ratio/knee. Being constant it never pumps and follows curve automation without clicks - and, by the same token, it lifts material that never reaches the threshold (+7.5 dB at -20 dB / 4:1 / hard knee, even on a -40 dBFS passage). That is the defined behaviour, not a side effect: to add makeup only where gain is actually reduced, choose Adaptive.

Adaptive 

Loudness matching: tracks the smoothed gain reduction (~300 ms) and compensates it in full, keeping the average output level matched to the input (quiet passages are lifted).

Analytic 

Worked out, not measured: the gain the ballistics settle on over dense programme (the levels of a Gaussian signal as the selected detector reads them, weighed by attack and release as the follower weighs them), taken back in full. A constant, so it never pumps, and it follows the curve, the times, the character, the detector and the amount. The programme is taken at -18 dBFS RMS; with setAutoThreshold() the threshold counts from the programme's own peak and the result holds at any level. Both modes (in Upward it takes the boost back). See setAutoMakeup().

Definition at line 229 of file Compressor.h.

◆ Character

template<FloatType T>
enum class dspark::Compressor::Character
strong

Time-constant behavior and release curve shape.

All characters smooth the gain reduction in dB (log domain), so attack and release knobs read as the t63 time constant of the dB envelope.

Enumerator
Clean 

Modern transparent design: a branching one-pole on the gain target. In feed-forward, setCleanBallistics(Decoupled) selects an instant peak hold that releases, then a smoothing stage, so the gain does not ride the waveform of a tone (THD+N of a 1 kHz tone 14 dB into 4:1 at 5/100 ms: -102 dB, against -65.5 dB for the one-pole); attack and release t63 stay on the knobs in both.

Opto 

T4 optical cell model (LA-2A lineage), calibrated to the Teletronix spec: ~50% recovers in one release time (the spec's "0.06 s to 50%" is release = 60 ms), complete release 0.5-5 s depending on how long the compressor was engaged (the slow memory stage only charges under sustained compression), and a 10 ms attack floor (the cell's published attack time). The knee has the same 10 dB physical floor as Varimu: a photocell's resistance curve is gradual and cannot form a hard corner.

FET 

1176 lineage. Always detects in FeedBack topology with the hardware's peak rectifier (the Topology and Detector settings are ignored and lookahead is unavailable while selected). Attack clamps to the hardware range 0.02-0.8 ms and release to 50-1100 ms; release is two-stage with a program-dependent slow tail (~t63 at the knob value). The panel ratio is the observed curve, like the hardware: 4/8 compress, 12/20 limit. setCharacterColor() adds the FET's 2nd-order channel-modulation harmonics, calibrated at 1.0 to the 1176 THD spec (< 0.5% while limiting).

Varimu 

Variable-mu tube lineage (Fairchild). The effective ratio grows with level above the threshold and the knee has a 10 dB floor (a remote-cutoff tube cannot produce a hard corner). Log-domain ballistics with the user's time constants. setCharacterColor() applies the gain through the curve of a push-pull pair biased by it, so the harmonics grow with the reduction.

Layered 

Two layers in feed-forward (Topology is ignored): one that levels, with half the slope of the ratio from 6 dB under the threshold and times several times the knobs', under one that catches what rises over it, with the other half from 6 dB over the threshold and the knobs' times. Far over the threshold the curve is the ratio's own; around it, a knee 18 dB wide or more. Both layers take longer the farther they are from their target, so a deep reduction comes back at a steady pace instead of rushing. In Upward mode it is one envelope on the knobs, like Clean; Precision::High does not apply.

Definition at line 149 of file Compressor.h.

◆ CleanBallistics

template<FloatType T>
enum class dspark::Compressor::CleanBallistics
strong

Ballistics of the Clean character in feed-forward (see setCleanBallistics).

Enumerator
Branching 

A single branching one-pole on the gain target (default): release is exponential from its first sample, the gain rides the waveform of low-frequency tones.

Decoupled 

Peak hold plus smoothing stage (opt-in): low gain-riding distortion, exact peak-referenced level on tones, more reduction on dense programme (see setCleanBallistics).

Definition at line 218 of file Compressor.h.

◆ Colour

template<FloatType T>
enum class dspark::Compressor::Colour
strongprotected

The harmonic signature a character can add (setCharacterColor()).

Enumerator
None 
SecondOrder 

Second-order modulation of the element by the signal across it.

PushPull 

The gain applied by the curve of a push-pull pair biased by it.

Definition at line 3946 of file Compressor.h.

◆ DetectorType

template<FloatType T>
enum class dspark::Compressor::DetectorType
strong

Level detection methodologies.

Enumerator
Peak 

Instantaneous absolute value tracking. Fast and standard.

Rms 

Sliding-window Root-Mean-Square. Smoother, responds to average energy.

TruePeak 

4x oversampled peak detection (ITU-R BS.1770-4 compliant).

SplitPolarity 

Separate envelopes for the positive and negative half-waves.

Hilbert 

Analytic-signal magnitude from a zero-latency allpass pair (HilbertIIR): a ripple-free envelope on sustained tones from 20 Hz up, so the static curve holds exactly and low tones are not modulated at their own frequency (THD+N of a 30 Hz tone 14 dB into 4:1 at 5/100 ms: -96 dB, against -35 dB with Peak). The larger of that magnitude and the rectified input is used, so an onset is caught as fast as with Peak. Adds no latency.

Hybrid 

RMS for what is steady and peak for what jumps: the larger of the root of twice the mean square (a one-pole mean over the time of setRmsWindow()) and the rectified sample. A steady tone reads its peak with next to no ripple, like Hilbert at a fraction of its cost, and whatever rises over the running level is caught in the same sample, like Peak.

Definition at line 109 of file Compressor.h.

◆ HoldMode

template<FloatType T>
enum class dspark::Compressor::HoldMode
strong

What the hold keeps (see setHoldMode()).

Enumerator
Deepest 

The hold starts again only when the gain change goes deeper (or as deep); when it ends, the target is whatever the curve asks at that moment, so a shallower peak inside the hold is not held after it (the default).

EveryPeak 

Every gain change is held for the hold time after it has passed: the deepest of a sliding window. On a tone that dies away with a hold longer than its period the gain follows the crests in steps instead of dropping into the wave between them. The window is exact to a 256th of the hold time.

Definition at line 1396 of file Compressor.h.

◆ LinkMode

template<FloatType T>
enum class dspark::Compressor::LinkMode
strong

What the linked level of a stereo pair reads (see setLinkMode()).

Enumerator
Loudest 

The louder channel's level (the default).

Dominant 

The level of the pair's dominant component, wherever it sits in the image.

Definition at line 884 of file Compressor.h.

◆ LookaheadShape

template<FloatType T>
enum class dspark::Compressor::LookaheadShape
strong

How the lookahead brings a reduction in (see setLookaheadShape()).

Enumerator
Lead 

The gain runs ahead of the audio by the lookahead with its own attack: a fast attack is complete long before the peak arrives (the default).

Ramp 

The gain reaches each reduction exactly when its peak leaves the delay, along an S-shaped ramp as long as the lookahead: the deepest gain change of the next lookahead, through two moving averages. Nothing is turned down earlier than it must be, and the corner of a fast attack is not heard ahead of a transient. A reduction also stays for the lookahead after its peak.

Definition at line 1013 of file Compressor.h.

◆ Mode

template<FloatType T>
enum class dspark::Compressor::Mode
strong

Processing direction.

Enumerator
Downward 

Standard: Reduces dynamic range by attenuating signals above the threshold.

Upward 

Upward: Reduces dynamic range by boosting signals below the threshold. The boost fades out when the SUSTAINED level (peak-held, falling 60 dB/s) drops 40 to 60 dB below the threshold, so pauses and the noise floor are not amplified; setRange() bounds the boost.

Both 

Downward over the threshold and upward under a second, lower one, from the same detector: what is loud comes down and what is quiet comes up (see setLift()). The rise fades in silence as in Upward. A feed-forward curve: in FeedBack (and so with the FET character) the mode is Downward. A layered character runs one envelope, as in Upward, and the automatic makeups other than Analytic are off.

Leveler 

No ratio and no knee: the gain is 1 / (1 + level / threshold). It takes 6 dB at the threshold and hardens by itself, until the output stays at the threshold however loud the input gets; setRange() bounds it. A feed-forward curve, like Both; the automatic makeups count it as Downward does its own curve.

Definition at line 197 of file Compressor.h.

◆ OptoCell

template<FloatType T>
enum class dspark::Compressor::OptoCell
strong

The optical cell of the Opto character (see setOptoCell()).

Enumerator
TwoStage 

A fast stage and one memory stage (default).

ThreeStage 

A fast stage, a medium memory and a deep memory.

Definition at line 1451 of file Compressor.h.

◆ Precision

template<FloatType T>
enum class dspark::Compressor::Precision
strong

How finely the control signal is computed (see setPrecision()).

Enumerator
Standard 

One value of the gain per sample (default).

High 

The control signal is worked out between the samples too: the detectors that rectify read the key at four points per sample and the ballistics take eight steps per sample. See setPrecision().

Definition at line 256 of file Compressor.h.

◆ RangeShape

template<FloatType T>
enum class dspark::Compressor::RangeShape
strong

How the gain change meets the range (see setRangeShape()).

Enumerator
Corner 

Cut at the range (default).

Asymptotic 

It bends from afar and never quite arrives: the curve of setSoftRange().

Local 

A bend in a stretch around the range; exact under it and over it.

Definition at line 1132 of file Compressor.h.

◆ Route

template<FloatType T>
enum class dspark::Compressor::Route
strong

What of a stereo pair the compressor works on (see setRoute()).

Enumerator
Stereo 

Left and right (default).

MidSide 

The middle and the sides, each with its gain; setStereoLink() links the two.

Mid 

The middle only: the sides pass untouched.

Side 

The sides only: the middle passes untouched.

MidKeysSide 

The sides, with the gain the middle of the key asks for.

SideKeysMid 

The middle, with the gain the sides of the key ask for.

Definition at line 915 of file Compressor.h.

◆ StagePosition

template<FloatType T>
enum class dspark::Compressor::StagePosition
strong

Where the analog colour stage sits (see setCharacterStage()).

Enumerator
Off 

No colour stage (the default).

Before 

The input amplifier: coloured before it is compressed (and detected).

After 

The output amplifier: the compressed signal is coloured.

Definition at line 1214 of file Compressor.h.

◆ Topology

template<FloatType T>
enum class dspark::Compressor::Topology
strong

Signal routing topology for the detector sidechain.

Enumerator
FeedForward 

Detector reads uncompressed input (modern, precise, transparent).

FeedBack 

Detector reads compressed output (vintage, self-regulating, colored). The static curve still honours the panel values: the element's law is solved so the closed loop settles exactly on the requested ratio and knee, like the hardware whose panel markings reflect measured curves. External sidechain keys are ignored here (the detector is wired to the output).

Definition at line 132 of file Compressor.h.

Constructor & Destructor Documentation

◆ ~Compressor()

template<FloatType T>
dspark::Compressor< T >::~Compressor ( )
default

Member Function Documentation

◆ analyticMakeupDb()

template<FloatType T>
T dspark::Compressor< T >::analyticMakeupDb ( Character  charType,
Mode  modeType,
DetectorType  detType,
bool  decoupled,
bool  loop 
)
inlineprotectednoexcept

Target of the analytic makeup, in dB, for a routing that is already known (the solve only runs when a setting changed).

Definition at line 5528 of file Compressor.h.

◆ analyticTarget()

template<FloatType T>
T dspark::Compressor< T >::analyticTarget ( )
inlineprotectednoexcept

Target of the analytic makeup for the settings as they stand (0 dB when another makeup mode is selected).

Definition at line 5568 of file Compressor.h.

◆ applyBallistics()

template<FloatType T>
T dspark::Compressor< T >::applyBallistics ( T  targetGrDb,
int  ch,
bool  splitAdaptive,
T  loopSlope = T(-1),
double  loopDelay = 0.0 
)
inlineprotectednoexcept

Smooths the static gain target with the active character's ballistics.

Operates on the gain change in dB. Varimu, and Clean with Branching ballistics or in feedback, run a branching one-pole (attack while the gain moves away from unity, release while it recovers). Opto/FET blend a fast envelope with a slow one that charges with compression history, producing the two-stage program-dependent release of the modeled hardware: brief peaks release fast because the slow stage never charged, sustained compression leaves a long tail.

Parameters
targetGrDbStatic gain change target in dB (negative = reduction).
chChannel index.
splitAdaptiveTrue when the EFFECTIVE detector is SplitPolarity (the callers derive it once per block/sample: it must follow the detector actually in use, which the FET character overrides).
loopSlopeIncremental loop gain when driven from a feedback detector with memory (explicit loop): both coefficients get a stability floor, which caps the per-sample loop advance at 0.5 and keeps the one-sample-delay iteration from ringing at extreme ratio/time combinations. It applies at any slope, 0 included: below the knee the loop is flat, but a release faster than the detector's delay still overshoots the settled gain. Negative = no loop (default).
loopDelayDelay of the detector inside that loop, in samples (see feedbackDetectorDelay()). A loop that advances faster than its detector can report the result overshoots and rings, so the floor also caps the release advance at 1 / (e (1 + delay)), the critically damped limit of a first-order loop around a delay, and the attack advance at twice that.
Returns
The smoothed gain change in dB to apply.

Definition at line 4892 of file Compressor.h.

◆ applyBallisticsDecoupled()

template<FloatType T>
T dspark::Compressor< T >::applyBallisticsDecoupled ( T  targetGrDb,
int  ch,
bool  splitAdaptive 
)
inlineprotectednoexcept

Decoupled ballistics for the Clean character in feed-forward operation (after the smooth decoupled peak detector of Giannoulis, Massberg and Reiss, JAES 2012).

A hold stage follows a deeper target at once and releases toward a shallower one; a smoothing stage then follows the held envelope with the attack pole while it deepens and a release-side pole (a tenth of the release, see updateTimeConstants) while it recovers. Branching ballistics release toward every dip of a rectified waveform (each zero crossing of a tone), so the gain rides the waveform; here the dips only shave the held level by its slow release, and the smoothing stage filters that small sawtooth in both directions. A 1 kHz tone 14 dB over a 4:1 threshold: THD+N -65.5 dB branching against -102 dB here at 5/100 ms (-54 against -80 dB at 1/30 ms, -57 against -84 dB at 0.1/50 ms), and the gain sits on the peak-referenced static curve instead of up to 0.8 dB above it.

Timing contract: the attack is the attack pole alone (the hold stage is instant), so its t63 is the knob. On release the two stages are in series; updateTimeConstants() solves the hold stage's time constant so the series release still passes t63 at the release knob. The series rounds the first part of the release (at 5/100 ms the curve stays within 0.8 dB of the exponential on a 12 dB release). When the attack is longer than half the release, the release-side pole is capped at half the release, so a release can still be shorter than the attack.

Parameters
targetGrDbStatic gain change target in dB (negative = reduction).
chChannel index.
splitAdaptiveTrue when the effective detector is SplitPolarity (its level-adaptive release then shortens the hold stage).
Returns
The smoothed gain change in dB to apply.

Definition at line 5081 of file Compressor.h.

◆ applyBallisticsFeedbackImplicit()

template<FloatType T>
T dspark::Compressor< T >::applyBallisticsFeedbackImplicit ( T  inDb,
int  ch,
Character  charType,
T  thresh,
T  ratio,
T  knee 
)
inlineprotectednoexcept

Feedback ballistics with the loop resolved semi-implicitly.

Runs the same branching envelopes as applyBallistics, but the step toward the target is solved simultaneously with the level the detector will read. Hold and range act on the OBSERVED gain after the step (see the inline note), and the memory stage tracks the real static curve.

Parameters
inDbInput level in dB (post link and sidechain filter).
chProcessing channel index.
charTypeCompressor character whose ballistics are applied.
threshThreshold parameter in dB.
ratioConfigured compression ratio.
kneeSoft-knee width parameter in dB.

Definition at line 4742 of file Compressor.h.

◆ applyGain()

template<FloatType T>
void dspark::Compressor< T >::applyGain ( AudioBufferView< T > &  audio,
int  ch,
int  i,
T  gainLin,
T  grDb,
int  activeLookahead,
Character  charType,
T  colorAmt,
T  makeupLin,
T  mixVal,
T  outLin 
)
inlineprotectednoexcept

Applies the frame's gain to one channel: lookahead, FET colour, feedback history, makeup and the parallel mix.

Definition at line 3206 of file Compressor.h.

◆ applyHoldAndRange()

template<FloatType T>
T dspark::Compressor< T >::applyHoldAndRange ( T  targetGR_Db,
int  ch 
)
inlineprotectednoexcept

Applies the hold and range stages to the static gain target (dB).

Hold keeps the deepest recent gain change for holdSamples_ before the ballistics may relax; range bounds |gain change| to the configured dB.

Definition at line 3498 of file Compressor.h.

◆ applySidechainHPF()

template<FloatType T>
T dspark::Compressor< T >::applySidechainHPF ( T  input,
int  ch 
)
inlineprotectednoexcept

Applies sidechain filtering for a specific channel.

Parameters
inputRaw sidechain sample.
chChannel index.
Returns
High-pass filtered sample.

Definition at line 5763 of file Compressor.h.

◆ asymmetric()

template<FloatType T>
T dspark::Compressor< T >::asymmetric ( T  key,
int  ch 
)
inlineprotectednoexcept

The key with a share of its own crest added, scaled so that the half the share favours still reads the crest.

Definition at line 4392 of file Compressor.h.

◆ atRest()

template<FloatType T>
static bool dspark::Compressor< T >::atRest ( double  envelope,
double  target 
)
inlinestaticprotectednoexcept

An envelope within 1e-4 dB of no gain change, heading there: it is put on it, to end the asymptotic tail of a release.

The target has to be at rest too. Asking only the envelope (as this did) also caught an envelope leaving zero in steps shorter than that: with a slow attack or a slow charge of the memory stage and a shallow target, each step was undone and the gain never moved (100 ms of attack at 96 kHz ignored any target under 1 dB; the memory stage of Opto with a release of 500 ms, any under 9.6 dB at 48 kHz).

Definition at line 4853 of file Compressor.h.

◆ balanceAdvance()

template<FloatType T>
double dspark::Compressor< T >::balanceAdvance ( double  lowSq,
double  highSq 
)
inlineprotectednoexcept

Smooths the frame's two powers and returns the balance of the key: -1 all low, +1 all high, 0 the same in both (or silence).

Definition at line 5432 of file Compressor.h.

◆ balanceBands()

template<FloatType T>
void dspark::Compressor< T >::balanceBands ( T  key,
int  ch,
double &  lowSq,
double &  highSq 
)
inlineprotectednoexcept

Feeds one channel's key to the two bands of the balance and adds their squares to the frame's.

One-pole splits: what a low-pass at kBalanceFloorHz keeps is taken out, and the rest goes through a low-pass at kBalanceLowHz (the low band); what a low-pass at kBalanceHighHz leaves out goes through one at kBalanceCeilingHz (the high band). The bands are equally wide on a logarithmic axis, so a key with the same power in every octave gives the two the same.

Definition at line 5418 of file Compressor.h.

◆ ballisticsCore()

template<FloatType T>
double dspark::Compressor< T >::ballisticsCore ( double  tgt,
double &  fast,
double &  slow,
double &  mid,
double &  deep,
double  attCoeff,
double  relCoeff,
double  chargeCoeff,
double  slowRelCoeff,
double  midChargeCoeff,
double  midRelCoeff 
) const
inlineprotectednoexcept

ballisticsStep() with the coefficients of the memory stage given too.

Definition at line 4969 of file Compressor.h.

◆ ballisticsStep()

template<FloatType T>
double dspark::Compressor< T >::ballisticsStep ( double  tgt,
double &  fast,
double &  slow,
double &  mid,
double &  deep,
double  attCoeff,
double  relCoeff 
) const
inlineprotectednoexcept

Branching ballistics on explicit state (shared by both block paths): the fast envelope, plus the Opto/FET memory stage.

Attack acts while the gain FALLS (louder signal: deeper reduction, or less upward boost); release acts while it recovers upward. A magnitude comparison would invert the two in Upward mode and make the envelope chase the huge boosts of the waveform's zero crossings.

Definition at line 4961 of file Compressor.h.

◆ boundImplicit()

template<FloatType T>
T dspark::Compressor< T >::boundImplicit ( T  shown,
int  ch 
)
inlineprotectednoexcept

Hold and range of the semi-implicit loop.

They act on the OBSERVED gain: the element's internal target is loop-amplified by up to (R - 1) during transients, so clamping THAT to the user's range would throttle the attack, and holding it would compare mismatched domains. When they override, the fast stage is rewritten so the blend lands on the bound.

Definition at line 4830 of file Compressor.h.

◆ branchingStep()

template<FloatType T>
static double dspark::Compressor< T >::branchingStep ( double  y,
double  tgt,
double  cDown,
double  cUp 
)
inlinestaticprotectednoexcept

Branch-free branching one-pole step toward tgt: coefficient cDown while the state is above the target (the gain falls), cUp otherwise.

The two candidate steps are ordered by the coefficients: with cDown <= cUp the falling step is the smaller one when the state is above the target and the rising step the smaller one when it is below, so min() selects the right branch (max() when cDown > cUp). Same value as the branch, without a data-dependent jump per sample.

Definition at line 4944 of file Compressor.h.

◆ clampEnum()

template<FloatType T>
template<typename E >
static E dspark::Compressor< T >::clampEnum ( E  value,
E  last 
)
inlinestaticprotectednoexcept

Clamps an enum to its valid [first, last] range.

Wild values (a cast integer, a corrupted state blob) would otherwise fall through every switch case: updateTimeConstants() would keep its zero-initialized coefficients (instant ballistics, i.e. a waveshaper) and the getters would report an impossible value.

Definition at line 2180 of file Compressor.h.

◆ computeGain()

template<FloatType T>
T dspark::Compressor< T >::computeGain ( T  inputDb,
T  thresh,
T  ratio,
T  knee,
Character  charType,
Mode  modeType,
T  guardDb 
) const
inlineprotectednoexcept

Calculates static target gain reduction based on knee and ratio.

Parameters
inputDbDetected level in decibels.
threshThreshold parameter in dB.
ratioRatio parameter.
kneeSoft-knee width parameter in dB.
charTypeApplies the character's knee floor and ratio law.
modeTypeUpward or Downward processing mode.
guardDbSustained level used to suppress upward gain in silence.
Returns
Target gain reduction in Decibels.

Definition at line 4099 of file Compressor.h.

◆ computeGainFeedback()

template<FloatType T>
FeedbackLaw dspark::Compressor< T >::computeGainFeedback ( T  outDb,
T  thresh,
T  ratio,
T  knee,
Character  charType 
) const
inlineprotectednoexcept

Feedback target for detectors with memory (explicit path).

Varimu's level-dependent ratio is a function of the INPUT level, which a feedback detector does not see; two fixed-point passes reconstruct it from the output level (the law is smooth, so this lands well within 0.1 dB of the exact curve).

Parameters
outDbDetected output level (dB).
threshThreshold parameter in dB.
ratioConfigured compression ratio.
kneeSoft-knee width parameter in dB.
charTypeCompressor character whose static law is applied.

Definition at line 4607 of file Compressor.h.

◆ computeGainFeedbackUpward()

template<FloatType T>
static FeedbackLaw dspark::Compressor< T >::computeGainFeedbackUpward ( T  outDb,
T  thresh,
T  ratio,
T  knee,
T  guardDb 
)
inlinestaticprotectednoexcept

Upward element law for feedback detection, per output level.

The inverse of the feed-forward upward curve, as elementLaw() is for the downward one: with the detector on the output, a raw feed-forward law could never observe more than 2:1. Below the knee the boost is (R - 1) * (threshold - out), so the settled loop lands on the panel ratio; the soft knee is inverted in closed form. The silence guard reads the (output) level the detector sees.

Parameters
outDbDetected output level (dB).
threshThreshold in dB.
ratioConfigured ratio (>= 1).
kneeKnee width in dB (>= 0).
guardDbSustained level for the silence guard.

Definition at line 4641 of file Compressor.h.

◆ computeGainUpward()

template<FloatType T>
T dspark::Compressor< T >::computeGainUpward ( T  inputDb,
T  thresh,
T  ratio,
T  knee,
T  guardDb 
) const
inlineprotectednoexcept

Upward compression curve calculation.

The boost fades to zero when guardDb falls 40 to 60 dB below the threshold: without that guard, pauses and the noise floor (which the detector reads at its -100 dB floor) would receive the largest boost of all. guardDb is the peak-held sustained level, NOT the instantaneous one: gating on the instantaneous level would punch boost holes at every zero crossing of the waveform.

Definition at line 4515 of file Compressor.h.

◆ copyGainStateFromChannel0()

template<FloatType T>
void dspark::Compressor< T >::copyGainStateFromChannel0 ( int  nCh)
inlineprotectednoexcept

Copies channel 0's gain-computer state to channels [1, nCh).

Definition at line 2954 of file Compressor.h.

◆ decoupledCore()

template<FloatType T>
static double dspark::Compressor< T >::decoupledCore ( double  tgt,
double &  hold,
double &  fast,
double  holdCoeff,
double  attCoeff,
double  smoothCoeff 
)
inlinestaticprotectednoexcept

decoupledStep() with the coefficients of the smoothing stage given too.

Definition at line 5103 of file Compressor.h.

◆ decoupledHoldTau()

template<FloatType T>
static double dspark::Compressor< T >::decoupledHoldTau ( double  releaseMs,
double  smoothMs 
)
inlinestaticprotectednoexcept

Time constant of the decoupled hold stage (ms) so that the series release of the hold stage and the smoothing pole passes t63 at releaseMs.

Series step-down response of two one-poles tau1, tau2: (tau1 e^(-t/tau1) - tau2 e^(-t/tau2)) / (tau1 - tau2), increasing in tau1; bisected (setup rate, not per sample).

Definition at line 5129 of file Compressor.h.

◆ decoupledStep()

template<FloatType T>
double dspark::Compressor< T >::decoupledStep ( double  tgt,
double &  hold,
double &  fast,
double  holdCoeff 
) const
inlineprotectednoexcept

One decoupled step on explicit state (see applyBallisticsDecoupled).

Definition at line 5096 of file Compressor.h.

◆ detectLevel()

template<FloatType T>
T dspark::Compressor< T >::detectLevel ( T  sample,
int  ch,
DetectorType  detType 
)
inlineprotectednoexcept

Computes level detection in Decibels.

Parameters
sampleInput sample.
chChannel index (for state tracking).
detTypeSelected detector methodology.
Returns
Decibel representation of detected level.

Definition at line 3805 of file Compressor.h.

◆ detectLevelLinear()

template<FloatType T>
T dspark::Compressor< T >::detectLevelLinear ( T  sample,
int  ch,
DetectorType  detType 
)
inlineprotectednoexcept

Computes the detected level as a linear magnitude (>= 0).

Parameters
sampleInput sample.
chChannel index (for state tracking).
detTypeSelected detector methodology.
Returns
Linear detected level.

Definition at line 3817 of file Compressor.h.

◆ detectorFor()

template<FloatType T>
static constexpr DetectorType dspark::Compressor< T >::detectorFor ( const CharacterProfile &  profile,
DetectorType  asked 
)
inlinestaticconstexprprotectednoexcept

The detector a character reads with when the user asks for one.

Definition at line 4055 of file Compressor.h.

◆ detectorPoints()

template<FloatType T>
void dspark::Compressor< T >::detectorPoints ( T  sample,
int  ch,
T *  points 
)
inlineprotectednoexcept

The rectified key at kDetectorPoints points per sample.

Feeds the channel's history and writes, in time order, the magnitude of the key at a quarter, a half and three quarters of the way from one sample to the next (a windowed-sinc interpolation of kInterpTaps samples) and at that next sample itself, which is kDetectorDelay samples old.

Parameters
sampleThe key (after the sidechain filter).
chChannel whose history is advanced.
pointsReceives kDetectorPoints magnitudes.

Definition at line 5198 of file Compressor.h.

◆ detectorSafe()

template<FloatType T>
static T dspark::Compressor< T >::detectorSafe ( T  x)
inlinestaticprotectednoexcept

A non-finite sample reads as silence in the detector: it would otherwise latch in the recursive detector, filter and envelope state.

Definition at line 3760 of file Compressor.h.

◆ dominantLevel()

template<FloatType T>
static T dspark::Compressor< T >::dominantLevel ( T  levelL,
T  levelR,
double  rho2 
)
inlinestaticprotectednoexcept

The level of the pair's dominant component from the two detector levels and the squared correlation of the key: the larger eigenvalue of their covariance, halved, so a source in both channels reads its level in each and an equal-power pan reads alike anywhere.

Definition at line 3793 of file Compressor.h.

◆ downwardCurve()

template<FloatType T>
static T dspark::Compressor< T >::downwardCurve ( T  inputDb,
T  thresh,
T  ratio,
T  knee,
Character  charType 
)
inlinestaticprotectednoexcept

Downward static curve with the character's knee floor and ratio law (see computeGain).

Definition at line 4145 of file Compressor.h.

◆ driftUniform()

template<FloatType T>
static double dspark::Compressor< T >::driftUniform ( std::uint32_t &  s)
inlinestaticprotectednoexcept

A uniform draw in [-1, 1) (xorshift32).

Definition at line 4422 of file Compressor.h.

◆ effectiveKneeFor()

template<FloatType T>
static T dspark::Compressor< T >::effectiveKneeFor ( Character  charType,
T  knee 
)
inlinestaticprotectednoexcept

Physical knee floor of the character (dB).

Definition at line 4079 of file Compressor.h.

◆ effectiveRatioFor()

template<FloatType T>
static T dspark::Compressor< T >::effectiveRatioFor ( Character  charType,
T  ratio,
T  excessDb 
)
inlinestaticprotectednoexcept

Level-dependent effective ratio of the character (Varimu grows).

Parameters
charTypeCompressor character whose ratio law is applied.
ratioConfigured compression ratio.
excessDbInput level above the threshold in dB.

Definition at line 4068 of file Compressor.h.

◆ elementLaw()

template<FloatType T>
static FeedbackLaw dspark::Compressor< T >::elementLaw ( T  eOut,
T  r,
T  w 
)
inlinestaticprotectednoexcept

Downward element law for feedback detection, per output level.

The detector reads the compressed output, so a raw feed-forward law in the loop settles far off the requested curve (its observed ratio can never pass 2:1). This is the closed-form inverse instead: gel(out) = grFF(in(out)), where in(out) inverts out = in + grFF(in). The settled loop then reproduces the user's static curve exactly. Piecewise: silence, quadratic knee (cancellation-free root), and a linear region of slope (R - 1), the classic loop gain that makes a feedback compressor observe ratio R.

Parameters
eOutDetected output level relative to the threshold (dB).
rEffective ratio (>= 1).
wEffective knee width (dB, >= 0).

Definition at line 4571 of file Compressor.h.

◆ feedbackDetectorDelay()

template<FloatType T>
double dspark::Compressor< T >::feedbackDetectorDelay ( DetectorType  detType) const
inlineprotectednoexcept

Delay of the detector as an explicit feedback loop sees it, in samples: the RMS window (its reading of a level step completes one window later). The other detectors respond within a few samples, which the base cap of the loop advance already covers.

Definition at line 5021 of file Compressor.h.

◆ flushLinkCovariance()

template<FloatType T>
void dspark::Compressor< T >::flushLinkCovariance ( )
inlineprotectednoexcept

The covariance decays toward zero in silence: flushed before it reaches the subnormal range (once per block).

Definition at line 3782 of file Compressor.h.

◆ gained()

template<FloatType T>
T dspark::Compressor< T >::gained ( T  input,
T  gain,
int  ch 
)
inlineprotectednoexcept

The gain on one sample of a channel when it is not a plain product: through the tone that follows the reduction, and with what leaks of the control.

Definition at line 4363 of file Compressor.h.

◆ gainPath()

template<FloatType T>
T dspark::Compressor< T >::gainPath ( T  inputDb,
int  ch,
const GainPathConfig &  cfg,
T  thresh,
T  ratio,
T  knee 
)
inlineprotectednoexcept

Static curve plus character ballistics for one channel's state.

Runs the Upward guard, the topology's gain law, hold/range and the ballistics on channel ch's state, and returns the smoothed gain change in dB.

Parameters
inputDbDetected (linked) level in dB.
chChannel whose state is advanced.
cfgRouting derived once per block.
threshThreshold in dB.
ratioRatio.
kneeKnee width in dB.

Definition at line 3137 of file Compressor.h.

◆ gainPathPrecise()

template<FloatType T>
T dspark::Compressor< T >::gainPathPrecise ( const T *  levelDb,
int  count,
int  ch,
const GainPathConfig &  cfg,
T  thresh,
T  ratio,
T  knee 
)
inlineprotectednoexcept

The gain of one frame at Precision::High, for one gain computer.

The frame brings count levels in time order (kDetectorPoints from a detector read between the samples, one otherwise). The ballistics take kSubsteps steps in all, with the coefficients of that share of a sample: in feed-forward towards a target that moves along the line from one level's target to the next; in the loop solved against the input, with the level moving along that line and the loop solved at each step. The gain is the mean of the steps. Hold and range act once per level in feed-forward and once per frame, on the gain the last step leaves, in the loop.

Parameters
levelDbLevels in dB, oldest first.
countHow many (1 or kDetectorPoints).
chChannel whose state is advanced.
cfgRouting derived once per block.
threshThreshold in dB.
ratioRatio.
kneeKnee width in dB.

Definition at line 5261 of file Compressor.h.

◆ getAdaptiveAttack()

template<FloatType T>
T dspark::Compressor< T >::getAdaptiveAttack ( ) const
inlinenoexcept

Weight of the target-dependent attack (see setAdaptiveAttack()).

Definition at line 1318 of file Compressor.h.

◆ getAmount()

template<FloatType T>
T dspark::Compressor< T >::getAmount ( ) const
inlinenoexcept

The share of the gain change that is applied (setAmount()).

Definition at line 1109 of file Compressor.h.

◆ getAttackEmphasis()

template<FloatType T>
T dspark::Compressor< T >::getAttackEmphasis ( ) const
inlinenoexcept

Emphasis of the attack (see setAttackEmphasis()).

Definition at line 1370 of file Compressor.h.

◆ getCharacter()

template<FloatType T>
Character dspark::Compressor< T >::getCharacter ( ) const
inlinenoexcept

Returns the currently active character.

Definition at line 1885 of file Compressor.h.

◆ getCharacterColor()

template<FloatType T>
T dspark::Compressor< T >::getCharacterColor ( ) const
inlinenoexcept

Returns the character colour amount (see setCharacterColor).

Definition at line 1750 of file Compressor.h.

◆ getCharacterStage()

template<FloatType T>
StagePosition dspark::Compressor< T >::getCharacterStage ( ) const
inlinenoexcept

Where the colour stage sits (see setCharacterStage()).

Definition at line 1251 of file Compressor.h.

◆ getCharacterStageSettings()

template<FloatType T>
StageSettings dspark::Compressor< T >::getCharacterStageSettings ( ) const
inlinenoexcept

The settings of the colour stage.

Definition at line 1261 of file Compressor.h.

◆ getCleanBallistics()

template<FloatType T>
CleanBallistics dspark::Compressor< T >::getCleanBallistics ( ) const
inlinenoexcept

Returns the Clean character's feed-forward ballistics.

Definition at line 1744 of file Compressor.h.

◆ getControlLeak()

template<FloatType T>
T dspark::Compressor< T >::getControlLeak ( ) const
inlinenoexcept

How much of the moves of the gain leaks into the audio (setControlLeak()).

Definition at line 1660 of file Compressor.h.

◆ getControlNetworkCorner()

template<FloatType T>
T dspark::Compressor< T >::getControlNetworkCorner ( ) const
inlinenoexcept

Corner of the network in the control path, in Hz (setControlNetwork()).

Definition at line 1593 of file Compressor.h.

◆ getControlNetworkDepth()

template<FloatType T>
T dspark::Compressor< T >::getControlNetworkDepth ( ) const
inlinenoexcept

Depth of the network in the control path, in dB (setControlNetwork()).

Definition at line 1590 of file Compressor.h.

◆ getDetector()

template<FloatType T>
DetectorType dspark::Compressor< T >::getDetector ( ) const
inlinenoexcept

Returns the currently active detector type.

Definition at line 1879 of file Compressor.h.

◆ getDetectorAsymmetry()

template<FloatType T>
T dspark::Compressor< T >::getDetectorAsymmetry ( ) const
inlinenoexcept

How differently the detector reads the two halves of the wave (setDetectorAsymmetry()).

Definition at line 1688 of file Compressor.h.

◆ getDetectorDrift()

template<FloatType T>
T dspark::Compressor< T >::getDetectorDrift ( ) const
inlinenoexcept

How far the detector's asymmetry wanders (setDetectorDrift()).

Definition at line 1715 of file Compressor.h.

◆ getGainReductionDb()

template<FloatType T>
T dspark::Compressor< T >::getGainReductionDb ( ) const
inlinenoexcept

Returns current active gain reduction in dB (negative value).

Definition at line 1876 of file Compressor.h.

◆ getGainSmoothing()

template<FloatType T>
T dspark::Compressor< T >::getGainSmoothing ( ) const
inlinenoexcept

The smoothing of the gain after the ballistics, in milliseconds.

Definition at line 1532 of file Compressor.h.

◆ getHoldMode()

template<FloatType T>
HoldMode dspark::Compressor< T >::getHoldMode ( ) const
inlinenoexcept
Returns
What the hold keeps.

Definition at line 1419 of file Compressor.h.

◆ getLatency()

template<FloatType T>
int dspark::Compressor< T >::getLatency ( ) const
inlinenoexcept

Returns total processing latency in samples.

The lookahead. Feedback operation (Topology::FeedBack, or the FET character, which always detects in feedback) disables it, so latency is 0 there, unless the loop runs on the key (setFeedbackKeyed()). With setPrecision(High), the Peak and TruePeak detectors read 7 samples late and the audio waits for them, in feed-forward and in the feedback loops that mode covers. A colour stage in place (setCharacterStage()) adds its few samples. The plugin layer re-reads this after parameter changes and re-notifies the host when it moves.

Definition at line 1898 of file Compressor.h.

◆ getLiftBelow()

template<FloatType T>
T dspark::Compressor< T >::getLiftBelow ( ) const
inlinenoexcept

Distance of the lower threshold of Mode::Both under the main one, in dB (setLift()).

Definition at line 868 of file Compressor.h.

◆ getLiftRange()

template<FloatType T>
T dspark::Compressor< T >::getLiftRange ( ) const
inlinenoexcept

The most Mode::Both raises, in dB (setLift()).

Definition at line 874 of file Compressor.h.

◆ getLiftRatio()

template<FloatType T>
T dspark::Compressor< T >::getLiftRatio ( ) const
inlinenoexcept

Ratio of the rise of Mode::Both (setLift()).

Definition at line 871 of file Compressor.h.

◆ getLinkMode()

template<FloatType T>
LinkMode dspark::Compressor< T >::getLinkMode ( ) const
inlinenoexcept
Returns
How a stereo pair is linked.

Definition at line 912 of file Compressor.h.

◆ getLookaheadShape()

template<FloatType T>
LookaheadShape dspark::Compressor< T >::getLookaheadShape ( ) const
inlinenoexcept
Returns
How the lookahead brings a reduction in.

Definition at line 1042 of file Compressor.h.

◆ getMaxLookahead()

template<FloatType T>
T dspark::Compressor< T >::getMaxLookahead ( ) const
inlinenoexcept

The latency kept for the lookahead, in ms (0: none; see setMaxLookahead()).

Definition at line 1010 of file Compressor.h.

◆ getMidSideFocus()

template<FloatType T>
T dspark::Compressor< T >::getMidSideFocus ( ) const
inlinenoexcept
Returns
The lean of the compression to the middle (-1) or the sides (1).

Definition at line 969 of file Compressor.h.

◆ getOptoCell()

template<FloatType T>
OptoCell dspark::Compressor< T >::getOptoCell ( ) const
inlinenoexcept
Returns
The cell set by setOptoCell().

Definition at line 1479 of file Compressor.h.

◆ getPrecision()

template<FloatType T>
Precision dspark::Compressor< T >::getPrecision ( ) const
inlinenoexcept

How finely the control signal is computed (see setPrecision()).

Definition at line 1210 of file Compressor.h.

◆ getProgramRelease()

template<FloatType T>
T dspark::Compressor< T >::getProgramRelease ( ) const
inlinenoexcept

Weight of the programme-dependent release (see setProgramRelease()).

Definition at line 1294 of file Compressor.h.

◆ getRangeShape()

template<FloatType T>
RangeShape dspark::Compressor< T >::getRangeShape ( ) const
inlinenoexcept

How the gain change meets the range (setRangeShape()).

Definition at line 1159 of file Compressor.h.

◆ getReductionToneHigh()

template<FloatType T>
T dspark::Compressor< T >::getReductionToneHigh ( ) const
inlinenoexcept

Its gain over 4 kHz, in dB.

Definition at line 1635 of file Compressor.h.

◆ getReductionToneLow()

template<FloatType T>
T dspark::Compressor< T >::getReductionToneLow ( ) const
inlinenoexcept

Gain under 200 Hz of the tone that follows the reduction, in dB (setReductionTone()).

Definition at line 1632 of file Compressor.h.

◆ getReleaseLanding()

template<FloatType T>
T dspark::Compressor< T >::getReleaseLanding ( ) const
inlinenoexcept

The landing of the release, in milliseconds (setReleaseLanding()).

Definition at line 1558 of file Compressor.h.

◆ getRoute()

template<FloatType T>
Route dspark::Compressor< T >::getRoute ( ) const
inlinenoexcept

What of a stereo pair is compressed (setRoute()).

Definition at line 950 of file Compressor.h.

◆ getSidechainBand()

template<FloatType T>
KeyBand dspark::Compressor< T >::getSidechainBand ( int  band) const
inlinenoexcept

The settings of a band of the key equalizer.

Definition at line 1813 of file Compressor.h.

◆ getSidechainResponse()

template<FloatType T>
KeyEq::Response dspark::Compressor< T >::getSidechainResponse ( ) const
inlinenoexcept

The curve of the key equalizer, for a display: build it when the bands change and read each frequency from it.

Definition at line 1819 of file Compressor.h.

◆ getSpectralTiming()

template<FloatType T>
T dspark::Compressor< T >::getSpectralTiming ( ) const
inlinenoexcept

Weight of the spectral balance on the times (see setSpectralTiming()).

Definition at line 1345 of file Compressor.h.

◆ getState()

template<FloatType T>
std::vector< uint8_t > dspark::Compressor< T >::getState ( ) const
inline

Serializes the parameter state (setup/UI threads; allocates).

Definition at line 2028 of file Compressor.h.

◆ getThresholdInUseDb()

template<FloatType T>
T dspark::Compressor< T >::getThresholdInUseDb ( ) const
inlinenoexcept

The threshold in use, in dBFS (metering; any thread): the set one, or with setAutoThreshold() the key's recent peak plus it.

Definition at line 1086 of file Compressor.h.

◆ getTopology()

template<FloatType T>
Topology dspark::Compressor< T >::getTopology ( ) const
inlinenoexcept

Returns the currently active topology.

Definition at line 1882 of file Compressor.h.

◆ heldBack()

template<FloatType T>
T dspark::Compressor< T >::heldBack ( T  grDb,
int  g,
double  delay,
bool  run 
)
inlineprotectednoexcept

The gain as it is heard with a latency kept for the lookahead: older by the difference (see setMaxLookahead()).

Definition at line 5214 of file Compressor.h.

◆ holdAndRange()

template<FloatType T>
static T dspark::Compressor< T >::holdAndRange ( T  targetGR_Db,
T  range,
int  holdSamples,
T &  held,
int &  counter,
int  soft = 0,
SlidingDeepest *  window = nullptr,
int  perSample = 1 
)
inlinestaticprotectednoexcept

Hold and range on explicit state (shared by both block paths).

Parameters
targetGR_DbStatic gain change target in dB.
rangeMaximum |gain change| in dB.
holdSamplesHold length in samples (0 = off).
heldHeld gain change (state).
counterRemaining hold samples (state).
softHow the target meets the range: a RangeShape, as its number.
windowThe sliding window that holds instead (HoldMode::EveryPeak), or nullptr.
perSampleTargets given per sample (the window counts samples).

Definition at line 3693 of file Compressor.h.

◆ holdWindow()

template<FloatType T>
SlidingDeepest * dspark::Compressor< T >::holdWindow ( int  ch) const
inlineprotectednoexcept
Returns
The window of a gain computer's hold in HoldMode::EveryPeak (nullptr in Deepest).

Definition at line 3677 of file Compressor.h.

◆ isAutoThreshold()

template<FloatType T>
bool dspark::Compressor< T >::isAutoThreshold ( ) const
inlinenoexcept

Whether the threshold counts from the key's recent peak (setAutoThreshold()).

Definition at line 1080 of file Compressor.h.

◆ isFeedbackKeyed()

template<FloatType T>
bool dspark::Compressor< T >::isFeedbackKeyed ( ) const
inlinenoexcept
Returns
Whether a feedback loop runs on the key ahead of the audio.

Definition at line 1066 of file Compressor.h.

◆ isLayered()

template<FloatType T>
static constexpr bool dspark::Compressor< T >::isLayered ( const CharacterProfile &  profile,
Mode  modeType 
)
inlinestaticconstexprprotectednoexcept

Whether a character runs its two layers: it has them, and the mode is Downward.

Definition at line 4049 of file Compressor.h.

◆ isRemovalListen()

template<FloatType T>
bool dspark::Compressor< T >::isRemovalListen ( ) const
inlinenoexcept
Returns
Whether the output is what the compression takes out.

Definition at line 1846 of file Compressor.h.

◆ isSidechainListen()

template<FloatType T>
bool dspark::Compressor< T >::isSidechainListen ( ) const
inlinenoexcept

Whether the key is being played instead of the audio.

Definition at line 1837 of file Compressor.h.

◆ isSoftRange()

template<FloatType T>
bool dspark::Compressor< T >::isSoftRange ( ) const
inlinenoexcept

Whether the gain change meets the range without a corner (setSoftRange(), setRangeShape()).

Definition at line 1126 of file Compressor.h.

◆ kneeCurve()

template<FloatType T>
static T dspark::Compressor< T >::kneeCurve ( T  inputDb,
T  thresh,
T  slope,
T  knee 
)
inlinestaticprotectednoexcept

A threshold, a slope (1 - 1/ratio) and a quadratic knee: the gain change at a level, in decibels.

Definition at line 4162 of file Compressor.h.

◆ layeredCurve()

template<FloatType T>
static Layers dspark::Compressor< T >::layeredCurve ( T  inputDb,
T  thresh,
T  ratio,
T  knee,
const CharacterProfile &  profile 
)
inlinestaticprotectednoexcept

The curves of the two layers.

The levelling layer takes its share of the slope from levelLeadDb under the threshold, over a knee twice that wide; the other layer takes the rest from as far over the threshold as leaves the sum, far above, on the curve of the ratio itself.

Definition at line 4196 of file Compressor.h.

◆ layeredStep()

template<FloatType T>
double dspark::Compressor< T >::layeredStep ( T  inputDb,
T  thresh,
T  ratio,
T  knee,
const CharacterProfile &  profile,
T  range,
int  holdN,
int  soft,
T &  held,
int &  counter,
double &  level,
double &  peak,
SlidingDeepest *  window = nullptr 
) const
inlineprotectednoexcept

One frame of a layered character: hold and range on the whole target, each layer towards its part of it, and their sum.

The levelling layer never asks for more than the bounded whole; the other layer takes what is left of it, so a held or a limited target is shared out without a division.

Definition at line 4236 of file Compressor.h.

◆ levelerCurve()

template<FloatType T>
static T dspark::Compressor< T >::levelerCurve ( T  inputDb,
T  thresh 
)
inlinestaticprotectednoexcept

The levelling curve: the gain 1 / (1 + level / threshold), in decibels. Nothing far under the threshold, 6 dB at it, and all that the level is over it far above.

Definition at line 4128 of file Compressor.h.

◆ lift()

template<FloatType T>
T dspark::Compressor< T >::lift ( T  inputDb,
T  thresh,
T  knee,
T  guardDb 
) const
inlineprotectednoexcept

The upward half of Mode::Both: the rise under the lower threshold, up to its range.

Definition at line 4136 of file Compressor.h.

◆ linkCorrelation()

template<FloatType T>
double dspark::Compressor< T >::linkCorrelation ( T  keyL,
T  keyR 
)
inlineprotectednoexcept

One frame of the key's covariance for the dominant link; returns the squared correlation of the pair (0 when either side is silent).

Definition at line 3769 of file Compressor.h.

◆ lopsidedDetector()

template<FloatType T>
bool dspark::Compressor< T >::lopsidedDetector ( ) const
inlineprotectednoexcept

Whether the detector reads the two halves of the wave differently (an asymmetry or its drift).

Definition at line 4356 of file Compressor.h.

◆ makeupToGain()

template<FloatType T>
T dspark::Compressor< T >::makeupToGain ( T  makeupDb)
inlineprotectednoexcept

Makeup dB to linear, cached: the makeup is shared by every channel of a frame and constant unless automated or adaptive. Same value as a direct decibelsToGain() call.

Parameters
makeupDbMakeup gain in dB.
Returns
Linear makeup gain.

Definition at line 3746 of file Compressor.h.

◆ modeIn()

template<FloatType T>
static constexpr Mode dspark::Compressor< T >::modeIn ( Mode  asked,
Topology  topoEff 
)
inlinestaticconstexprprotectednoexcept

The mode a routing runs: the two-way and the levelling curves are feed-forward ones, and in a loop the curve is the ratio's.

Definition at line 4112 of file Compressor.h.

◆ pacedStep()

template<FloatType T>
static double dspark::Compressor< T >::pacedStep ( double  envelope,
double  target,
double  attackRate,
double  releaseRate,
double  attackPace,
double  releasePace 
)
inlinestaticprotectednoexcept

One step of a follower whose time grows with the distance to its target: far away it moves at a steady pace, close by like a one-pole.

Parameters
envelopeThe follower (dB).
targetWhere it is going (dB).
attackRateShare of the distance per sample while the gain falls.
releaseRateThe same while it recovers.
attackPaceDecibels of distance that double the attack time.
releasePaceDecibels of distance that double the release time.

Definition at line 4218 of file Compressor.h.

◆ partWeight()

template<FloatType T>
T dspark::Compressor< T >::partWeight ( int  ch,
int  idx,
int  n 
) const
inlineprotectednoexcept

The weight of a part's heard gain at sample idx of a block of n (MidSide with a focus): from the block's first weight to its last.

Definition at line 3188 of file Compressor.h.

◆ prepare() [1/2]

template<FloatType T>
void dspark::Compressor< T >::prepare ( const AudioSpec &  spec)
inline

Allocates buffers and initializes internal DSP state.

An invalid spec (non-positive/NaN sample rate or no channels) is ignored: the previous prepared state, if any, stays intact.

Warning
Must not be called from the audio thread. Allocates memory.
Parameters
specAudio environment specification (sample rate, block size, channels).

Definition at line 275 of file Compressor.h.

◆ prepare() [2/2]

template<FloatType T>
void dspark::Compressor< T >::prepare ( double  sampleRate)
inlinenoexcept

Prepares the compressor using sample rate only (backward compatibility).

Parameters
sampleRateThe operating sample rate.

Definition at line 381 of file Compressor.h.

◆ processBlock() [1/2]

template<FloatType T>
void dspark::Compressor< T >::processBlock ( AudioBufferView< T >  audio,
AudioBufferView< T >  sidechain 
)
inlinenoexcept

Processes audio with an independent external sidechain.

The detector analyzes the sidechain buffer, but gain reduction is applied to the audio buffer.

Parameters
audioAudio buffer to be compressed (modified in-place).
sidechainKey/Sidechain signal (read-only).

Definition at line 408 of file Compressor.h.

◆ processBlock() [2/2]

template<FloatType T>
void dspark::Compressor< T >::processBlock ( AudioBufferView< T >  buffer)
inlinenoexcept

Processes an audio buffer in-place using its own signal as the sidechain.

Parameters
bufferMutable reference to the audio block.

Definition at line 391 of file Compressor.h.

◆ processBlockImpl()

template<FloatType T>
void dspark::Compressor< T >::processBlockImpl ( AudioBufferView< T >  audio,
AudioBufferView< T >  sidechain 
)
inlineprotectednoexcept

Core DSP loop executing sidechain detection, linking, ballistics, and gain application.

No-op before prepare(). A sidechain view with fewer samples than the audio view is ignored (the detector falls back to the audio itself) rather than read out of bounds.

Parameters
audioBuffer to modify.
sidechainBuffer to read for level detection.

Definition at line 2196 of file Compressor.h.

◆ processFeedForward()

template<FloatType T>
void dspark::Compressor< T >::processFeedForward ( AudioBufferView< T > &  audio,
AudioBufferView< T > &  sidechain,
int  nCh,
int  nS,
int  scCh,
const FeedForwardConfig &  ff,
const ChunkParams &  constants 
)
inlineprotectednoexcept

Feed-forward block path, run in passes over chunks of frames.

In feed-forward the detector never reads the output, so detection, the level conversion, the gain recursion, the gain conversion and its application can run as separate passes. Only the ballistics recursion is then serial: the log, static curve and exp of different frames overlap freely, and the envelope state stays in registers. Each frame performs the same arithmetic as the per-sample path (processSample() on a mono stream is bit-identical).

Definition at line 2643 of file Compressor.h.

◆ processSample()

template<FloatType T>
T dspark::Compressor< T >::processSample ( T  input,
int  channel 
)
inlinenoexcept

Processes a single sample on one channel.

Bypasses block-level features like stereo linking, parallel mix, and lookahead. Ideal for modular routing, synth voices, or per-sample environments.

Note
No DenormalGuard is installed on this per-sample hot path (installing and tearing down the FTZ/DAZ guard every sample would dominate its cost); per-sample callers are expected to guard their own processing loop with a single DenormalGuard, exactly as the block path does once per block. This matches Limiter/NoiseGate processSample().
getLatency() reports the processBlock() path (its lookahead). This per-sample path BYPASSES the lookahead delay line, so it adds no lookahead latency regardless of setLookahead().
This path runs at Precision::Standard whatever setPrecision() says: the finer control signal waits for a detector that reads late, and there is no delay line here for the audio to wait in.
Shared state (parameter smoothers, auto-makeup envelope) advances once per sample FRAME and is driven by channel 0. Multi-channel per-sample workflows must therefore include channel 0; other channels read the current smoothed values without advancing them.
Parameters
inputAudio sample to process. Returned unchanged (with no state touched) before prepare() or for a channel outside [0, 16).
channelIndex of the audio channel (used for state tracking).
Returns
Compressed output sample.

Definition at line 445 of file Compressor.h.

◆ profileOf()

template<FloatType T>
static constexpr CharacterProfile dspark::Compressor< T >::profileOf ( Character  type)
inlinestaticconstexprprotectednoexcept

The profile of a character.

Definition at line 4036 of file Compressor.h.

◆ programCoeffs()

template<FloatType T>
ProgramCoeffs dspark::Compressor< T >::programCoeffs ( double  target,
double  fast,
ProgramState &  state,
double  balance,
double  share 
) const
inlineprotectednoexcept

The attack and release coefficients of a frame under programme-dependent timing, and the advance of its measures.

Parameters
targetGain target of the frame (dB).
fastThe gain now (dB).
stateMeasures of this gain computer.
balanceSpectral balance of the key.
shareShare of a sample each step of the follower covers.

Definition at line 5451 of file Compressor.h.

◆ programShape()

template<FloatType T>
double dspark::Compressor< T >::programShape ( double  gain,
ProgramState &  state 
) const
inlineprotectednoexcept

The gain with the emphasis of the attack: what it is under its own smoothed course while it falls, added again (or taken off).

Definition at line 5473 of file Compressor.h.

◆ programStep()

template<FloatType T>
double dspark::Compressor< T >::programStep ( double  target,
double &  fast,
ProgramState &  state,
double  balance 
) const
inlineprotectednoexcept

One step of the branching follower with programme-dependent timing (the single envelope of Clean and Varimu).

Definition at line 5481 of file Compressor.h.

◆ programTiming()

template<FloatType T>
ProgramTiming dspark::Compressor< T >::programTiming ( Character  charType,
Topology  topoEff,
bool  decoupled,
bool  splitAdaptive 
) const
inlineprotectednoexcept

The weights for this routing: the Clean and Varimu characters in feed-forward with Branching ballistics.

Definition at line 5382 of file Compressor.h.

◆ pushPullElement()

template<FloatType T>
static T dspark::Compressor< T >::pushPullElement ( T  input,
T  gain,
T  amount 
)
inlinestaticprotectednoexcept

The gain of a variable-mu stage applied by its own curve: two halves in push-pull, biased so that the slope of the pair at rest is the gain asked for.

Each half follows a softplus (the smooth cutoff of a remote-cutoff stage); the pair, half their difference, has the slope of a logistic of the bias. The bias is the one whose slope is the gain (times the slope the pair has at no reduction, kPushPullRest, taken back at the output), so a small signal gets the gain exactly and a large one gets the curve: compression where the pair is biased open, expansion once it nears cutoff, and odd harmonics from both.

Parameters
inputSample the gain applies to.
gainLinear gain asked for (over 1 it is applied past the pair).
amountLevel into the pair: at 1 full scale is kPushPullDrive times the scale of the curve.

Definition at line 4293 of file Compressor.h.

◆ rampedIn()

template<FloatType T>
T dspark::Compressor< T >::rampedIn ( T  grDb,
int  g,
int  length,
bool  run 
)
inlineprotectednoexcept

A gain change through the lookahead's ramp of its gain computer, or as it came.

Definition at line 3668 of file Compressor.h.

◆ readsBetweenSamples()

template<FloatType T>
static bool dspark::Compressor< T >::readsBetweenSamples ( DetectorType  detType)
inlinestaticprotectednoexcept

The detectors that rectify: at Precision::High they read the key between the samples too.

Definition at line 5159 of file Compressor.h.

◆ rectifies()

template<FloatType T>
static bool dspark::Compressor< T >::rectifies ( DetectorType  detType)
inlinestaticprotectednoexcept

Whether a detector rectifies the key (the ones an asymmetry makes sense for).

Definition at line 4312 of file Compressor.h.

◆ reducesOnly()

template<FloatType T>
static constexpr bool dspark::Compressor< T >::reducesOnly ( Mode  modeType)
inlinestaticconstexprprotectednoexcept

Whether a mode only ever takes level off (the automatic makeups that add it back apply).

Definition at line 4118 of file Compressor.h.

◆ referenceOverRmsDb()

template<FloatType T>
static double dspark::Compressor< T >::referenceOverRmsDb ( const MakeupModelKey &  key)
inlinestaticprotectednoexcept

How far over the RMS of dense programme the reference of the automatic threshold rests, for each detector (dB).

Measured on pink noise with the reference's own law (it rises at once and falls 1 dB per second). The RMS window's rests about three of its spreads up while the window is short; a long window moves its level as slowly as the reference falls, and the reference then rests lower.

Definition at line 5643 of file Compressor.h.

◆ reset()

template<FloatType T>
void dspark::Compressor< T >::reset ( )
inlinenoexcept

Resets all internal DSP history, states, and buffers to neutral.

Definition at line 645 of file Compressor.h.

◆ restingGain()

template<FloatType T>
static double dspark::Compressor< T >::restingGain ( const double *  target,
const double *  weight,
int  count,
double  attackRate,
double  releaseRate 
)
inlinestaticprotectednoexcept

Where a branching follower rests over a set of weighted targets.

Each sample it moves towards the target by a share of the distance: attackRate while the target is below it, releaseRate while it is above. Over targets that change much faster than it moves, it rests where the two pulls cancel: attackRate x mean distance to the targets below = releaseRate x mean distance to those above. That point (an expectile of the targets) is found by bisection.

Parameters
targetGain changes (dB).
weightHow often each one is met.
countHow many there are.
attackRate1 - attack coefficient.
releaseRate1 - release coefficient.

Definition at line 5595 of file Compressor.h.

◆ runGainRecursion()

template<FloatType T>
void dspark::Compressor< T >::runGainRecursion ( T *  inDb,
T *  out,
int  m,
int  ch,
const FeedForwardConfig &  ff,
const T *  thr,
const T *  rat,
const T *  kn,
const T *  dryIn,
const double *  balance 
)
inlineprotectednoexcept

The serial part of the feed-forward path for one gain channel: Upward guard, static curve, hold/range and ballistics over a chunk, with the channel's state held in locals.

Parameters
inDbLinked level per frame (dB).
outSmoothed gain change per frame (dB).
mFrames in the chunk.
chChannel whose state is advanced.
ffBlock routing.
thrThreshold per frame.
ratRatio per frame.
knKnee per frame.
dryInSplitPolarity only: the (delayed) input the gain applies to. The recursion then also writes the linear gain into inDb (each frame's level is consumed before it is overwritten). nullptr otherwise.
balanceSpectral balance of the key per frame (see setSpectralTiming()), read by programme-dependent timing.

Definition at line 3000 of file Compressor.h.

◆ runStage()

template<FloatType T>
void dspark::Compressor< T >::runStage ( CharacterStage< T > &  stage,
double &  weight,
bool  wanted,
AudioBufferView< T >  buffer 
)
inlineprotectednoexcept

Runs one place of the colour stage over a block, fading its share towards whether it is wanted (20 ms). Idle, it costs nothing; it starts from clean memory when it comes in.

Definition at line 3907 of file Compressor.h.

◆ setAdaptiveAttack()

template<FloatType T>
void dspark::Compressor< T >::setAdaptiveAttack ( T  amount)
inlinenoexcept

Makes the attack depend on how far the target is.

A target 6 dB or more past the gain is met with the knob's attack; one that is only just past it, with an attack up to four times longer. A transient is still caught at the nominal speed, while the last decibels of every attack, and the small swells of dense programme, are taken gently (less of the waveform ends up in the gain). amount weighs it (0, the default, is the fixed attack). Same scope as setProgramRelease().

State key "adaptiveAttack" (absent = 0).

Parameters
amount0 to 1. Non-finite values are ignored.

Definition at line 1311 of file Compressor.h.

◆ setAmount()

template<FloatType T>
void dspark::Compressor< T >::setAmount ( T  amount)
inlinenoexcept

Sets how much of the gain change is applied, as a scale of its decibels.

1 (the default) applies it all; 0.5 turns 8 dB of reduction into 4 at every instant, with the same timing. Unlike the parallel mix it does not add the unprocessed signal back, so there is nothing to cancel against: it is the same compressor at a gentler ratio. In FeedBack the loop keeps hearing the full reduction. Smoothed.

Parameters
amountShare of the gain change, 0 to 1.

Definition at line 1102 of file Compressor.h.

◆ setAttack()

template<FloatType T>
void dspark::Compressor< T >::setAttack ( T  ms)
inlinenoexcept

Sets the attack time in milliseconds.

Reads as the t63 time constant of the OBSERVED gain-reduction envelope in dB. Character models clamp it to their hardware's physical range: Opto floors it at 10 ms (the T4 cell's published attack time), FET clamps it to 0.02-0.8 ms. In FeedBack operation the loop multiplies the raw ballistics speed by its gain; the coefficient is re-derived so the observed t63 stays on the knob (the 1176's 20-800 us figures are measured results, not raw RC values).

Definition at line 761 of file Compressor.h.

◆ setAttackEmphasis()

template<FloatType T>
void dspark::Compressor< T >::setAttackEmphasis ( T  amount)
inlinenoexcept

Deepens or softens the gain change while it attacks.

After the ballistics, the difference between the gain and a copy of it smoothed over six times the attack (30 ms at the default attack of 5 ms) is added back while the gain is falling: at +1 the leading edge of every reduction goes as far again past its smoothed course (more bite on the transient), at -1 the attack follows the smoothed copy (the transient is let through and the body is held). It only acts while the gain falls; a settled gain and a release are left as they are. 0 (default) is off. Same scope as setProgramRelease().

State key "attackEmphasis" (absent = 0).

Parameters
amount-1 to +1. Non-finite values are ignored.

Definition at line 1363 of file Compressor.h.

◆ setAutoMakeup() [1/2]

template<FloatType T>
void dspark::Compressor< T >::setAutoMakeup ( AutoMakeupMode  mode)
inlinenoexcept

Selects the automatic makeup behavior (default: Off).

Static is the textbook auto makeup: a constant, program-independent offset of half the static gain reduction of a full-scale signal. Adaptive is loudness matching: it tracks the smoothed gain reduction (~300 ms) and compensates it in full, so the average output level stays matched to the input and quiet passages are lifted accordingly (macro-dynamics are reduced). Analytic works the gain out of the settings instead of measuring it: where the ballistics come to rest over dense programme, for the curve, the times, the character and the detector selected; it is a constant between edits of those, and moves to its new value over a few tens of milliseconds after one. It takes the programme at -18 dBFS RMS unless setAutoThreshold() is on, which makes it hold at any level. Measured on pink noise at that level, as the level left over the input's: within 0.1 dB with the Peak detector over thresholds from -30 to -10 dB, ratios from 2 to 10, attacks from 0.5 to 100 ms and releases from 20 ms to 1 s (the Static mode leaves -2.4 to +6.1 dB there), 0.2 dB decoupled and in feedback, 0.3 dB with the RMS, Hilbert and TruePeak detectors and with Opto, 0.5 dB with FET; the same figures at -36 and -6 dBFS with the automatic threshold. The RMS window reads the low end of the programme: on white noise it is off by up to 1.3 dB. For a fixed offset use setMakeupGain().

Definition at line 822 of file Compressor.h.

◆ setAutoMakeup() [2/2]

template<FloatType T>
void dspark::Compressor< T >::setAutoMakeup ( bool  on)
inlinenoexcept

Convenience overload: true selects Adaptive, false turns auto makeup off.

Definition at line 829 of file Compressor.h.

◆ setAutoThreshold()

template<FloatType T>
void dspark::Compressor< T >::setAutoThreshold ( bool  on)
inlinenoexcept

Makes the threshold count from the key's own recent peak instead of from full scale.

A reference follows the level the detector reads: it rises at once and falls 1 dB per second, and the threshold is added to it. The compressor then acts the same on a take recorded 20 dB lower: what it hears is how far the level is from its own recent maximum. In FeedBack the reference follows the input. Off by default.

Definition at line 1077 of file Compressor.h.

◆ setCharacter()

template<FloatType T>
void dspark::Compressor< T >::setCharacter ( Character  type)
inlinenoexcept

Changes ballistics and envelope behavior character.

Definition at line 1444 of file Compressor.h.

◆ setCharacterColor()

template<FloatType T>
void dspark::Compressor< T >::setCharacterColor ( T  amount)
inlinenoexcept

Sets the amount of the character's harmonic signature (0 to 1).

Currently shapes the FET character: 2nd-order channel modulation of the 1176's gain-reduction FET (the drain-source resistance bends with the signal across it), scaled with the active gain reduction and AC-coupled like the hardware's output stage. At 1.0 it is calibrated to the published 1176 THD spec (< 0.5% while limiting, measured at -6 dBFS program level); it only distorts while the FET conducts, so no gain reduction means no added colour. The squared term doubles the signal bandwidth: on synthetic full-scale HF material wrap the compressor in an oversampled section (see docs/cookbook.md) if the folded 2nd harmonic matters.

With the Varimu character the gain is applied by the curve of a push-pull pair of remote-cutoff stages: the bias that sets the gain also bends the curve, so compression and colour come from the same element. The harmonics are odd, grow with the level and with the reduction (through a minimum near 6 dB of it), and at 1.0 a tone at -6 dBFS carries 0.08 % of them at rest, 1.4 % under 12 dB of reduction and 2.8 % under 20 dB. While it is on, the block runs frame by frame.

Other characters ignore it. Default 0 (clean).

Definition at line 1505 of file Compressor.h.

◆ setCharacterStage()

template<FloatType T>
void dspark::Compressor< T >::setCharacterStage ( StagePosition  position)
inlinenoexcept

Puts an analog colour stage before or after the compression.

The stage (Core/CharacterStage.h) is the circuit around the gain element: an emphasis shelf, two static saturators and the de-emphasis that undoes the shelf, with slow random drift, a sag that lowers the clipping point with the level and a noise floor that follows the signal; it runs oversampled to about 176 kHz and has unity gain at low levels. Before, the compressor (and its detector, unless an external key is given) hears the coloured input; After, the compressed output is coloured. A change of position crossfades over 20 ms, both ways and between the two positions. The stage adds its delay (a few samples, the polyphase IIR half-bands', 4 samples at 48 kHz) to getLatency() while it is in. With it the compressor costs 172 to 534 ns per stereo frame at 48 kHz (14 to 30 without). It runs in processBlock(); processSample() leaves it out. Safe from any thread.

State keys "stage", "stageDrive", "stageEmphasis", "stageAsymmetry", "stageDrift", "stageSag" and "stageNoise" (absent = off and the defaults of StageSettings).

Definition at line 1245 of file Compressor.h.

◆ setCharacterStageSettings()

template<FloatType T>
void dspark::Compressor< T >::setCharacterStageSettings ( const StageSettings &  settings)
inlinenoexcept

Sets drive, emphasis, asymmetry, drift, sag and noise of the colour stage. Any thread.

Definition at line 1254 of file Compressor.h.

◆ setCleanBallistics()

template<FloatType T>
void dspark::Compressor< T >::setCleanBallistics ( CleanBallistics  mode)
inlinenoexcept

Selects the Clean character's feed-forward ballistics.

Branching (default) is a single branching one-pole on the gain target. Decoupled holds the gain target's peaks and smooths the held envelope, so a sustained tone is compressed without its waveform riding the gain: THD+N of a 1 kHz tone 14 dB into 4:1 at 5/100 ms measures -102 dB, against -65.5 dB for Branching, and the gain lands on the peak-referenced static curve (Branching reads up to 0.8 dB less reduction on tones). Both honour the attack and release knobs as t63; Decoupled rounds the first part of the release (within 0.8 dB of the exponential on a 12 dB release at 5/100 ms).

Decoupled follows the peaks of dense material, so the same settings compress more: on a drum programme at the default settings the output sits 1.9 dB lower than with Branching, on a noise-like programme at -24 dB, 3:1 it sits 4.5 dB lower. Compare by ear (and retune the threshold) before switching a preset. Other characters and feedback operation are not affected; the state key is "cleanBallistics" (absent = Branching).

Definition at line 1738 of file Compressor.h.

◆ setControlLeak()

template<FloatType T>
void dspark::Compressor< T >::setControlLeak ( T  amount)
inlinenoexcept

Lets the moves of the gain leak into the audio as low thumps (0, the default, is off).

What a gain element lets through of its own control: the gain, through a high-pass of 5 Hz, is added to the output of the element. A settled gain adds nothing; every attack and every release leaves a thump under the programme, in proportion to how far the gain moved. At 1 a gain that falls at once from 1 to a half leaves a thump that starts at -32 dBFS. A feedback loop keeps reading the plain gain. While it is on, processBlock() runs frame by frame.

State key "controlLeak" (absent = 0).

Parameters
amount0 to 1. Non-finite values are ignored.

Definition at line 1653 of file Compressor.h.

◆ setControlNetwork()

template<FloatType T>
void dspark::Compressor< T >::setControlNetwork ( T  depthDb,
T  cornerHz = T(10) 
)
inlinenoexcept

A lead-lag network in the control path: only a part of each fast move of the gain is applied at once.

The gain change in decibels, after the ballistics, passes through a first-order shelf that takes depthDb off what moves faster than cornerHz and leaves what is slower as it is. Its gain at 0 Hz is 1 by construction, so the static curve does not move. Of a sudden move of the gain, 10^(-depthDb / 20) arrives at once and the rest with the time constant of the corner: an attack bites less, a release goes in two stretches, and the ripple a fast release leaves on a low tone falls by the depth, with none of the delay a low-pass adds (setGainSmoothing()). A feedback loop reads the gain before the network. A depth of 0 (the default) is off.

State keys "networkDepth" and "networkCorner" (absent = 0 and 10).

Parameters
depthDb0 to 12 dB. Non-finite values are ignored.
cornerHz1 to 100 Hz. Non-finite values keep the corner in use.

Definition at line 1580 of file Compressor.h.

◆ setDetector()

template<FloatType T>
void dspark::Compressor< T >::setDetector ( DetectorType  type)
inlinenoexcept

Changes the level detection algorithm (Peak, RMS, TruePeak, SplitPolarity, Hilbert, Hybrid).

Definition at line 1373 of file Compressor.h.

◆ setDetectorAsymmetry()

template<FloatType T>
void dspark::Compressor< T >::setDetectorAsymmetry ( T  amount)
inlinenoexcept

Makes the detector read the two halves of the wave differently (0, the default, is off).

A share of the key's own crest (its peak, held for 50 ms) is added to the key before it is rectified, and the sum is scaled back so that the half the share favours still reads the crest: the other half reads (1 - |a|) / (1 + |a|) of it. The gain then moves at the frequency of the signal and not at twice it, which gives the modulation the colour of a second harmonic, as an unbalanced rectifier does, and a signal that is not symmetric is read differently from its inverse. The level a held tone settles on is the same. It acts with the detectors that rectify the key (Peak, TruePeak and Hybrid); positive values favour the positive half. While it is on, processBlock() runs frame by frame.

State key "detectorAsymmetry" (absent = 0).

Parameters
amount-1 to +1. Non-finite values are ignored.

Definition at line 1681 of file Compressor.h.

◆ setDetectorDrift()

template<FloatType T>
void dspark::Compressor< T >::setDetectorDrift ( T  amount)
inlinenoexcept

Lets the detector's asymmetry wander slowly at random, as the balance of a rectifier does with its temperature (0, the default, holds it still).

Each channel's asymmetry moves around the one set with setDetectorAsymmetry() along a random walk smoothed twice at 0.25 Hz, by about 0.1 (one deviation) at full drift: the second harmonic of the modulation and the reading of a lopsided signal against its inverse come and go over seconds. It acts where the asymmetry does (Peak, TruePeak and Hybrid), also with the asymmetry at 0. Each channel has its own seed and the walk starts again at every reset(), so a render repeats. While it is on, processBlock() runs frame by frame.

State key "detectorDrift" (absent = 0).

Parameters
amount0 to 1. Non-finite values are ignored.

Definition at line 1708 of file Compressor.h.

◆ setFeedbackKeyed()

template<FloatType T>
void dspark::Compressor< T >::setFeedbackKeyed ( bool  on)
inlinenoexcept

In FeedBack, runs the loop on the key ahead of the audio.

A feedback compressor reads its own output, which leaves no room for a lookahead or for a key of its own: by default FeedBack (and the characters that always detect in feedback) runs without lookahead and ignores an external key. With this on, the loop is closed around the key instead (the external key when one is given, the programme otherwise, before any delay): the detector reads that key times the gain, as it would read the output, and the gain the loop settles on is applied to the audio. With the programme as the key and no lookahead that is the same compressor; and the lookahead (with its latency, its shape and the latency kept for it) and an external key now act in feedback too. Off by default.

Definition at line 1059 of file Compressor.h.

◆ setGainSmoothing()

template<FloatType T>
void dspark::Compressor< T >::setGainSmoothing ( T  ms)
inlinenoexcept

Smooths the gain after the ballistics (milliseconds; 0, the default, is off).

The gain change in decibels passes through two equal one-pole sections before it becomes gain: a second-order smoothing that rounds the corners the ballistics leave (the start of an attack, the turn into a release) and takes the ripple of the detector off the gain. The step of the two sections reaches 63 % in about the time given, so the gain arrives that much later (a lookahead of the same length puts it back). A feedback loop reads the gain before the smoothing. Values are held to [0, 50] ms; a value that is not finite is ignored.

Definition at line 1524 of file Compressor.h.

◆ setHoldMode()

template<FloatType T>
void dspark::Compressor< T >::setHoldMode ( HoldMode  mode)
inlinenoexcept

Chooses what the hold keeps (Deepest by default).

Definition at line 1412 of file Compressor.h.

◆ setHoldTime()

template<FloatType T>
void dspark::Compressor< T >::setHoldTime ( T  ms)
inlinenoexcept

Sets the gain-reduction hold time.

The deepest gain reduction is held for this long before the release stage may recover, the classic tool against pumping on dense material.

Parameters
msHold time in milliseconds (0 = off, mastering range 0-500).

Definition at line 1388 of file Compressor.h.

◆ setKnee()

template<FloatType T>
void dspark::Compressor< T >::setKnee ( T  dB)
inlinenoexcept

Sets knee width in dB (0 = hard knee, >0 = soft knee).

Definition at line 785 of file Compressor.h.

◆ setLift()

template<FloatType T>
void dspark::Compressor< T >::setLift ( T  belowDb,
T  ratio,
T  rangeDb 
)
inlinenoexcept

Sets the upward half of Mode::Both: what lies under a second, lower threshold is raised.

The lower threshold sits belowDb under the main one and moves with it; under it the level is raised with ratio (2: half the distance) up to rangeDb, with the knee of the main curve. Between the two thresholds the gain is 0 dB. A range of 0 leaves Mode::Both the same as Downward, bit for bit.

State keys "liftBelow", "liftRatio" and "liftRange" (absent = 30, 2 and 6).

Parameters
belowDbDistance of the lower threshold under the main one, 0 to 80 dB.
ratioRatio of the rise, 1 (none) to 20.
rangeDbThe most it raises, 0 to 40 dB. Non-finite values keep the one in use.

Definition at line 859 of file Compressor.h.

◆ setLinkMode()

template<FloatType T>
void dspark::Compressor< T >::setLinkMode ( LinkMode  mode)
inlinenoexcept

Chooses how a stereo pair is linked.

Loudest links to the louder channel. Dominant links to the level of the pair's dominant component: the larger eigenvalue of the covariance of the two detector levels, the correlation taken from the key over 20 ms. A source panned anywhere with an equal-power law reads the same level (a centred source reads its level in each channel, as Loudest does; panned hard it reads 3 dB less than Loudest), and two uncorrelated channels read the louder one 3 dB down, so wide ambience pushes less than a solid source of the same level. It applies to two-channel blocks with some link; other channel counts link to the loudest. Setup or any thread.

Parameters
modeLoudest (default) or Dominant.

Definition at line 906 of file Compressor.h.

◆ setLookahead()

template<FloatType T>
void dspark::Compressor< T >::setLookahead ( T  ms)
inlinenoexcept

Sets lookahead time in ms (0 = off, max = 10ms).

Warning
Automatically disabled internally if topology is set to FeedBack.

Definition at line 982 of file Compressor.h.

◆ setLookaheadShape()

template<FloatType T>
void dspark::Compressor< T >::setLookaheadShape ( LookaheadShape  shape)
inlinenoexcept

Chooses how the lookahead brings a reduction in (Lead by default).

Feed-forward, with a lookahead above 0; the ramp follows a lookahead that moves inside a latency kept for it (setMaxLookahead()). The ramp runs for the channels given to prepare().

Definition at line 1035 of file Compressor.h.

◆ setMakeupGain()

template<FloatType T>
void dspark::Compressor< T >::setMakeupGain ( T  dB)
inlinenoexcept

Sets manual static makeup gain in dB.

Definition at line 792 of file Compressor.h.

◆ setMaxLookahead()

template<FloatType T>
void dspark::Compressor< T >::setMaxLookahead ( T  ms)
inlinenoexcept

Keeps a latency of its own for the lookahead, so the lookahead can move without the latency changing.

With a maximum above 0 the audio is always that late (getLatency() reports it) and setLookahead() moves inside it: the gain is held back by the difference (which slides to its new value a quarter of a sample per sample, with no step in the gain), so the lookahead can be automated while the host keeps one delay compensation. 0 (the default) is the behaviour of before: the latency is the lookahead. FeedBack runs without lookahead and without latency either way.

Parameters
msLatency kept for the lookahead, 0 to 10 ms.

Definition at line 1002 of file Compressor.h.

◆ setMidSideFocus()

template<FloatType T>
void dspark::Compressor< T >::setMidSideFocus ( T  focus)
inlinenoexcept

In Route::MidSide, how the compression leans to the middle or to the sides, -1 to 1: at 0 (the default) each part takes its whole gain; toward -1 the sides take less of theirs (their reduction and makeup in decibels scaled by 1 + focus), at -1 only the middle is compressed and the sides come out as they went in; toward 1 the same for the middle. The detectors and the gain loop are those of the route, so the focus sweeps without a step: it moves across each block, sample by sample. Non-finite values are ignored. State key "midSideFocus" (absent = 0).

Definition at line 963 of file Compressor.h.

◆ setMix()

template<FloatType T>
void dspark::Compressor< T >::setMix ( T  dryWet)
inlinenoexcept

Sets dry/wet balance for parallel (New York) compression (1.0 = fully wet).

Definition at line 972 of file Compressor.h.

◆ setMode()

template<FloatType T>
void dspark::Compressor< T >::setMode ( Mode  mode)
inlinenoexcept

Sets the curve of the gain computer (Downward, Upward, Both or Leveler).

Definition at line 835 of file Compressor.h.

◆ setOptoCell()

template<FloatType T>
void dspark::Compressor< T >::setOptoCell ( OptoCell  cell)
inlinenoexcept

Chooses how the cell of the Opto character remembers.

ThreeStage puts a medium memory between the fast stage and the deep one: it charges over one release time (30 ms to 1 s) and lets go over five, so a phrase of a second or two leaves a tail between the quick recovery of a short peak and the long one of sustained compression. The fast stage then releases over 0.725 release times so that, fully charged, half the reduction still recovers in one release time, and the deep stage keeps the complete release of 0.5 to 5 s. The three shares of the gain are 0.6 (fast), 0.25 (medium) and 0.15 (deep). Only Opto uses it. Thread-safe; applied at the next block.

Parameters
cellTwoStage (default) or ThreeStage.

Definition at line 1472 of file Compressor.h.

◆ setPrecision()

template<FloatType T>
void dspark::Compressor< T >::setPrecision ( Precision  precision)
inlinenoexcept

Selects how finely the control signal is computed (default: Standard).

A gain that moves within a cycle of the signal has a spectrum far wider than the audio band; computed once per sample, what lies above half the rate folds back and ends as lines that are not harmonics of the signal. High works the control signal out between the samples too, the audio being left at its rate:

  • the Peak and TruePeak detectors read the key at four points per sample (the sample and three points between it and the last one, from a windowed-sinc interpolation), so the rectifier works on the waveform and not on its samples;
  • the ballistics take eight steps per sample, with the coefficients of an eighth of a sample, towards a target that moves along the line between those points (between samples for the RMS and Hilbert detectors, whose reading is already smooth); the gain is the mean of the eight.

It applies in processBlock(), in feed-forward and in the feedback loops solved against the input (the Peak detector, Downward: the FET character among them); the SplitPolarity detector and the other feedback loops stay as they are. The interpolated detectors read 7 samples late and the audio waits for them: getLatency() reports those 7 samples more with Peak or TruePeak, none with RMS or Hilbert. Change it while stopped (the delay of the audio moves at once).

Measured at 48 kHz on a tone 12 dB over the threshold of a 4:1 curve, as the largest line that is no harmonic of the tone (Standard to High). Peak detector, attack 0.1 ms, release 50 ms: -77 to -111 dBc at 1 kHz, -66 to -86 at 5 kHz, -51 to -85 at 15 kHz, -38 to -66 at 18 kHz. FET character at its 20 us attack, ratio 20, 30 dB over: -68 to -91, -50 to -66, -49 to -70 and -37 to -66. Hilbert detector: -124 to -153 at 1 kHz. The level the detector reads does not move: the gain of the tone stays within 0.1 dB in every case. The cost of a stereo frame goes from 17 to 125 ns in feed-forward and from 52 to 190 with the FET character (x64 server core).

State key "precision" (absent = Standard).

Definition at line 1204 of file Compressor.h.

◆ setProgramRelease()

template<FloatType T>
void dspark::Compressor< T >::setProgramRelease ( T  amount)
inlinenoexcept

Makes the release depend on how long the compressor has been working.

The release time becomes the knob's after a brief reduction and up to eight times the knob's after a sustained one. What tells them apart is a slow follower of the depth of the gain change against the depth itself, fifteen times as slow as the release (1.5 s at the default release of 100 ms), so that "sustained" means the same at any release: a peak that comes and goes leaves it near zero and releases at the knob's time; a passage that has kept the compressor down for ten release times or more releases slowly, so the level does not pump back up between phrases. amount weighs it (0, the default, is the fixed release).

This and the three settings that follow act on the Clean and Varimu characters in feed-forward with Branching ballistics, in every path (processBlock(), processSample() and Precision::High). Opto and FET have a memory of their own; Decoupled, feedback and the SplitPolarity detector keep fixed times.

State key "programRelease" (absent = 0).

Parameters
amount0 to 1. Non-finite values are ignored.

Definition at line 1287 of file Compressor.h.

◆ setRange()

template<FloatType T>
void dspark::Compressor< T >::setRange ( T  dB)
inlinenoexcept

Limits the maximum gain change the compressor may apply.

Classic "range" control: gain reduction (or upward boost) never exceeds this many dB regardless of how far the signal passes the threshold.

Parameters
dBMaximum |gain change| in dB (default 100 = unlimited in practice).

Definition at line 1429 of file Compressor.h.

◆ setRangeShape()

template<FloatType T>
void dspark::Compressor< T >::setRangeShape ( RangeShape  shape)
inlinenoexcept

Selects how the gain change meets the range.

Local bends the target over a stretch centred on the range, 6 dB wide (or as wide as the range, when the range is less than that): under the stretch the target is left as it is, over it it is the range exactly, and the slope is continuous at both ends. A target on the range comes out an eighth of the stretch short of it. Asymptotic, the curve of setSoftRange(), bends from much farther away: 16 % short at the range and never on it (a target of 12 dB under a range of 6 gives 5.9). The semi-implicit FeedBack loop (Peak detector) keeps the corner.

State key "rangeShape" (absent: Asymptotic or Corner, as "softRange" says).

Definition at line 1153 of file Compressor.h.

◆ setRatio()

template<FloatType T>
void dspark::Compressor< T >::setRatio ( T  ratio)
inlinenoexcept

Sets the compression ratio (1.0 = off, >20.0 = limiting).

Definition at line 742 of file Compressor.h.

◆ setReductionTone()

template<FloatType T>
void dspark::Compressor< T >::setReductionTone ( T  lowDb,
T  highDb 
)
inlinenoexcept

Makes the tone change with the reduction.

The gain then acts on a copy of the signal that has passed a nearly flat filter F, and what that copy loses is taken off the signal: y = x - (1 - g) F(x). With no reduction the output is the input, bit for bit; as the gain falls the response leans in proportion to what is taken off, as it does with a gain element that sits inside a network that depends on frequency. F is a low shelf at 200 Hz and a high shelf at 4 kHz, each with its own gain. Where F is over 0 dB the reduction is deeper than the gain asked for, and where it is under, shallower: with 12 dB of reduction, +1 dB makes it 3.9 dB deeper and -1 dB 2.4 dB shallower. A negative highDb keeps the top while the compressor works, and a negative lowDb the weight. Both at 0 (the default): off.

It does not act with the push-pull element (setCharacterColor() on Varimu), which applies the gain through its own curve, and a feedback loop keeps reading the plain gain. While it is on, processBlock() runs frame by frame instead of in the passes of the feed-forward path.

State keys "toneLow" and "toneHigh" (absent = 0).

Parameters
lowDbGain of F under 200 Hz, -3 to +3 dB. Non-finite values are ignored.
highDbGain of F over 4 kHz, -3 to +3 dB. Non-finite values are ignored.

Definition at line 1625 of file Compressor.h.

◆ setRelease()

template<FloatType T>
void dspark::Compressor< T >::setRelease ( T  ms)
inlinenoexcept

Sets the release time in milliseconds (clamped to >= 1 ms: below that the envelope stops smoothing at all and the gain path degenerates into a waveshaper).

Reads as the t63 time constant of the dB envelope for Clean/Varimu. For Opto it is the time to ~50% recovery (the slow memory tail extends up to ~35x longer); for FET it clamps to the 1176 range 50-1100 ms.

Definition at line 777 of file Compressor.h.

◆ setReleaseLanding()

template<FloatType T>
void dspark::Compressor< T >::setReleaseLanding ( T  ms)
inlinenoexcept

Makes the last decibels of a release come back slowly (milliseconds; 0, the default, is off).

After the ballistics, the gain that is heard follows them at once while the gain change deepens, and on the way back with a time that grows as it gets near: ms once it is within tenths of a decibel of the gain it follows, e times shorter for each half decibel it is behind, so that several decibels behind it is the ballistics themselves. A release starts as it did and lands softly instead of arriving with the slope of its exponential, which is where a fast release is heard to pump. A feedback loop reads the gain before it. Values are held to [0, 2000] ms; a value that is not finite is ignored.

State key "releaseLanding" (absent = 0).

Definition at line 1550 of file Compressor.h.

◆ setRemovalListen()

template<FloatType T>
void dspark::Compressor< T >::setRemovalListen ( bool  on)
inlinenoexcept

Removal listen: the output is what the compression takes out, the aligned input minus the compressed signal before the makeup gain (the mix does not apply). A monitoring control, not in the state.

Definition at line 1844 of file Compressor.h.

◆ setRmsWindow()

template<FloatType T>
void dspark::Compressor< T >::setRmsWindow ( T  ms)
inlinenoexcept

Sets the RMS analysis window size in milliseconds.

Published atomically; the audio thread applies the new window (and resets the sliding state) at its next block, so no control-thread write ever races the per-sample RMS accumulators.

In FeedBack the RMS window sits inside the loop, which cannot settle faster than its detector reports: release faster than about e x (1 + window) samples, and attack faster than half of that, settle at those bounds, the critically damped limit (observed t63 with the default 10 ms window: release 22 ms, attack 14 ms). Faster settings would overshoot and ring.

Warning
Clamped to the 1-500 ms range of the prepare() pre-allocation.

Definition at line 1864 of file Compressor.h.

◆ setRoute()

template<FloatType T>
void dspark::Compressor< T >::setRoute ( Route  route)
inlinenoexcept

Chooses what of a stereo pair is compressed, and from which part of the key.

The pair is taken as its middle, (L + R) / 2, and its sides, (L - R) / 2, compressed as the route says and put back as left and right. A key given apart is split the same way. In the routes that treat one of the two, the other waits for it (it comes out late by the latency of the gain path, so the pair stays in time) and is otherwise untouched, and the makeup acts on the part that is treated. In the two crossed routes the detector reads one part and the gain is applied to the other, as with a key given apart: a feedback loop, which reads its own output, treats that part by itself. While the key or what is removed is listened to, the part that is not treated is left out.

It acts in processBlock() on buffers of exactly two channels; any other width, and processSample(), run as Stereo. The audio thread takes a change at the next block and starts clean there (it may click: choose the route before playback).

State key "route" (absent = Stereo).

Definition at line 947 of file Compressor.h.

◆ setSidechainBand()

template<FloatType T>
void dspark::Compressor< T >::setSidechainBand ( int  band,
const KeyBand &  settings 
)
inlinenoexcept

Sets a band of the equalizer of the key.

Six bands shape what the detector weighs, after the sidechain high-pass: low and high cuts from 6 to 48 dB per octave, bells, shelves and a tilt, each designed from its analog curve. They act on whatever the detector reads (the programme, the external key or, in FeedBack, the compressed output) and never on the audio. A band that keeps its form glides to a new setting over 20 ms, designed again on the way; a change of shape crosses to a second bank of filters over the same time; a band that is Off costs nothing. The timing that follows the spectral balance (setSpectralTiming()) and the analytic makeup read the key before the equalizer.

With a two-channel key a band can sit on both channels, on the middle of the pair or on its sides (KeyBand::placement): a low cut on the middle keeps a centred kick from moving the gain while what is wide still does. The placement is that of the pair the detector reads, so under a route that already works on the middle and the sides (setRoute()) leave the bands on both. processSample() has the key one channel at a time and takes every band on every channel.

Parameters
bandBand index in [0, kKeyBands); others are ignored.
settingsShape, frequency, gain, q, slope and placement of the band.

Definition at line 1810 of file Compressor.h.

◆ setSidechainHPF()

template<FloatType T>
void dspark::Compressor< T >::setSidechainHPF ( bool  enabled,
T  cutoffHz = T(80) 
)
inlinenoexcept

Toggles the internal sidechain high-pass filter.

An invalid cutoff (non-positive or non-finite) keeps the previous frequency and only applies the toggle: a negative cutoff would make the one-pole coefficient exceed 1 (an unstable, runaway filter).

Parameters
enabledTrue to activate HPF.
cutoffHzCutoff frequency in Hz (Default: 80Hz).

Definition at line 1765 of file Compressor.h.

◆ setSidechainListen()

template<FloatType T>
void dspark::Compressor< T >::setSidechainListen ( bool  on)
inlinenoexcept

Plays the key instead of the compressed audio.

The output of each channel is what its detector hears, after the sidechain high-pass and the equalizer: the programme, the external key or, in FeedBack with a detector that keeps a memory, the compressed output of the previous sample. Through processBlock() it leaves late by the latency the compressor reports, so the track keeps its place when the listen is switched, and it is held under full scale (an equalized key can be far louder than the programme: KeyMonitor). The compressor keeps working underneath (the meter still reads). It is a monitoring switch: it is not part of the state.

Definition at line 1834 of file Compressor.h.

◆ setSoftRange()

template<FloatType T>
void dspark::Compressor< T >::setSoftRange ( bool  on)
inlinenoexcept

Makes the gain change approach the range without a corner.

With it on, a target of g dB under a range of R becomes g / (1 + (g / R)^4)^(1/4): the same as g while it is small (1.5 % less at half the range), 16 % less at the range, and never more than the range. Off (the default) the target is cut at the range. The semi-implicit FeedBack loop (Peak detector) keeps the corner.

Definition at line 1120 of file Compressor.h.

◆ setSpectralTiming()

template<FloatType T>
void dspark::Compressor< T >::setSpectralTiming ( T  amount)
inlinenoexcept

Makes attack and release follow the spectral balance of the key.

The key is measured in two bands of the same width on a logarithmic axis, 30 to 200 Hz and 2.5 to 16 kHz (what lies under 30 Hz is left out, so rumble and DC do not count), and their balance, between -1 (all low) and +1 (all high), moves both times: at full weight a bright key is followed three times faster and a dark one three times slower, and programme with the same power in every octave stays on the knobs. Short times suit a snare and long ones a bass; this sets them from what is playing. The key is the one the detector reads, before the sidechain filter. amount weighs it (0, the default, is off). Same scope as setProgramRelease().

State key "spectralTiming" (absent = 0).

Parameters
amount0 to 1. Non-finite values are ignored.

Definition at line 1338 of file Compressor.h.

◆ setState()

template<FloatType T>
bool dspark::Compressor< T >::setState ( const uint8_t *  data,
size_t  size 
)
inline

Restores parameters from a blob (tolerant; rejects foreign ids).

Definition at line 2100 of file Compressor.h.

◆ setStereoLink()

template<FloatType T>
void dspark::Compressor< T >::setStereoLink ( T  amount)
inlinenoexcept

Sets stereo linking amount (0.0 = unlinked dual mono, 1.0 = fully linked).

Definition at line 877 of file Compressor.h.

◆ setThreshold()

template<FloatType T>
void dspark::Compressor< T >::setThreshold ( T  dB)
inlinenoexcept

Sets the compression threshold in dB.

Definition at line 735 of file Compressor.h.

◆ setTopology()

template<FloatType T>
void dspark::Compressor< T >::setTopology ( Topology  topo)
inlinenoexcept

Changes signal routing topology (FeedForward or FeedBack).

Definition at line 1436 of file Compressor.h.

◆ shapesGain()

template<FloatType T>
bool dspark::Compressor< T >::shapesGain ( ) const
inlineprotectednoexcept

Whether anything stands between the ballistics and the gain: the landing, the network or the smoothing.

Definition at line 4429 of file Compressor.h.

◆ slideGainDelay()

template<FloatType T>
double dspark::Compressor< T >::slideGainDelay ( int  target)
inlineprotectednoexcept

The delay of the gain line this frame. It slides to its target kGainDelaySlide of a sample per sample, so a lookahead that moves inside the latency kept for it leaves no step in the gain (the first frame after prepare() or reset() starts at the target).

Definition at line 5231 of file Compressor.h.

◆ smoothedGain()

template<FloatType T>
T dspark::Compressor< T >::smoothedGain ( T  grDb,
int  ch 
)
inlineprotectednoexcept

One frame of what stands between the ballistics and the gain on a channel (dB): the landing of the release, the network of the control path and the two smoothing sections, those that are on.

Definition at line 4439 of file Compressor.h.

◆ solveFeedbackGain()

template<FloatType T>
FeedbackSolve dspark::Compressor< T >::solveFeedbackGain ( T  inDb,
T  k,
T  effB,
T  thresh,
T  ratio,
T  knee,
Character  charType 
) const
inlineprotectednoexcept

Solves one feedback ballistics step against the current input.

With the peak detector the level the loop will read is a known function of the gain (out = in + G), so the one-pole step G = k + effB * gel(in + G) is solved simultaneously with it, piece by piece: the element law is linear or quadratic per piece and F(G) = G - k - effB * gel(in + G) is strictly monotonic, so a piece whose solution verifies its own range IS the unique solution. This is the backward-Euler view of the analog loop (a first-order system): unconditionally stable at any attack, unlike the explicit iteration whose one-sample delay rings once the loop gain (R - 1) exceeds the ballistics speed.

Parameters
inDbInput level in dB (post link and sidechain filter).
kExplicit part of the ballistics step (coeff-weighted history).
effBImplicit weight: (1 - coeff) times the fast-stage blend.
threshThreshold parameter in dB.
ratioConfigured compression ratio.
kneeSoft-knee width parameter in dB.
charTypeCompressor character whose static law is applied.

Definition at line 4694 of file Compressor.h.

◆ solveMakeupModel()

template<FloatType T>
T dspark::Compressor< T >::solveMakeupModel ( const MakeupModelKey &  key) const
inlineprotectednoexcept

The analytic makeup: minus the gain the ballistics settle on over dense programme.

The programme is a Gaussian signal as the detector reads it. For the detectors that rectify, the magnitudes of its samples (a half normal); for TruePeak the largest of kTruePeakSamples of them (the four points between samples are not independent); for Hybrid those magnitudes held over the root of twice the mean square; for Hilbert its envelope (a Rayleigh, kEnvelopeLiftDb higher since the detector also takes the rectified sample); for the RMS window a log-normal about the RMS with the spread of windowSpreadDb(). Each level gives a target on the static curve (with the range), and the followers rest among those targets as restingGain() says: the fast stage with attack and release, the memory stage of Opto and FET with its charge and its release, the decoupled hold with an attack of one sample. A feedback loop works against the lag of the memory stage with its own gain, w (R - 1), so there that stage only counts for (1 - w) / (1 + w (R - 1)). With the automatic threshold the levels count from the peak its reference rests on; without it the programme is at kNominalRmsDb.

Definition at line 5679 of file Compressor.h.

◆ stepImplicit()

template<FloatType T>
T dspark::Compressor< T >::stepImplicit ( T  inDb,
int  ch,
Character  charType,
T  thresh,
T  ratio,
T  knee,
const LoopCoeffs &  coeffs 
)
inlineprotectednoexcept

One step of the semi-implicit loop on the channel's envelopes: the blended gain it leaves, before hold and range.

Definition at line 4763 of file Compressor.h.

◆ syncAdaptiveMakeup()

template<FloatType T>
void dspark::Compressor< T >::syncAdaptiveMakeup ( bool  adaptive)
inlineprotectednoexcept

The adaptive makeup envelope only runs while adaptive makeup is active; when it engages it starts from the current gain change (the settled value of a tracker that had kept running). Audio thread only.

Definition at line 5008 of file Compressor.h.

◆ syncAudioPath()

template<FloatType T>
bool dspark::Compressor< T >::syncAudioPath ( )
inlineprotectednoexcept

Takes the settings of the audio path that are not the plain gain (the tone that follows the reduction, the leak of the control, the asymmetry of the detector). Audio thread only.

Returns
Whether the block has to run frame by frame for any of them.

Definition at line 4323 of file Compressor.h.

◆ syncDecoupledState()

template<FloatType T>
void dspark::Compressor< T >::syncDecoupledState ( bool  decoupled)
inlineprotectednoexcept

Seats the decoupled hold stage on the current gain when the decoupled path engages (character or topology change), so the switch does not replay a stale hold value. Audio thread only.

Definition at line 5040 of file Compressor.h.

◆ syncGainSmoothing()

template<FloatType T>
void dspark::Compressor< T >::syncGainSmoothing ( bool  )
inlineprotectednoexcept

Seats each of those stages on the gain as it stands when it engages. Audio thread only.

Definition at line 4486 of file Compressor.h.

◆ syncLayerState()

template<FloatType T>
void dspark::Compressor< T >::syncLayerState ( bool  layered)
inlineprotectednoexcept

Seats the two layers on the gain as it stands when a layered character engages. Audio thread only.

Definition at line 4258 of file Compressor.h.

◆ syncPrecisionState()

template<FloatType T>
void dspark::Compressor< T >::syncPrecisionState ( bool  precise)
inlineprotectednoexcept

Seats the history of the precise path when it engages: it starts from the gain that is sounding and from silence at the detector. Audio thread only.

Definition at line 5169 of file Compressor.h.

◆ syncProgramState()

template<FloatType T>
void dspark::Compressor< T >::syncProgramState ( bool  active)
inlineprotectednoexcept

Seats the measures on the gain that is sounding when the programme-dependent timing engages. Audio thread only.

Definition at line 5399 of file Compressor.h.

◆ topologyFor()

template<FloatType T>
static constexpr Topology dspark::Compressor< T >::topologyFor ( const CharacterProfile &  profile,
Topology  asked 
)
inlinestaticconstexprprotectednoexcept

The topology a character runs in when the user asks for one.

Definition at line 4043 of file Compressor.h.

◆ updateHpfCoefficients()

template<FloatType T>
void dspark::Compressor< T >::updateHpfCoefficients ( )
inlineprotectednoexcept

Updates the normalized DC-blocker / High-pass filter coefficients.

Definition at line 5746 of file Compressor.h.

◆ updateRmsWindow()

template<FloatType T>
void dspark::Compressor< T >::updateRmsWindow ( )
inlineprotectednoexcept

Safely recalculates the RMS window size ensuring zero heap allocations.

Definition at line 5776 of file Compressor.h.

◆ updateTimeConstants()

template<FloatType T>
void dspark::Compressor< T >::updateTimeConstants ( T  fs)
inlineprotectednoexcept

Pre-calculates recursive exponential decay coefficients.

Parameters
fsCurrent sample rate.

Definition at line 3261 of file Compressor.h.

◆ useDecoupled()

template<FloatType T>
bool dspark::Compressor< T >::useDecoupled ( Character  charType,
Topology  topoEff 
) const
inlineprotectednoexcept

The Clean character in feed-forward runs the decoupled detector when setCleanBallistics() selected it.

Definition at line 5029 of file Compressor.h.

◆ usePrecision()

template<FloatType T>
bool dspark::Compressor< T >::usePrecision ( Topology  topoEff,
bool  fbImplicit,
bool  splitAdaptive 
) const
inlineprotectednoexcept

Whether the control signal runs at Precision::High with this routing: feed-forward, and feedback solved against the input.

Definition at line 5151 of file Compressor.h.

◆ weightedGain()

template<FloatType T>
static T dspark::Compressor< T >::weightedGain ( T  g,
T  w 
)
inlinestaticprotectednoexcept

A linear gain with its decibels scaled by w: 1 at w = 0, itself at w = 1.

Definition at line 3195 of file Compressor.h.

◆ windowSpreadDb()

template<FloatType T>
static double dspark::Compressor< T >::windowSpreadDb ( double  windowMs)
inlinestaticprotectednoexcept

Spread of what an RMS window reads over dense programme: the standard deviation of its level, in dB.

A fit to pink noise (equal power per octave), whose low end a short window cannot average: 1.6 dB for 10 ms, falling with the cube root of the length (measured 2.1, 1.6, 1.1, 0.7 and 0.5 dB at 3, 10, 30, 100 and 300 ms).

Definition at line 5629 of file Compressor.h.

Member Data Documentation

◆ adaptiveAttack_

template<FloatType T>
std::atomic<T> dspark::Compressor< T >::adaptiveAttack_ { T(0) }
protected

Weight of the closeness of the target on the attack.

Definition at line 6107 of file Compressor.h.

◆ adaptiveMakeupActive_

template<FloatType T>
bool dspark::Compressor< T >::adaptiveMakeupActive_ = false
protected

Adaptive makeup ran last (audio thread).

Definition at line 5969 of file Compressor.h.

◆ amount_

template<FloatType T>
std::atomic<T> dspark::Compressor< T >::amount_ { T(1) }
protected

Share of the gain change that is applied, in dB.

Definition at line 6044 of file Compressor.h.

◆ amountSmooth_

template<FloatType T>
SmoothedValue<T> dspark::Compressor< T >::amountSmooth_
protected

De-zippered amount.

Definition at line 6045 of file Compressor.h.

◆ analyticSmooth_

template<FloatType T>
SmoothedValue<T> dspark::Compressor< T >::analyticSmooth_
protected

De-zippered analytic makeup (dB).

Definition at line 6142 of file Compressor.h.

◆ asymAmount_

template<FloatType T>
T dspark::Compressor< T >::asymAmount_ = T(0)
protected

The asymmetry as the audio thread took it.

Definition at line 5930 of file Compressor.h.

◆ asymCrest_

template<FloatType T>
std::array<T, kMaxChannels> dspark::Compressor< T >::asymCrest_ {}
protected

The crest of each channel's key.

Definition at line 5932 of file Compressor.h.

◆ asymDecay_

template<FloatType T>
T dspark::Compressor< T >::asymDecay_ = T(0)
protected

Definition at line 5931 of file Compressor.h.

◆ asymDrift_

template<FloatType T>
std::array<AsymDrift, kMaxChannels> dspark::Compressor< T >::asymDrift_ {}
protected

Definition at line 5949 of file Compressor.h.

◆ asymDriftRate_

template<FloatType T>
double dspark::Compressor< T >::asymDriftRate_ = 0.0
protected

Definition at line 5948 of file Compressor.h.

◆ asymDriftScale_

template<FloatType T>
double dspark::Compressor< T >::asymDriftScale_ = 1.0
protected

Definition at line 5948 of file Compressor.h.

◆ asymNow_

template<FloatType T>
std::array<T, kMaxChannels> dspark::Compressor< T >::asymNow_ {}
protected

Each channel's asymmetry with its drift.

Definition at line 5950 of file Compressor.h.

◆ attackEmphasis_

template<FloatType T>
std::atomic<T> dspark::Compressor< T >::attackEmphasis_ { T(0) }
protected

Emphasis of the attack.

Definition at line 6109 of file Compressor.h.

◆ attackMs_

template<FloatType T>
std::atomic<T> dspark::Compressor< T >::attackMs_ { T(5) }
protected

Attack time in milliseconds.

Definition at line 5823 of file Compressor.h.

◆ attackX_

template<FloatType T>
double dspark::Compressor< T >::attackX_ = 0.0
protected

The attack as a decay per sample (-ln of its coefficient).

Definition at line 6117 of file Compressor.h.

◆ audioExtras_

template<FloatType T>
bool dspark::Compressor< T >::audioExtras_ = false
protected

The gain is not a plain product (tone or leak).

Definition at line 5951 of file Compressor.h.

◆ autoMakeupCoeff_

template<FloatType T>
T dspark::Compressor< T >::autoMakeupCoeff_ = T(0.9995)
protected

Auto-makeup tracking factor.

Definition at line 5844 of file Compressor.h.

◆ autoMakeupEnv_

template<FloatType T>
T dspark::Compressor< T >::autoMakeupEnv_ = T(0)
protected

Smoothed internal auto-makeup envelope.

Definition at line 5845 of file Compressor.h.

◆ autoMakeupMode_

template<FloatType T>
std::atomic<AutoMakeupMode> dspark::Compressor< T >::autoMakeupMode_ { AutoMakeupMode::Off }
protected

Auto-makeup behavior.

Definition at line 5834 of file Compressor.h.

◆ autoRefDb_

template<FloatType T>
std::array<double, kMaxChannels> dspark::Compressor< T >::autoRefDb_ {}
protected

That reference per channel (the linked one in slot 0), in dB.

Definition at line 6030 of file Compressor.h.

◆ autoRefFall_

template<FloatType T>
double dspark::Compressor< T >::autoRefFall_ = 0.0
protected

Its fall per sample, in dB.

Definition at line 6031 of file Compressor.h.

◆ autoThreshold_

template<FloatType T>
std::atomic<bool> dspark::Compressor< T >::autoThreshold_ { false }
protected

The threshold counts from the key's own recent peak.

Definition at line 6028 of file Compressor.h.

◆ balance_

template<FloatType T>
double dspark::Compressor< T >::balance_ = 0.0
protected

Their balance, -1 to +1.

Definition at line 6116 of file Compressor.h.

◆ balanceBands_

template<FloatType T>
std::array<BalanceBands, kMaxChannels> dspark::Compressor< T >::balanceBands_ {}
protected

Bands of the key per channel.

Definition at line 6113 of file Compressor.h.

◆ balanceHigh_

template<FloatType T>
double dspark::Compressor< T >::balanceHigh_ = 0.0
protected

Smoothed power of the high band.

Definition at line 6115 of file Compressor.h.

◆ balanceLow_

template<FloatType T>
double dspark::Compressor< T >::balanceLow_ = 0.0
protected

Smoothed power of the low band.

Definition at line 6114 of file Compressor.h.

◆ balanceRate_

template<FloatType T>
double dspark::Compressor< T >::balanceRate_ = 0.0
protected

Pole of the smoothing of the two powers.

Definition at line 6123 of file Compressor.h.

◆ cachedMakeupDb_

template<FloatType T>
T dspark::Compressor< T >::cachedMakeupDb_ = T(0)
protected

Last makeup converted by makeupToGain().

Definition at line 5846 of file Compressor.h.

◆ cachedMakeupLin_

template<FloatType T>
T dspark::Compressor< T >::cachedMakeupLin_ = T(1)
protected

Its linear gain.

Definition at line 5847 of file Compressor.h.

◆ character_

template<FloatType T>
std::atomic<Character> dspark::Compressor< T >::character_ { Character::Clean }
protected

Selected ballistics.

Definition at line 5838 of file Compressor.h.

◆ characterColor_

template<FloatType T>
std::atomic<T> dspark::Compressor< T >::characterColor_ { T(0) }
protected

Character harmonic amount (0 to 1).

Definition at line 5833 of file Compressor.h.

◆ charAttCoeff_

template<FloatType T>
double dspark::Compressor< T >::charAttCoeff_ = 0.0
protected

Attack coefficient of the fast envelope.

Definition at line 5853 of file Compressor.h.

◆ charChargeCoeff_

template<FloatType T>
double dspark::Compressor< T >::charChargeCoeff_ = 0.0
protected

History charge coefficient of the memory stage.

Definition at line 5859 of file Compressor.h.

◆ charFastWeight_

template<FloatType T>
T dspark::Compressor< T >::charFastWeight_ = T(1)
protected

Fast/slow blend (1 = single envelope).

Definition at line 5860 of file Compressor.h.

◆ charMidChargeCoeff_

template<FloatType T>
double dspark::Compressor< T >::charMidChargeCoeff_ = 0.0
protected

Charge coefficient of the medium memory.

Definition at line 5857 of file Compressor.h.

◆ charMidRelCoeff_

template<FloatType T>
double dspark::Compressor< T >::charMidRelCoeff_ = 0.0
protected

Release coefficient of the medium memory (three-stage cell).

Definition at line 5856 of file Compressor.h.

◆ charRelCoeff_

template<FloatType T>
double dspark::Compressor< T >::charRelCoeff_ = 0.0
protected

Release coefficient (fast stage).

Definition at line 5854 of file Compressor.h.

◆ charSlowRelCoeff_

template<FloatType T>
double dspark::Compressor< T >::charSlowRelCoeff_ = 0.0
protected

Release coefficient of the memory stage.

Definition at line 5855 of file Compressor.h.

◆ cleanBallistics_

template<FloatType T>
std::atomic<CleanBallistics> dspark::Compressor< T >::cleanBallistics_ { CleanBallistics::Branching }
protected

Clean feed-forward ballistics.

Definition at line 5840 of file Compressor.h.

◆ colorSmooth_

template<FloatType T>
SmoothedValue<T> dspark::Compressor< T >::colorSmooth_
protected

De-zippered character colour amount.

Definition at line 5867 of file Compressor.h.

◆ controlLeak_

template<FloatType T>
std::atomic<T> dspark::Compressor< T >::controlLeak_ { T(0) }
protected

setControlLeak().

Definition at line 5922 of file Compressor.h.

◆ decHoldCoeff_

template<FloatType T>
double dspark::Compressor< T >::decHoldCoeff_ = 0.0
protected

Decoupled hold-stage release coefficient.

Definition at line 5883 of file Compressor.h.

◆ decoupledActive_

template<FloatType T>
bool dspark::Compressor< T >::decoupledActive_ = false
protected

The decoupled path ran last (audio thread).

Definition at line 5885 of file Compressor.h.

◆ decSmoothCoeff_

template<FloatType T>
double dspark::Compressor< T >::decSmoothCoeff_ = 0.0
protected

Decoupled smoothing pole, release side.

Definition at line 5884 of file Compressor.h.

◆ detectorAsymmetry_

template<FloatType T>
std::atomic<T> dspark::Compressor< T >::detectorAsymmetry_ { T(0) }
protected

setDetectorAsymmetry().

Definition at line 5923 of file Compressor.h.

◆ detectorDrift_

template<FloatType T>
std::atomic<T> dspark::Compressor< T >::detectorDrift_ { T(0) }
protected

setDetectorDrift().

Definition at line 5946 of file Compressor.h.

◆ detectorType_

template<FloatType T>
std::atomic<DetectorType> dspark::Compressor< T >::detectorType_ { DetectorType::Peak }
protected

Selected detection method.

Definition at line 5836 of file Compressor.h.

◆ driftAmount_

template<FloatType T>
T dspark::Compressor< T >::driftAmount_ = T(0)
protected

The drift as the audio thread took it.

Definition at line 5947 of file Compressor.h.

◆ emphasisRate_

template<FloatType T>
double dspark::Compressor< T >::emphasisRate_ = 0.0
protected

Pole of the smoothing the emphasis measures against.

Definition at line 6125 of file Compressor.h.

◆ envDeepDb_

template<FloatType T>
std::array<double, kMaxChannels> dspark::Compressor< T >::envDeepDb_ {}
protected

Deep memory of the three-stage cell per channel (dB).

Definition at line 5881 of file Compressor.h.

◆ envFastDb_

template<FloatType T>
std::array<double, kMaxChannels> dspark::Compressor< T >::envFastDb_ {}
protected

Fast gain envelope per channel (dB).

Definition at line 5878 of file Compressor.h.

◆ envHoldDb_

template<FloatType T>
std::array<double, kMaxChannels> dspark::Compressor< T >::envHoldDb_ {}
protected

Decoupled hold stage per channel (dB).

Definition at line 5882 of file Compressor.h.

◆ envMidDb_

template<FloatType T>
std::array<double, kMaxChannels> dspark::Compressor< T >::envMidDb_ {}
protected

Medium memory of the three-stage cell per channel (dB).

Definition at line 5880 of file Compressor.h.

◆ envSlowDb_

template<FloatType T>
std::array<double, kMaxChannels> dspark::Compressor< T >::envSlowDb_ {}
protected

Slow memory envelope per channel (dB).

Definition at line 5879 of file Compressor.h.

◆ fbLastOutput_

template<FloatType T>
std::array<T, kMaxChannels> dspark::Compressor< T >::fbLastOutput_ {}
protected

Feedback topology history buffer.

Definition at line 5972 of file Compressor.h.

◆ feedbackKeyed_

template<FloatType T>
std::atomic<bool> dspark::Compressor< T >::feedbackKeyed_ { false }
protected

A feedback loop runs on the key ahead of the audio.

Definition at line 6039 of file Compressor.h.

◆ fetDcCoeff_

template<FloatType T>
T dspark::Compressor< T >::fetDcCoeff_ = T(0)
protected

~10 Hz DC-tracking coefficient.

Definition at line 5873 of file Compressor.h.

◆ fetDcState_

template<FloatType T>
std::array<T, kMaxChannels> dspark::Compressor< T >::fetDcState_ {}
protected

Per-channel DC estimate of wet^2.

Definition at line 5874 of file Compressor.h.

◆ gainDelay_

template<FloatType T>
std::array<RingBuffer<T>, kMaxChannels> dspark::Compressor< T >::gainDelay_ {}
protected

Holds the gain back while the lookahead is shorter than the latency.

Definition at line 6034 of file Compressor.h.

◆ gainDelayNow_

template<FloatType T>
double dspark::Compressor< T >::gainDelayNow_ = -1.0
protected

The gain line's delay now, in samples (negative: not started).

Definition at line 6036 of file Compressor.h.

◆ gainReductionDb_

template<FloatType T>
std::atomic<T> dspark::Compressor< T >::gainReductionDb_ { T(0) }
protected

Publicly readable Gain Reduction meter.

Definition at line 6146 of file Compressor.h.

◆ gainSmoothA_

template<FloatType T>
std::array<double, kMaxChannels> dspark::Compressor< T >::gainSmoothA_ {}
protected

Definition at line 5902 of file Compressor.h.

◆ gainSmoothActive_

template<FloatType T>
bool dspark::Compressor< T >::gainSmoothActive_ = false
protected

The smoothing ran last (audio thread).

Definition at line 5904 of file Compressor.h.

◆ gainSmoothB_

template<FloatType T>
std::array<double, kMaxChannels> dspark::Compressor< T >::gainSmoothB_ {}
protected

Definition at line 5903 of file Compressor.h.

◆ gainSmoothMs_

template<FloatType T>
std::atomic<T> dspark::Compressor< T >::gainSmoothMs_ { T(0) }
protected

Smoothing of the gain (0: off).

Definition at line 5900 of file Compressor.h.

◆ gainSmoothRate_

template<FloatType T>
double dspark::Compressor< T >::gainSmoothRate_ = 0.0
protected

Coefficient of each of its two sections (0: off).

Definition at line 5901 of file Compressor.h.

◆ heldGrDb_

template<FloatType T>
std::array<T, kMaxChannels> dspark::Compressor< T >::heldGrDb_ {}
protected

Definition at line 6020 of file Compressor.h.

◆ highRate_

template<FloatType T>
double dspark::Compressor< T >::highRate_ = 0.0
protected

Pole of the split at kBalanceCeilingHz.

Definition at line 6122 of file Compressor.h.

◆ hilbertDetectors_

template<FloatType T>
std::array<HilbertIIR<double>, kMaxChannels> dspark::Compressor< T >::hilbertDetectors_ {}
protected

Zero-latency analytic pairs for detection.

Definition at line 5979 of file Compressor.h.

◆ holdCounters_

template<FloatType T>
std::array<int, kMaxChannels> dspark::Compressor< T >::holdCounters_ {}
protected

Definition at line 6019 of file Compressor.h.

◆ holdEveryPeak_

template<FloatType T>
bool dspark::Compressor< T >::holdEveryPeak_ = false
protected

The hold mode as the audio thread took it.

Definition at line 6024 of file Compressor.h.

◆ holdMode_

template<FloatType T>
std::atomic<HoldMode> dspark::Compressor< T >::holdMode_ { HoldMode::Deepest }
protected

Definition at line 6021 of file Compressor.h.

◆ holdMs_

template<FloatType T>
std::atomic<T> dspark::Compressor< T >::holdMs_ { T(0) }
protected

Gain-hold time in ms (0 = off).

Definition at line 6016 of file Compressor.h.

◆ holdSamples_

template<FloatType T>
int dspark::Compressor< T >::holdSamples_ = 0
protected

Definition at line 6018 of file Compressor.h.

◆ holdWindowFor_

template<FloatType T>
int dspark::Compressor< T >::holdWindowFor_ = -1
protected

The hold length the windows are set for.

Definition at line 6023 of file Compressor.h.

◆ holdWindows_

template<FloatType T>
std::unique_ptr<SlidingDeepest[]> dspark::Compressor< T >::holdWindows_
protected

One window per gain computer (HoldMode::EveryPeak).

Definition at line 6022 of file Compressor.h.

◆ hybridMeanSq_

template<FloatType T>
std::array<double, kMaxChannels> dspark::Compressor< T >::hybridMeanSq_ {}
protected

Mean square of the key.

Definition at line 6128 of file Compressor.h.

◆ hybridRate_

template<FloatType T>
double dspark::Compressor< T >::hybridRate_ = 0.0
protected

Its pole (the time of the RMS window).

Definition at line 6129 of file Compressor.h.

◆ interp_

template<FloatType T>
std::array<InterpHistory, kMaxChannels> dspark::Compressor< T >::interp_ {}
protected

Their history per channel.

Definition at line 6076 of file Compressor.h.

◆ interpPhase_

template<FloatType T>
T dspark::Compressor< T >::interpPhase_[kDetectorPoints - 1][kInterpTaps] = {}
protected

Interpolation phases (prepare()).

Definition at line 6075 of file Compressor.h.

◆ kAsymCrestSeconds

template<FloatType T>
constexpr double dspark::Compressor< T >::kAsymCrestSeconds = 0.05
staticconstexprprotected

Fall of the crest the asymmetric detector adds.

Definition at line 5920 of file Compressor.h.

◆ kAsymDrift

template<FloatType T>
constexpr double dspark::Compressor< T >::kAsymDrift = 0.1
staticconstexprprotected

Deviation of the asymmetry at full drift.

Definition at line 5934 of file Compressor.h.

◆ kAsymDriftHz

template<FloatType T>
constexpr double dspark::Compressor< T >::kAsymDriftHz = 0.25
staticconstexprprotected

Corner of each of the walk's two smoothings.

Definition at line 5935 of file Compressor.h.

◆ kAsymDriftTick

template<FloatType T>
constexpr int dspark::Compressor< T >::kAsymDriftTick = 64
staticconstexprprotected

Frames between draws.

Definition at line 5936 of file Compressor.h.

◆ kAttackStretch

template<FloatType T>
constexpr double dspark::Compressor< T >::kAttackStretch = 3.0
staticconstexprprotected

The attack grows up to 1 + this.

Definition at line 6095 of file Compressor.h.

◆ kAutoRefFallDb

template<FloatType T>
constexpr double dspark::Compressor< T >::kAutoRefFallDb = 1.0
staticconstexprprotected

dB per second the reference of the automatic threshold falls.

Definition at line 6027 of file Compressor.h.

◆ kBalanceCeilingHz

template<FloatType T>
constexpr double dspark::Compressor< T >::kBalanceCeilingHz = 16000.0
staticconstexprprotected

And ends here.

Definition at line 6103 of file Compressor.h.

◆ kBalanceFloorHz

template<FloatType T>
constexpr double dspark::Compressor< T >::kBalanceFloorHz = 30.0
staticconstexprprotected

The low band of the balance starts here.

Definition at line 6100 of file Compressor.h.

◆ kBalanceHighHz

template<FloatType T>
constexpr double dspark::Compressor< T >::kBalanceHighHz = 2500.0
staticconstexprprotected

The high band starts here.

Definition at line 6102 of file Compressor.h.

◆ kBalanceLowHz

template<FloatType T>
constexpr double dspark::Compressor< T >::kBalanceLowHz = 200.0
staticconstexprprotected

And ends here.

Definition at line 6101 of file Compressor.h.

◆ kBalanceSeconds

template<FloatType T>
constexpr double dspark::Compressor< T >::kBalanceSeconds = 0.05
staticconstexprprotected

Smoothing of the two powers.

Definition at line 6104 of file Compressor.h.

◆ kBalanceSilence

template<FloatType T>
constexpr double dspark::Compressor< T >::kBalanceSilence = 1e-24
staticconstexprprotected

Summed power under which the balance is 0.

Definition at line 6105 of file Compressor.h.

◆ kChunk

template<FloatType T>
constexpr int dspark::Compressor< T >::kChunk = 32
staticconstexprprotected

Frames per pass of the feed-forward path.

Definition at line 2630 of file Compressor.h.

◆ kDetectorDelay

template<FloatType T>
constexpr int dspark::Compressor< T >::kDetectorDelay = kInterpTaps / 2 - 1
staticconstexprprotected

Samples those points are late.

Definition at line 6054 of file Compressor.h.

◆ kDetectorPoints

template<FloatType T>
constexpr int dspark::Compressor< T >::kDetectorPoints = 4
staticconstexprprotected

Points the rectifying detectors read per sample there.

Definition at line 6052 of file Compressor.h.

◆ kEmphasisAttacks

template<FloatType T>
constexpr double dspark::Compressor< T >::kEmphasisAttacks = 6.0
staticconstexprprotected

Smoothing the emphasis of the attack measures against, in attack times.

Definition at line 6097 of file Compressor.h.

◆ kEmphasisCeilSeconds

template<FloatType T>
constexpr double dspark::Compressor< T >::kEmphasisCeilSeconds = 0.5
staticconstexprprotected

nor longer than this.

Definition at line 6099 of file Compressor.h.

◆ kEmphasisFloorSeconds

template<FloatType T>
constexpr double dspark::Compressor< T >::kEmphasisFloorSeconds = 0.002
staticconstexprprotected

It is never shorter than this,.

Definition at line 6098 of file Compressor.h.

◆ kEnvelopeLiftDb

template<FloatType T>
constexpr double dspark::Compressor< T >::kEnvelopeLiftDb = 0.6
staticconstexprprotected

What the Hilbert detector reads over the envelope (dB).

Definition at line 6140 of file Compressor.h.

◆ kEnvelopeReferenceDb

template<FloatType T>
constexpr double dspark::Compressor< T >::kEnvelopeReferenceDb = 13.2
staticconstexprprotected

The same for the Hilbert detector.

Definition at line 6138 of file Compressor.h.

◆ keyEq_

template<FloatType T>
KeyEq dspark::Compressor< T >::keyEq_
protected

Equalizer of the key, after the high-pass.

Definition at line 5989 of file Compressor.h.

◆ keyMonitor_

template<FloatType T>
KeyMonitor<T, 16> dspark::Compressor< T >::keyMonitor_
protected

The listened key: late by the latency, under full scale.

Definition at line 5990 of file Compressor.h.

◆ kFetColorH2

template<FloatType T>
constexpr T dspark::Compressor< T >::kFetColorH2 = T(0.028)
staticconstexprprotected

Definition at line 5872 of file Compressor.h.

◆ kFullAttackDb

template<FloatType T>
constexpr double dspark::Compressor< T >::kFullAttackDb = 6.0
staticconstexprprotected

Distance to the target from which the attack is the knob's.

Definition at line 6096 of file Compressor.h.

◆ kGainDelaySlide

template<FloatType T>
constexpr double dspark::Compressor< T >::kGainDelaySlide = 0.25
staticconstexprprotected

Samples per sample the gain line's delay moves to a new lookahead.

Definition at line 6035 of file Compressor.h.

◆ kInterpBeta

template<FloatType T>
constexpr double dspark::Compressor< T >::kInterpBeta = 6.5
staticconstexprprotected

Kaiser window of the interpolation.

Definition at line 6055 of file Compressor.h.

◆ kInterpTaps

template<FloatType T>
constexpr int dspark::Compressor< T >::kInterpTaps = 16
staticconstexprprotected

Samples each point between samples is read from.

Definition at line 6053 of file Compressor.h.

◆ kKeyBands

template<FloatType T>
constexpr int dspark::Compressor< T >::kKeyBands = KeyEq::kBands
staticconstexpr

Bands of the key equalizer.

Definition at line 1783 of file Compressor.h.

◆ kLandingPaceDb

template<FloatType T>
constexpr double dspark::Compressor< T >::kLandingPaceDb = 0.5
staticconstexprprotected

Decibels behind that make the landing e times faster.

Definition at line 5905 of file Compressor.h.

◆ kLeakCornerHz

template<FloatType T>
constexpr double dspark::Compressor< T >::kLeakCornerHz = 5.0
staticconstexprprotected

High-pass the gain leaks through.

Definition at line 5918 of file Compressor.h.

◆ kLeakLevel

template<FloatType T>
constexpr double dspark::Compressor< T >::kLeakLevel = 0.05
staticconstexprprotected

What a gain that moves by 1 leaks, at an amount of 1.

Definition at line 5919 of file Compressor.h.

◆ kLocalRangeStretchDb

template<FloatType T>
constexpr double dspark::Compressor< T >::kLocalRangeStretchDb = 6.0
staticconstexprprotected

Width of the bend of RangeShape::Local, at most.

Definition at line 6047 of file Compressor.h.

◆ kMakeupLimitDb

template<FloatType T>
constexpr double dspark::Compressor< T >::kMakeupLimitDb = 40.0
staticconstexprprotected

Bound of the result (dB).

Definition at line 6141 of file Compressor.h.

◆ kMakeupNodes

template<FloatType T>
constexpr int dspark::Compressor< T >::kMakeupNodes = 48
staticconstexprprotected

Levels of the programme that are weighed.

Definition at line 6132 of file Compressor.h.

◆ kMakeupReach

template<FloatType T>
constexpr double dspark::Compressor< T >::kMakeupReach = 4.8
staticconstexprprotected

They reach this many times its RMS.

Definition at line 6133 of file Compressor.h.

◆ kMaxChannels

template<FloatType T>
constexpr int dspark::Compressor< T >::kMaxChannels = 16
staticconstexprprotected

Definition at line 2169 of file Compressor.h.

◆ kneeSmooth_

template<FloatType T>
SmoothedValue<T> dspark::Compressor< T >::kneeSmooth_
protected

De-zippered knee.

Definition at line 5864 of file Compressor.h.

◆ kneeWidth_

template<FloatType T>
std::atomic<T> dspark::Compressor< T >::kneeWidth_ { T(0) }
protected

Knee width in dB.

Definition at line 5825 of file Compressor.h.

◆ kNoLimit

template<FloatType T>
constexpr T dspark::Compressor< T >::kNoLimit = std::numeric_limits<T>::infinity()
staticconstexprprotected

Definition at line 3985 of file Compressor.h.

◆ kNominalRmsDb

template<FloatType T>
constexpr double dspark::Compressor< T >::kNominalRmsDb = -18.0
staticconstexprprotected

RMS the programme is taken at (dBFS).

Definition at line 6134 of file Compressor.h.

◆ kOptoMidCharge

template<FloatType T>
constexpr double dspark::Compressor< T >::kOptoMidCharge = 1.0
staticconstexprprotected

Definition at line 3996 of file Compressor.h.

◆ kOptoMidChargeCeilMs

template<FloatType T>
constexpr double dspark::Compressor< T >::kOptoMidChargeCeilMs = 1000.0
staticconstexprprotected

Definition at line 3998 of file Compressor.h.

◆ kOptoMidChargeFloorMs

template<FloatType T>
constexpr double dspark::Compressor< T >::kOptoMidChargeFloorMs = 30.0
staticconstexprprotected

Definition at line 3997 of file Compressor.h.

◆ kOptoMidRelease

template<FloatType T>
constexpr double dspark::Compressor< T >::kOptoMidRelease = 5.0
staticconstexprprotected

Definition at line 3995 of file Compressor.h.

◆ kOptoMidShare

template<FloatType T>
constexpr double dspark::Compressor< T >::kOptoMidShare = 0.625
staticconstexprprotected

Definition at line 3994 of file Compressor.h.

◆ kOptoThreeFastRelease

template<FloatType T>
constexpr double dspark::Compressor< T >::kOptoThreeFastRelease = 0.725
staticconstexprprotected

Definition at line 3993 of file Compressor.h.

◆ kPeakReferenceDb

template<FloatType T>
constexpr double dspark::Compressor< T >::kPeakReferenceDb = 12.35
staticconstexprprotected

Automatic-threshold reference over the RMS, rectified.

Definition at line 6136 of file Compressor.h.

◆ kProfiles

template<FloatType T>
constexpr std::array<CharacterProfile, 5> dspark::Compressor< T >::kProfiles
staticconstexprprotected

The characters, in the order of Character.

Definition at line 4001 of file Compressor.h.

◆ kPushPullDrive

template<FloatType T>
constexpr double dspark::Compressor< T >::kPushPullDrive = 2.0
staticconstexprprotected

Definition at line 5897 of file Compressor.h.

◆ kPushPullRest

template<FloatType T>
constexpr double dspark::Compressor< T >::kPushPullRest = 0.98
staticconstexprprotected

Definition at line 5896 of file Compressor.h.

◆ kReductionToneHighHz

template<FloatType T>
constexpr double dspark::Compressor< T >::kReductionToneHighHz = 4000.0
staticconstexpr

Corner of its high shelf, in Hz.

Definition at line 1598 of file Compressor.h.

◆ kReductionToneLowHz

template<FloatType T>
constexpr double dspark::Compressor< T >::kReductionToneLowHz = 200.0
staticconstexpr

Corner of the low shelf of the tone that follows the reduction, in Hz (setReductionTone()).

Definition at line 1596 of file Compressor.h.

◆ kReleaseStretch

template<FloatType T>
constexpr double dspark::Compressor< T >::kReleaseStretch = 7.0
staticconstexprprotected

The release grows up to 1 + this.

Definition at line 6094 of file Compressor.h.

◆ kRmsRecomputePeriod

template<FloatType T>
constexpr int dspark::Compressor< T >::kRmsRecomputePeriod = 4096
staticconstexprprotected

Re-summation interval to halt drift.

Definition at line 6009 of file Compressor.h.

◆ kStageKeyRoom

template<FloatType T>
constexpr int dspark::Compressor< T >::kStageKeyRoom = 64
staticconstexprprotected

Samples kept for the colour stage's latency in the listened key.

Definition at line 5991 of file Compressor.h.

◆ kSubsteps

template<FloatType T>
constexpr int dspark::Compressor< T >::kSubsteps = 8
staticconstexprprotected

Steps of the ballistics per sample at Precision::High.

Definition at line 6051 of file Compressor.h.

◆ kSustainCeilSeconds

template<FloatType T>
constexpr double dspark::Compressor< T >::kSustainCeilSeconds = 60.0
staticconstexprprotected

nor longer than this.

Definition at line 6092 of file Compressor.h.

◆ kSustainedOverRmsDb

template<FloatType T>
constexpr double dspark::Compressor< T >::kSustainedOverRmsDb = 10.0
staticconstexprprotected

Its sustained level over the RMS (Upward guard, dB).

Definition at line 6135 of file Compressor.h.

◆ kSustainFloorDb

template<FloatType T>
constexpr double dspark::Compressor< T >::kSustainFloorDb = 0.5
staticconstexprprotected

Depth under which a reduction does not count as sustained.

Definition at line 6093 of file Compressor.h.

◆ kSustainFloorSeconds

template<FloatType T>
constexpr double dspark::Compressor< T >::kSustainFloorSeconds = 0.1
staticconstexprprotected

It is never shorter than this,.

Definition at line 6091 of file Compressor.h.

◆ kSustainReleases

template<FloatType T>
constexpr double dspark::Compressor< T >::kSustainReleases = 15.0
staticconstexprprotected

Follower of the depth of the gain change, in release times.

Definition at line 6090 of file Compressor.h.

◆ kTruePeakReferenceDb

template<FloatType T>
constexpr double dspark::Compressor< T >::kTruePeakReferenceDb = 12.5
staticconstexprprotected

The same for TruePeak.

Definition at line 6137 of file Compressor.h.

◆ kTruePeakSamples

template<FloatType T>
constexpr double dspark::Compressor< T >::kTruePeakSamples = 2.6
staticconstexprprotected

Independent samples the TruePeak reading is the largest of.

Definition at line 6139 of file Compressor.h.

◆ landingActive_

template<FloatType T>
bool dspark::Compressor< T >::landingActive_ = false
protected

Definition at line 5909 of file Compressor.h.

◆ landingDb_

template<FloatType T>
std::array<double, kMaxChannels> dspark::Compressor< T >::landingDb_ {}
protected

Definition at line 5908 of file Compressor.h.

◆ landingMs_

template<FloatType T>
std::atomic<T> dspark::Compressor< T >::landingMs_ { T(0) }
protected

Landing of the release (0: off).

Definition at line 5906 of file Compressor.h.

◆ landingRate_

template<FloatType T>
double dspark::Compressor< T >::landingRate_ = 0.0
protected

Its coefficient when it is on the gain it follows (0: off).

Definition at line 5907 of file Compressor.h.

◆ latencyKept_

template<FloatType T>
bool dspark::Compressor< T >::latencyKept_ = false
protected

A latency is kept for the lookahead (audio thread).

Definition at line 6037 of file Compressor.h.

◆ latencySamples_

template<FloatType T>
int dspark::Compressor< T >::latencySamples_ = 0
protected

Delay of the audio in feed-forward (audio thread).

Definition at line 6033 of file Compressor.h.

◆ layerAttRate_

template<FloatType T>
double dspark::Compressor< T >::layerAttRate_ = 0.0
protected

Definition at line 5891 of file Compressor.h.

◆ layeredActive_

template<FloatType T>
bool dspark::Compressor< T >::layeredActive_ = false
protected

The layers ran last (audio thread).

Definition at line 5892 of file Compressor.h.

◆ layerLevelDb_

template<FloatType T>
std::array<double, kMaxChannels> dspark::Compressor< T >::layerLevelDb_ {}
protected

Definition at line 5889 of file Compressor.h.

◆ layerPeakDb_

template<FloatType T>
std::array<double, kMaxChannels> dspark::Compressor< T >::layerPeakDb_ {}
protected

Definition at line 5890 of file Compressor.h.

◆ layerRelRate_

template<FloatType T>
double dspark::Compressor< T >::layerRelRate_ = 0.0
protected

Definition at line 5891 of file Compressor.h.

◆ leakAmount_

template<FloatType T>
T dspark::Compressor< T >::leakAmount_ = T(0)
protected

The leak as the audio thread took it.

Definition at line 5927 of file Compressor.h.

◆ leakBase_

template<FloatType T>
std::array<T, kMaxChannels> dspark::Compressor< T >::leakBase_ {}
protected

The slow copy of each channel's gain.

Definition at line 5929 of file Compressor.h.

◆ leakCoeff_

template<FloatType T>
T dspark::Compressor< T >::leakCoeff_ = T(0)
protected

Definition at line 5928 of file Compressor.h.

◆ liftBelow_

template<FloatType T>
std::atomic<T> dspark::Compressor< T >::liftBelow_ { T(30) }
protected

Definition at line 5967 of file Compressor.h.

◆ liftBelowDb_

template<FloatType T>
T dspark::Compressor< T >::liftBelowDb_ = T(30)
protected

Definition at line 5968 of file Compressor.h.

◆ liftRange_

template<FloatType T>
std::atomic<T> dspark::Compressor< T >::liftRange_ { T(6) }
protected

Definition at line 5967 of file Compressor.h.

◆ liftRangeDb_

template<FloatType T>
T dspark::Compressor< T >::liftRangeDb_ = T(6)
protected

Definition at line 5968 of file Compressor.h.

◆ liftRatio_

template<FloatType T>
std::atomic<T> dspark::Compressor< T >::liftRatio_ { T(2) }
protected

Definition at line 5967 of file Compressor.h.

◆ liftRatioIn_

template<FloatType T>
T dspark::Compressor< T >::liftRatioIn_ = T(2)
protected

Definition at line 5968 of file Compressor.h.

◆ linkCoeff_

template<FloatType T>
double dspark::Compressor< T >::linkCoeff_ = 0.0
protected

One-pole coefficient of the key's covariance (20 ms).

Definition at line 5829 of file Compressor.h.

◆ linkLL_

template<FloatType T>
double dspark::Compressor< T >::linkLL_ = 0.0
protected

Definition at line 5830 of file Compressor.h.

◆ linkLR_

template<FloatType T>
double dspark::Compressor< T >::linkLR_ = 0.0
protected

The key's covariance (dominant link).

Definition at line 5830 of file Compressor.h.

◆ linkMode_

template<FloatType T>
std::atomic<LinkMode> dspark::Compressor< T >::linkMode_ { LinkMode::Loudest }
protected

What the linked level reads.

Definition at line 5828 of file Compressor.h.

◆ linkRR_

template<FloatType T>
double dspark::Compressor< T >::linkRR_ = 0.0
protected

Definition at line 5830 of file Compressor.h.

◆ lookaheadBuffers_

template<FloatType T>
std::array<RingBuffer<T>, kMaxChannels> dspark::Compressor< T >::lookaheadBuffers_ {}
protected

Lookahead delay lines.

Definition at line 5976 of file Compressor.h.

◆ lookaheadMs_

template<FloatType T>
std::atomic<T> dspark::Compressor< T >::lookaheadMs_ { T(0) }
protected

Lookahead latency target in ms.

Definition at line 5832 of file Compressor.h.

◆ lookaheadRamps_

template<FloatType T>
std::vector<LookaheadRamp> dspark::Compressor< T >::lookaheadRamps_
protected

One ramp per gain computer of the layout (LookaheadShape::Ramp).

Definition at line 6040 of file Compressor.h.

◆ lookaheadSamples_

template<FloatType T>
int dspark::Compressor< T >::lookaheadSamples_ = 0
protected

Active lookahead latency in samples.

Definition at line 5977 of file Compressor.h.

◆ lookaheadShape_

template<FloatType T>
std::atomic<LookaheadShape> dspark::Compressor< T >::lookaheadShape_ { LookaheadShape::Lead }
protected

Definition at line 6038 of file Compressor.h.

◆ lowRate_

template<FloatType T>
double dspark::Compressor< T >::lowRate_ = 0.0
protected

Pole of the split at kBalanceLowHz.

Definition at line 6120 of file Compressor.h.

◆ makeupGain_

template<FloatType T>
std::atomic<T> dspark::Compressor< T >::makeupGain_ { T(0) }
protected

Static makeup gain in dB.

Definition at line 5826 of file Compressor.h.

◆ makeupKey_

template<FloatType T>
MakeupModelKey dspark::Compressor< T >::makeupKey_ {}
protected

Settings of the cached result.

Definition at line 6143 of file Compressor.h.

◆ makeupModelDb_

template<FloatType T>
T dspark::Compressor< T >::makeupModelDb_ = T(0)
protected

The cached result (dB).

Definition at line 6144 of file Compressor.h.

◆ makeupSmooth_

template<FloatType T>
SmoothedValue<T> dspark::Compressor< T >::makeupSmooth_
protected

De-zippered makeup gain (dB).

Definition at line 5865 of file Compressor.h.

◆ maxLookaheadMs_

template<FloatType T>
std::atomic<T> dspark::Compressor< T >::maxLookaheadMs_ { T(0) }
protected

Latency kept for the lookahead (0: the lookahead itself).

Definition at line 6032 of file Compressor.h.

◆ midRate_

template<FloatType T>
double dspark::Compressor< T >::midRate_ = 0.0
protected

Pole of the split at kBalanceHighHz.

Definition at line 6121 of file Compressor.h.

◆ midSideFocus_

template<FloatType T>
std::atomic<T> dspark::Compressor< T >::midSideFocus_ { T(0) }
protected

Definition at line 5955 of file Compressor.h.

◆ mix_

template<FloatType T>
std::atomic<T> dspark::Compressor< T >::mix_ { T(1) }
protected

Wet/Dry mix (1 = full wet).

Definition at line 5831 of file Compressor.h.

◆ mixSmooth_

template<FloatType T>
SmoothedValue<T> dspark::Compressor< T >::mixSmooth_
protected

De-zippered parallel mix.

Definition at line 5866 of file Compressor.h.

◆ mode_

template<FloatType T>
std::atomic<Mode> dspark::Compressor< T >::mode_ { Mode::Downward }
protected

Selected compression mode.

Definition at line 5841 of file Compressor.h.

◆ networkActive_

template<FloatType T>
bool dspark::Compressor< T >::networkActive_ = false
protected

Definition at line 5915 of file Compressor.h.

◆ networkCornerHz_

template<FloatType T>
std::atomic<T> dspark::Compressor< T >::networkCornerHz_ { T(10) }
protected

Its corner.

Definition at line 5911 of file Compressor.h.

◆ networkDepthDb_

template<FloatType T>
std::atomic<T> dspark::Compressor< T >::networkDepthDb_ { T(0) }
protected

Depth of the network of the control path (0: off).

Definition at line 5910 of file Compressor.h.

◆ networkLow_

template<FloatType T>
std::array<double, kMaxChannels> dspark::Compressor< T >::networkLow_ {}
protected

Definition at line 5914 of file Compressor.h.

◆ networkRate_

template<FloatType T>
double dspark::Compressor< T >::networkRate_ = 0.0
protected

Coefficient of its low-pass.

Definition at line 5913 of file Compressor.h.

◆ networkShare_

template<FloatType T>
double dspark::Compressor< T >::networkShare_ = 1.0
protected

Share of a fast move applied at once (1: off).

Definition at line 5912 of file Compressor.h.

◆ optoCell_

template<FloatType T>
std::atomic<OptoCell> dspark::Compressor< T >::optoCell_ { OptoCell::TwoStage }
protected

Cell of the Opto character.

Definition at line 5839 of file Compressor.h.

◆ parted_

template<FloatType T>
bool dspark::Compressor< T >::parted_ = false
protected

Definition at line 5959 of file Compressor.h.

◆ partFrom_

template<FloatType T>
std::array<T, 2> dspark::Compressor< T >::partFrom_ { T(1), T(1) }
protected

Definition at line 5958 of file Compressor.h.

◆ partTo_

template<FloatType T>
std::array<T, 2> dspark::Compressor< T >::partTo_ { T(1), T(1) }
protected

Definition at line 5958 of file Compressor.h.

◆ peakAttRate_

template<FloatType T>
double dspark::Compressor< T >::peakAttRate_ = 0.0
protected

Definition at line 5891 of file Compressor.h.

◆ peakRelRate_

template<FloatType T>
double dspark::Compressor< T >::peakRelRate_ = 0.0
protected

Definition at line 5891 of file Compressor.h.

◆ pointLevelDb_

template<FloatType T>
std::array<std::array<T, 4>, kMaxChannels> dspark::Compressor< T >::pointLevelDb_ {}
protected

Detected level per channel and point of the frame (dB).

Definition at line 5974 of file Compressor.h.

◆ precision_

template<FloatType T>
std::atomic<Precision> dspark::Compressor< T >::precision_ { Precision::Standard }
protected

How finely the control signal is computed.

Definition at line 6063 of file Compressor.h.

◆ precisionActive_

template<FloatType T>
bool dspark::Compressor< T >::precisionActive_ = false
protected

The precise path ran last (audio thread).

Definition at line 6064 of file Compressor.h.

◆ precLevel_

template<FloatType T>
std::array<double, kMaxChannels> dspark::Compressor< T >::precLevel_ {}
protected

Last level of the solved loop (dB).

Definition at line 6077 of file Compressor.h.

◆ precTarget_

template<FloatType T>
std::array<double, kMaxChannels> dspark::Compressor< T >::precTarget_ {}
protected

Last gain target, after hold and range (dB).

Definition at line 6078 of file Compressor.h.

◆ program_

template<FloatType T>
ProgramTiming dspark::Compressor< T >::program_ {}
protected

The weights of the block (audio thread).

Definition at line 6110 of file Compressor.h.

◆ programActive_

template<FloatType T>
bool dspark::Compressor< T >::programActive_ = false
protected

They acted last (audio thread).

Definition at line 6111 of file Compressor.h.

◆ programRelease_

template<FloatType T>
std::atomic<T> dspark::Compressor< T >::programRelease_ { T(0) }
protected

Weight of the sustained reduction on the release.

Definition at line 6106 of file Compressor.h.

◆ programState_

template<FloatType T>
std::array<ProgramState, kMaxChannels> dspark::Compressor< T >::programState_ {}
protected

Measures per gain computer.

Definition at line 6112 of file Compressor.h.

◆ rampActive_

template<FloatType T>
bool dspark::Compressor< T >::rampActive_ = false
protected

The ramp ran in the last block.

Definition at line 6043 of file Compressor.h.

◆ rampCount_

template<FloatType T>
int dspark::Compressor< T >::rampCount_ = 0
protected

Ramps prepared.

Definition at line 6041 of file Compressor.h.

◆ rampShape_

template<FloatType T>
bool dspark::Compressor< T >::rampShape_ = false
protected

The shape as the audio thread took it.

Definition at line 6042 of file Compressor.h.

◆ rangeDb_

template<FloatType T>
std::atomic<T> dspark::Compressor< T >::rangeDb_ { T(100) }
protected

Max |gain change| in dB.

Definition at line 6017 of file Compressor.h.

◆ rangeShape_

template<FloatType T>
std::atomic<int> dspark::Compressor< T >::rangeShape_ { 0 }
protected

How the gain change meets the range (a RangeShape).

Definition at line 6046 of file Compressor.h.

◆ ratio_

template<FloatType T>
std::atomic<T> dspark::Compressor< T >::ratio_ { T(4) }
protected

Ratio (e.g., 4 = 4:1).

Definition at line 5822 of file Compressor.h.

◆ ratioSmooth_

template<FloatType T>
SmoothedValue<T> dspark::Compressor< T >::ratioSmooth_
protected

De-zippered ratio.

Definition at line 5863 of file Compressor.h.

◆ rawAttCoeff_

template<FloatType T>
double dspark::Compressor< T >::rawAttCoeff_ = 0.0
protected

Attack coefficient as it is observed (before a loop's own speed).

Definition at line 6079 of file Compressor.h.

◆ releaseMs_

template<FloatType T>
std::atomic<T> dspark::Compressor< T >::releaseMs_ { T(100) }
protected

Release time in milliseconds.

Definition at line 5824 of file Compressor.h.

◆ releaseX_

template<FloatType T>
double dspark::Compressor< T >::releaseX_ = 0.0
protected

The release as a decay per sample.

Definition at line 6118 of file Compressor.h.

◆ removalListen_

template<FloatType T>
std::atomic<bool> dspark::Compressor< T >::removalListen_ { false }
protected

The output is what the compression takes out.

Definition at line 5993 of file Compressor.h.

◆ rmsBuffers_

template<FloatType T>
std::array<std::vector<T>, kMaxChannels> dspark::Compressor< T >::rmsBuffers_
protected

Pre-allocated RMS sliding windows.

Definition at line 6006 of file Compressor.h.

◆ rmsIndices_

template<FloatType T>
std::array<int, kMaxChannels> dspark::Compressor< T >::rmsIndices_ {}
protected

Write heads for RMS buffers.

Definition at line 6008 of file Compressor.h.

◆ rmsRecomputeCounters_

template<FloatType T>
std::array<int, kMaxChannels> dspark::Compressor< T >::rmsRecomputeCounters_ {}
protected

Re-summation counters.

Definition at line 6010 of file Compressor.h.

◆ rmsSums_

template<FloatType T>
std::array<T, kMaxChannels> dspark::Compressor< T >::rmsSums_ {}
protected

Running sums for RMS.

Definition at line 6007 of file Compressor.h.

◆ rmsWindowDirty_

template<FloatType T>
std::atomic<bool> dspark::Compressor< T >::rmsWindowDirty_ { false }
protected

Applied at the next block.

Definition at line 6004 of file Compressor.h.

◆ rmsWindowMs_

template<FloatType T>
T dspark::Compressor< T >::rmsWindowMs_ = T(10)
protected

Active RMS length in ms (audio-thread copy).

Definition at line 6002 of file Compressor.h.

◆ rmsWindowMsAtomic_

template<FloatType T>
std::atomic<T> dspark::Compressor< T >::rmsWindowMsAtomic_ { T(10) }
protected

Control-thread published target.

Definition at line 6003 of file Compressor.h.

◆ rmsWindowSamples_

template<FloatType T>
int dspark::Compressor< T >::rmsWindowSamples_ = 0
protected

Active RMS length in samples.

Definition at line 6005 of file Compressor.h.

◆ route_

template<FloatType T>
std::atomic<Route> dspark::Compressor< T >::route_ { Route::Stereo }
protected

Definition at line 5954 of file Compressor.h.

◆ routeBlock_

template<FloatType T>
int dspark::Compressor< T >::routeBlock_ = 0
protected

Definition at line 5962 of file Compressor.h.

◆ routeDelay_

template<FloatType T>
RingBuffer<T> dspark::Compressor< T >::routeDelay_
protected

The part that is not treated waits here.

Definition at line 5964 of file Compressor.h.

◆ routeIn_

template<FloatType T>
Route dspark::Compressor< T >::routeIn_ = Route::Stereo
protected

The route the states carry (audio thread).

Definition at line 5960 of file Compressor.h.

◆ routeKey_

template<FloatType T>
AudioBuffer<T> dspark::Compressor< T >::routeKey_
protected

A key given apart, as its middle and its sides.

Definition at line 5963 of file Compressor.h.

◆ routeReach_

template<FloatType T>
int dspark::Compressor< T >::routeReach_ = 0
protected

Definition at line 5962 of file Compressor.h.

◆ routeWas_

template<FloatType T>
bool dspark::Compressor< T >::routeWas_ = false
protected

The last block ran a route.

Definition at line 5961 of file Compressor.h.

◆ sampleRate_

template<FloatType T>
double dspark::Compressor< T >::sampleRate_ = 0
protected

Cached operating sample rate.

Definition at line 5818 of file Compressor.h.

◆ scHpfA0_

template<FloatType T>
T dspark::Compressor< T >::scHpfA0_ = T(0)
protected

HPF normalized feedforward coefficient.

Definition at line 5986 of file Compressor.h.

◆ scHpfB1_

template<FloatType T>
T dspark::Compressor< T >::scHpfB1_ = T(0)
protected

HPF internal feedback coefficient.

Definition at line 5985 of file Compressor.h.

◆ scHpfDirty_

template<FloatType T>
std::atomic<bool> dspark::Compressor< T >::scHpfDirty_ { true }
protected

Coefficients need a recompute.

Definition at line 5984 of file Compressor.h.

◆ scHpfEnabled_

template<FloatType T>
std::atomic<bool> dspark::Compressor< T >::scHpfEnabled_ { false }
protected

HPF toggle.

Definition at line 5982 of file Compressor.h.

◆ scHpfFreq_

template<FloatType T>
std::atomic<T> dspark::Compressor< T >::scHpfFreq_ { T(80) }
protected

HPF Cutoff frequency.

Definition at line 5983 of file Compressor.h.

◆ scHpfPrev_

template<FloatType T>
std::array<T, kMaxChannels> dspark::Compressor< T >::scHpfPrev_ {}
protected

HPF x[n-1] state.

Definition at line 5988 of file Compressor.h.

◆ scHpfState_

template<FloatType T>
std::array<T, kMaxChannels> dspark::Compressor< T >::scHpfState_ {}
protected

HPF y[n-1] state.

Definition at line 5987 of file Compressor.h.

◆ scListen_

template<FloatType T>
std::atomic<bool> dspark::Compressor< T >::scListen_ { false }
protected

The key goes out instead of the audio.

Definition at line 5992 of file Compressor.h.

◆ spec_

template<FloatType T>
AudioSpec dspark::Compressor< T >::spec_ {}
protected

Active audio environment specification.

Definition at line 5817 of file Compressor.h.

◆ spectralTiming_

template<FloatType T>
std::atomic<T> dspark::Compressor< T >::spectralTiming_ { T(0) }
protected

Weight of the balance of the key on both times.

Definition at line 6108 of file Compressor.h.

◆ splitDetAttCoeff_

template<FloatType T>
T dspark::Compressor< T >::splitDetAttCoeff_ = T(0.6)
protected

Detector attack coefficient (sample-rate derived).

Definition at line 5998 of file Compressor.h.

◆ splitDetRelCoeff_

template<FloatType T>
T dspark::Compressor< T >::splitDetRelCoeff_ = T(0.99)
protected

Detector release coefficient (sample-rate derived).

Definition at line 5999 of file Compressor.h.

◆ splitNegEnv_

template<FloatType T>
std::array<T, kMaxChannels> dspark::Compressor< T >::splitNegEnv_ {}
protected

Negative half-wave tracking.

Definition at line 5997 of file Compressor.h.

◆ splitPosEnv_

template<FloatType T>
std::array<T, kMaxChannels> dspark::Compressor< T >::splitPosEnv_ {}
protected

Positive half-wave tracking.

Definition at line 5996 of file Compressor.h.

◆ stageAfter_

template<FloatType T>
CharacterStage<T> dspark::Compressor< T >::stageAfter_
protected

The output amplifier.

Definition at line 6069 of file Compressor.h.

◆ stageBefore_

template<FloatType T>
CharacterStage<T> dspark::Compressor< T >::stageBefore_
protected

The input amplifier.

Definition at line 6068 of file Compressor.h.

◆ stageFade_

template<FloatType T>
std::vector<double> dspark::Compressor< T >::stageFade_
protected

The share of the colour, per sample of the fade.

Definition at line 6071 of file Compressor.h.

◆ stageFadeStep_

template<FloatType T>
double dspark::Compressor< T >::stageFadeStep_ = 0.0
protected

Its change per sample (20 ms end to end).

Definition at line 6072 of file Compressor.h.

◆ stagePosition_

template<FloatType T>
std::atomic<StagePosition> dspark::Compressor< T >::stagePosition_ { StagePosition::Off }
protected

Definition at line 6067 of file Compressor.h.

◆ stageScratch_

template<FloatType T>
AudioBuffer<T> dspark::Compressor< T >::stageScratch_
protected

The coloured copy while a place fades.

Definition at line 6070 of file Compressor.h.

◆ stageWeightAfter_

template<FloatType T>
double dspark::Compressor< T >::stageWeightAfter_ = 0.0
protected

Share of the output stage (audio thread).

Definition at line 6074 of file Compressor.h.

◆ stageWeightBefore_

template<FloatType T>
double dspark::Compressor< T >::stageWeightBefore_ = 0.0
protected

Share of the input stage (audio thread).

Definition at line 6073 of file Compressor.h.

◆ stereoLink_

template<FloatType T>
std::atomic<T> dspark::Compressor< T >::stereoLink_ { T(1) }
protected

Stereo linking amount (0 to 1).

Definition at line 5827 of file Compressor.h.

◆ subAttCoeff_

template<FloatType T>
double dspark::Compressor< T >::subAttCoeff_ = 0.0
protected

Attack coefficient of an eighth of a sample.

Definition at line 6080 of file Compressor.h.

◆ subChargeCoeff_

template<FloatType T>
double dspark::Compressor< T >::subChargeCoeff_ = 0.0
protected

Memory-stage charge coefficient of an eighth of a sample.

Definition at line 6083 of file Compressor.h.

◆ subDecHoldCoeff_

template<FloatType T>
double dspark::Compressor< T >::subDecHoldCoeff_ = 0.0
protected

Decoupled hold coefficient of an eighth of a sample.

Definition at line 6086 of file Compressor.h.

◆ subDecSmoothCoeff_

template<FloatType T>
double dspark::Compressor< T >::subDecSmoothCoeff_ = 0.0
protected

Decoupled smoothing coefficient of an eighth of a sample.

Definition at line 6087 of file Compressor.h.

◆ subMidChargeCoeff_

template<FloatType T>
double dspark::Compressor< T >::subMidChargeCoeff_ = 0.0
protected

Medium-memory charge coefficient of an eighth of a sample.

Definition at line 6085 of file Compressor.h.

◆ subMidRelCoeff_

template<FloatType T>
double dspark::Compressor< T >::subMidRelCoeff_ = 0.0
protected

Medium-memory release coefficient of an eighth of a sample.

Definition at line 6084 of file Compressor.h.

◆ subRate_

template<FloatType T>
double dspark::Compressor< T >::subRate_ = 0.0
protected

Pole of the split at kBalanceFloorHz.

Definition at line 6119 of file Compressor.h.

◆ subRelCoeff_

template<FloatType T>
double dspark::Compressor< T >::subRelCoeff_ = 0.0
protected

Release coefficient of an eighth of a sample.

Definition at line 6081 of file Compressor.h.

◆ subSlowRelCoeff_

template<FloatType T>
double dspark::Compressor< T >::subSlowRelCoeff_ = 0.0
protected

Memory-stage release coefficient of an eighth of a sample.

Definition at line 6082 of file Compressor.h.

◆ sustainRate_

template<FloatType T>
double dspark::Compressor< T >::sustainRate_ = 0.0
protected

Pole of the follower of the depth.

Definition at line 6124 of file Compressor.h.

◆ threeStage_

template<FloatType T>
bool dspark::Compressor< T >::threeStage_ = false
protected

The audio thread runs the three-stage cell.

Definition at line 5858 of file Compressor.h.

◆ threshold_

template<FloatType T>
std::atomic<T> dspark::Compressor< T >::threshold_ { T(-20) }
protected

Threshold in dB.

Definition at line 5821 of file Compressor.h.

◆ thresholdInUseDb_

template<FloatType T>
std::atomic<T> dspark::Compressor< T >::thresholdInUseDb_ { T(0) }
protected

With the automatic threshold, the threshold of the last sample (metering).

Definition at line 6029 of file Compressor.h.

◆ thresholdSmooth_

template<FloatType T>
SmoothedValue<T> dspark::Compressor< T >::thresholdSmooth_
protected

De-zippered threshold.

Definition at line 5862 of file Compressor.h.

◆ timeConstantsDirty_

template<FloatType T>
std::atomic<bool> dspark::Compressor< T >::timeConstantsDirty_ { true }
protected

Coefficients need a recompute.

Definition at line 5852 of file Compressor.h.

◆ toneActive_

template<FloatType T>
bool dspark::Compressor< T >::toneActive_ = false
protected

The tone is in the path.

Definition at line 5926 of file Compressor.h.

◆ toneHigh_

template<FloatType T>
Biquad<T, kMaxChannels> dspark::Compressor< T >::toneHigh_ {}
protected

The filter F of the tone (audio thread).

Definition at line 5924 of file Compressor.h.

◆ toneHighDb_

template<FloatType T>
std::atomic<T> dspark::Compressor< T >::toneHighDb_ { T(0) }
protected

setReductionTone().

Definition at line 5921 of file Compressor.h.

◆ toneHighIn_

template<FloatType T>
T dspark::Compressor< T >::toneHighIn_ = T(0)
protected

The gains those were designed for.

Definition at line 5925 of file Compressor.h.

◆ toneLow_

template<FloatType T>
Biquad<T, kMaxChannels> dspark::Compressor< T >::toneLow_ {}
protected

Definition at line 5924 of file Compressor.h.

◆ toneLowDb_

template<FloatType T>
std::atomic<T> dspark::Compressor< T >::toneLowDb_ { T(0) }
protected

Definition at line 5921 of file Compressor.h.

◆ toneLowIn_

template<FloatType T>
T dspark::Compressor< T >::toneLowIn_ = T(0)
protected

Definition at line 5925 of file Compressor.h.

◆ topology_

template<FloatType T>
std::atomic<Topology> dspark::Compressor< T >::topology_ { Topology::FeedForward }
protected

Selected topology.

Definition at line 5837 of file Compressor.h.

◆ truePeak_

template<FloatType T>
TruePeakDetector<T, kMaxChannels> dspark::Compressor< T >::truePeak_
protected

Definition at line 6013 of file Compressor.h.

◆ upwardGuardDb_

template<FloatType T>
std::array<T, kMaxChannels> dspark::Compressor< T >::upwardGuardDb_ {}
protected

Peak-held sustained level (Upward guard).

Definition at line 5970 of file Compressor.h.

◆ upwardGuardDecay_

template<FloatType T>
T dspark::Compressor< T >::upwardGuardDecay_ = T(0.00125)
protected

Guard decay per sample (60 dB/s).

Definition at line 5971 of file Compressor.h.


The documentation for this class was generated from the following file: