Skip to content

DSP Implementation Notes

This page explains what each DSP family does internally.

It complements three reference pages:

PageRole
Mastering ProcessorsPublic processor registry
Algorithm ReferencesStandards, algorithm names, and compatibility references
Implementation ValidationFeature groups mapped to tests

Use this page when you need implementation context before exposing a processor in a UI, choosing real-time settings, or explaining a render report.

The source of truth is the C++ implementation in the libsonare repository.

AreaSource
DSP implementationsrc/analysis, src/feature, src/mastering, src/effects, src/mixing, src/engine
Public mastering processor namessrc/mastering/api/named_processor_registry.cpp
Analysis and feature helpersQuick APIs and binding wrappers

What You Will Learn

By the end of this page you should be able to:

  • identify the shared DSP building blocks behind analysis, effects, mastering, mixing, and realtime processing;
  • explain the difference between public processor names and the lower-level implementation pieces that realize them;
  • spot realtime-sensitive implementation details such as lookahead, allocation, FIR rebuilds, smoothing, and latency;
  • know which source directories to inspect when behavior needs to be verified.

Reading Path

NeedPage
Public processor IDs and preset namesMastering Processors
DSP behavior, shared building blocks, and real-time boundariesThis page
Standards, papers, and compatibility referencesAlgorithm References
Test coverage and validation statusImplementation Validation

Grounding

This page is source-grounded rather than generated from marketing names. It uses these kinds of evidence:

EvidenceExamples
Registrysrc/mastering/api/named_processor_registry.cpp for public processor names
Header commentscompressor.h describes a feed-forward compressor with soft knee and makeup gain; linear_phase.h describes an FFT-domain linear-phase FIR equalizer
Config fieldsTruePeakLimiterConfig exposes lookahead_ms, release_ms, oversample_factor, and apply_gain_at_input_rate; DenoiseClassicalConfig exposes three gain functions (LogMMSE, MMSE-STSA, spectral subtraction) and three noise estimators (Quantile, MCRA, IMCRA)
Runtime contractsSeveral processors mark which parameters are real-time safe, and which changes resize buffers or rebuild FIR kernels
Implementation includesRepair code includes LPC helpers for declick/declip; denoise uses NoiseTracker; convolution reverb and linear-phase EQ use partitioned convolution

Where this page says "main use", it describes the public intent implied by the processor name, config, and header comment. It does not claim hidden model behavior beyond the source.

Shared Building Blocks

Building blockImplementation roleUsed by
Biquad and filter designLow-latency IIR EQ, shelves, cuts, presence/air shaping, detector filteringEQ, dynamics sidechains, spectral enhancers, stereo filters
Envelope followerAttack/release smoothing for level detectors and gain changesCompressors, expanders, gates, de-esser, vocal rider, limiters
Parameter smootherClick-free parameter transitions in block processingMastering processors, mixer strip controls, automation
Lookahead and sliding maximumFuture-aware peak control without overshootBrickwall limiter, true-peak limiter, maximizers
Oversampling and true-peak filterInter-sample peak estimation and anti-aliasing headroomLimiters, clippers, saturation, final output
Delay linesTime alignment, Haas widening, modulation delay, ducking alignmentStereo, delay, modulation, mixing alignment
Mid/side transformIndependent mono center and stereo side processingMid/side EQ, imager, mono maker, stereo balance
Partitioned convolutionEfficient block convolution for long kernels or impulse responsesConvolution reverb, linear-phase EQ, match EQ
Noise tracker and LPC helpersClassical noise profile tracking and LPC residual/reconstruction helpersDenoise uses NoiseTracker; declick/declip use LPC helpers
Plain-language gloss of the building blocks
  • Lookahead — the processor delays the audio slightly so it can "see" a peak a few milliseconds before it plays, and turn the gain down smoothly instead of clamping it. The cost is a little latency.
  • Oversampling & true-peak filter — temporarily runs the audio at a higher sample rate to catch inter-sample peaks (peaks that fall between two samples and that a DAC will actually reconstruct), and to keep distortion from folding back into the audible range (aliasing).
  • Mid/side (M/S) — re-expresses a stereo signal as a mid (mono center) channel and a side (left-minus-right difference) channel, so you can process the center and the width independently, then convert back.
  • Partitioned convolution — convolution applies one signal's "fingerprint" to another (e.g. a room impulse response, or a linear-phase EQ). Partitioning splits a long filter into blocks so it can run efficiently in real time.
  • Haas widening — a very short delay (under ~40 ms) on one channel that the ear hears as extra stereo width rather than an echo.
  • LPC (linear predictive coding) — models a sample as a prediction from the samples before it; repair uses it to reconstruct what a clicked or clipped peak should have been.

Analysis And Feature DSP

The analysis side — music information retrieval (MIR): extracting tempo, key, chords, and similar musical facts from audio — is built from reusable feature stages rather than one monolithic analyzer. STFT and frame utilities feed mel/MFCC, chroma, onset envelopes, tempograms, pitch trackers, and section features. Higher-level analyzers then reuse those representations where possible.

FamilyImplementation roleMain use
STFT and framingWindowed FFT over overlapping frames, with shared frame/hop conventionsFoundation for spectral, chroma, onset, mel, and MFCC features
Mel / MFCCMel filterbank plus DCT-style cepstral compressionML features, timbre summaries, librosa-compatible workflows
Chroma / CQT / VQT / NNLS chromaPitch-class and log-frequency representationsKey, chord, harmonic similarity, and pitch-aware features
Onset / tempogram / PLPOnset envelope and local periodicity representationsBPM, beat, rhythm, and pulse analysis
Pitch trackingYIN and pYIN style F0 estimationMelody extraction and monophonic pitch analysis
Inverse featuresPseudo-inverse mel/MFCC paths and Griffin-Lim audio synthesisDebug previews and feature round-trip checks
Room acousticsEnergy decay curve metrics for IRs, blind free-decay fitting, equivalent-room estimation, image-source RIR synthesis, and creative room morphingRT60, EDT, C50, C80, D50, band decay, volume, dimensions, absorption, DRR, generated RIRs, and confidence

Feature inversion, blind acoustic estimation, and equivalent-room estimation are useful, but they are estimates. Inverse helpers cannot restore discarded phase or mel/MFCC detail; blind acoustic and room-estimation modes report confidence because ordinary recordings may not contain a clean free-decay region.

Mastering Chain

masteringChain(...) builds a fixed processor chain from a structured configuration: the same configuration and input always produce the same stage order and the same output, with no run-to-run variation. That is what "deterministic" means here.

The streaming variant, StreamingMasteringChain, runs the same stages in the same order, but it keeps each processor's state between audio blocks so it can run live.

Offline-only processors can still appear in high-level workflows. Real-time render paths are limited by each processor's contract; changes that resize buffers or rebuild FIR kernels are not audio-thread safe.

Presets are not separate DSP algorithms. They are named configurations that combine repair, EQ, dynamics, stereo processing, true-peak limiting, and loudness optimization with genre/platform defaults.

Dynamics

ProcessorImplementationMain useReal-time notes
dynamics.brickwallLimiterLookahead peak detector with fast gain reduction and ceiling enforcementPrevent sample peaks from exceeding a ceilingAdds lookahead latency; safe when prepared before streaming
dynamics.compressorFeed-forward level detector, attack/release envelope, ratio/knee gain computer, makeup gainControl macro dynamics and glue a masterSmooth parameter changes to avoid gain zipper noise
dynamics.deesserSplit-band de-esser with band-pass filters, threshold, ratio, attack/release, range, and bandpass QAttenuate sibilant high-frequency energyListed parameters are automatable without allocation or state reset
dynamics.expanderDownward expansion below a threshold using envelope detectionIncrease contrast and reduce low-level spillRelease time dominates audibility
dynamics.gateThreshold gate with hysteresis-style open/close behaviorSuppress background noise between eventsHold/release settings avoid chatter
dynamics.limiterPeak-oriented compressor with high ratio and short timingCatch short transients before final outputLower latency than lookahead brickwall limiting, less absolute
dynamics.parallelCompCompressed path blended with dry pathAdd density while preserving transientsBlend and latency compensation must stay aligned
dynamics.sidechainRouterRoutes an external or derived control signal into a dynamics detectorSidechain-dependent compression or duckingPrimarily an internal routing helper exposed for advanced graphs
dynamics.duckingProcessorSidechain envelope lowers the program path when the key signal is activeVoice-over music ducking and broadcast-style mixesAttack/release shape determines speech intelligibility
dynamics.transientShaperSeparates attack and sustain envelopes and applies independent gainEmphasize or soften hitsFast detector path is sensitive to block size
dynamics.upwardCompressorRaises material below a threshold instead of pushing loud material downIncrease detail and perceived densityCan raise noise floor; pair with denoise or gating when needed
dynamics.upwardExpanderLifts material above a lower threshold while leaving the quietest portions untouchedRestore articulation without hard gatingMore musical than a gate for ambience-heavy sources
dynamics.vocalRiderSlow envelope follower adjusts vocal level toward a target rangeAutomatic level riding for vocals or speechDesigned as gradual gain automation, not a peak limiter
Dynamics terms: knee, makeup gain, sidechain, ducking
  • Knee — how abruptly a compressor engages around its threshold. A hard knee clamps suddenly at the threshold; a soft knee eases in over a range, sounding gentler.
  • Makeup gain — after a compressor lowers the loud parts, the whole signal is quieter, so makeup gain raises it back up to a comparable level — now more even than before.
  • Sidechain — feeding a different signal into a processor's level detector so it reacts to that signal instead of itself.
  • Ducking — the classic sidechain use: a music bed automatically dips whenever a voice (the key signal) is present, then comes back up when the voice stops.
  • Brickwall limiter — a limiter with such a high ratio and fast response that nothing is allowed past the ceiling at all, as if hitting a wall.

EQ

ProcessorImplementationMain useReal-time notes
eq.apiStyleAPI-facing EQ wrapper for common band definitionsStable public entry point for UI-friendly EQDelegates to the underlying EQ design
eq.bandPassBiquad band-pass filterIsolate a frequency regionLow latency
eq.cutFilterHigh-pass/low-pass cut filters with slope controlRemove rumble, hiss, or band-limit a signalLow latency IIR path
eq.dynamicEQ band controlled by an envelope detectorFrequency-selective compression/expansionDetector timing must be smoothed
eq.equalizerMulti-band EQ engine with validation, routing, and spectrum helpersGeneral corrective and tonal EQIIR path is live-friendly
eq.graphicFixed-band graphic EQBroad tonal shaping with predictable bandsLow latency
eq.linearPhaseFIR/linear-phase style EQ pathPhase-preserving mastering movesAdds latency and is better suited to offline or latency-aware streaming
eq.midSideConverts L/R to M/S, applies EQ independently, converts backShape center and width bands separatelyNeeds stereo input and careful mono compatibility checks
eq.minimumPhaseMinimum-phase EQ topologyMastering EQ where low latency mattersPreferred for live paths
eq.parametricParametric peak/shelf/cut bandsPrecise corrective EQLow latency
eq.pultecPassive-style program equalizer with low boost, low attenuation, high boost, high attenuation, component model, and output drive controlsLow/high program EQ shapingMost controls are marked automatable; component model is not automatable
eq.shelvingLow/high shelf filtersTilt lows or highs around a corner frequencyLow latency
eq.tiltComplementary low/high shelving around a pivotQuick bright/dark tonal balanceUseful in presets and assistant suggestions

Final Stage and Maximizers

ProcessorImplementationMain useReal-time notes
final.bitDepthQuantizes samples to a target bit depthPreview or export bit-depth reductionUsually last or near-last
final.ditherAdds shaped or unshaped low-level noise before quantizationReduce quantization distortionExport-stage processor
final.outputChainGroups output gain, ceiling, bit depth, dither, and final checksLast-stage export preparationKeep after tonal/dynamics stages
maximizer.adaptiveReleaseLimiter release time adapts to signal behaviorCleaner loudness increase with fewer pumping artifactsAdds detector state
maximizer.loudnessOptimizeMeasures loudness and applies gain strategy toward a targetHit LUFS targets for streaming/broadcastFull-file optimization is offline by nature
maximizer.maximizerLoudness-oriented limiting with ceiling managementRaise perceived loudnessUse true-peak stage after aggressive settings
maximizer.softKneeMaxSoft-knee limiting curve before hard ceilingLess abrupt limitingUseful before final true-peak protection
maximizer.truePeakLimiterOversampled true-peak estimation and ceiling controlAvoid inter-sample oversAdds oversampling cost and lookahead-style latency
METERS · LOUDNESSIDLE
Loudness metering — LUFS, true-peak, and range

The bar tracks momentary loudness as the clip plays; the panel is the loudness over time. Integrated LUFS is the single overall number, true-peak is the real ceiling between samples, and LRA captures how much the loudness moves. Switch the window to compare the fast momentary meter with the smoother short-term one.

Window

Multiband

ProcessorImplementationMain useReal-time notes
multiband.compressorCrossover splits bands, each band runs compression, bands sum backFrequency-dependent dynamics controlCrossover design and latency compensation matter
multiband.dynamicEqDynamic EQ behavior applied across band regionsControl resonant or harsh ranges only when activeDetector smoothing is essential
multiband.expanderPer-band expansion below thresholdsClean low-level noise or restore contrast by bandCan change tonal balance if overused
multiband.imagerPer-band stereo width/mid-side processingKeep lows mono while widening upper bandsAlways check mono compatibility
multiband.limiterPer-band limiting before recombinationCatch band-specific peaksAvoid excessive crossover artifacts
multiband.saturationPer-band nonlinear drive and blendAdd harmonic color by rangeOversampling or conservative drive reduces aliasing

Repair

ProcessorImplementationMain useReal-time notes
repair.declickDetects isolated impulse-like discontinuities and interpolates or attenuates themRemove clicks and small digital defectsDetection window introduces local lookaround
repair.declipEstimates clipped regions and reconstructs peaksRepair hard-clipped audioOffline-friendly because reconstruction uses context
repair.decrackleTracks dense small impulses and smooths themReduce vinyl-like crackleMore expensive than single-click removal
repair.dehumNotch-style suppression of hum fundamentals and harmonicsRemove mains humLow latency when configured frequencies are known
repair.denoiseClassicalNoise tracking and spectral attenuationReduce stationary background noiseProfile estimation is context-dependent
repair.dereverbClassicalSTFT-domain dereverb configuration with t60_sec, late_delay_ms, over-subtraction, spectral floor, and optional WPE settingsReduce room tail and smearFile-level API returns a new Audio object
repair.trimSilenceThreshold-based leading/trailing silence removalClean exports and batch assetsFile-level utility, not a live insert

Saturation

ProcessorImplementationMain useReal-time notes
saturation.bitcrusherBit-depth and/or sample-rate style degradationLo-fi textureKeep output gain controlled
saturation.exciterHigh-frequency harmonic generation and blendAdd brightness and perceived detailCan become harsh quickly
saturation.hardClipperHard nonlinear transfer curveAggressive peak shaving and distortionUse oversampling or conservative drive
saturation.multibandExciterBand-split exciter with per-band drive/blendAdd sparkle without overloading lowsCrossover and drive balance matter
saturation.softClipperSmooth nonlinear curveGentle peak roundingCommon before maximizers
saturation.tapeNonlinear saturation with tone/soft compression behaviorTape-like densityDrive changes loudness and tone together
saturation.transformerLow-order harmonic coloration and subtle saturationAnalog-style thicknessUsually subtle mastering color
saturation.tubeAsymmetric nonlinear transfer emphasizing musical harmonicsWarmth and vocal/instrument colorWatch DC and low-frequency buildup
saturation.waveshaperConfigurable nonlinear transfer curveGeneral distortion and colorationParameter smoothing prevents clicks

Spectral and Stereo

ProcessorImplementationMain useReal-time notes
spectral.airBandHigh-frequency shelf/exciter style enhancementAdd air above the main presence rangePair with de-esser if sibilance increases
spectral.lowEndFocusLow-band shaping and focus controlTighten bass and reduce muddinessMono compatibility is important
spectral.presenceEnhancerPresence-band shaping with controlled harmonic/detail emphasisImprove vocal or lead audibilityAvoid masking-sensitive overuse
spectral.spectralShaperBroad spectral tilt/shape correctionMatch tonal contour or smooth harsh rangesMore transparent with moderate settings
stereo.autoPanLFO-driven pan movementCreative movementMore creative than mastering-neutral
stereo.haasEnhancerShort inter-channel delay for widthPerceived width increaseCan reduce mono compatibility
stereo.imagerMid/side width gain and optional band awarenessWiden or narrow stereo imageCheck correlation and mono sum
stereo.monoMakerLow-frequency mono summing below a crossoverStabilize bass in the centerCommon before final limiting
stereo.phaseAlignDelay/polarity style alignment correctionImprove stereo phase relationshipRequires careful listening or measurement
stereo.stereoBalanceL/R or M/S balance adjustmentCorrect image leanLow latency

Reference Matching and Analysis

NameImplementationMain use
match.applyMatchEqApplies an EQ curve derived from source/reference spectral differenceMove source tonal balance toward a reference
match.alignReferenceToSourceEstimates and compensates reference delay relative to sourceMake A/B comparisons and match curves more reliable
match.abSwitchSwitches between source and reference pathsAudition comparison
match.abCrossfadeCrossfades between source and reference pathsSmooth comparison without clicks
match.referenceLoudnessMeasures reference loudness metricsLevel-match comparisons
match.tonalBalanceCompares band energy distributionBroad tonal comparison
match.tonalBalanceLogBandsTonal balance on logarithmic bandsPerceptually useful reference comparison
match.matchEqCurveEstimates a corrective EQ curveBuild match EQ settings
match.estimateReferenceDelaySamplesEstimates reference delay in samplesAlign files before comparison
stereo.monoCompatCheckComputes mono compatibility metricsCatch phase and cancellation problems
stereo.monoCompatCheckLogBandsMono compatibility by logarithmic bandsFind frequency ranges with stereo problems

Effects and Editing DSP

DSPImplementationMain useReal-time notes
HPSS / harmonic / percussiveMedian filtering on spectral representation separates horizontal harmonic energy and vertical percussive energyRemixing, preprocessing, analysis cleanupOffline-oriented for full files
Time stretchPhase-vocoder style processingChange duration without changing pitchStreaming requires overlap/state discipline
Pitch shiftResampling combined with time stretchingTranspose pitch while preserving approximate durationFormants are not preserved unless using the voice-change path
Pitch correctionPitch estimation and correction toward a target MIDI noteVocal or monophonic note tuningBest on monophonic material
Note stretchRegion-based stretch around a note spanEdit note durationOffline editing operation
Voice changePitch and formant controlsVoice transformationMore expensive than simple pitch shift
NormalizePeak or target-level gain adjustmentUtility level matchingFile-level operation unless gain is known ahead
Trim/split silenceThreshold segmentationBatch cleanup and asset prepFile-level utility
Reverb insertsPlate/Dattorro, FDN, velvet, convolution, geometric room, and room-morph insertsSpace, ambience, and room-character morphing in mixer/mastering insert graphsBuild flags and IR requirements vary
Modulation/delay modulesChorus, flanger, phaser, and stereo delay DSP live in source modulesBuilding blocks for creative FXNot exposed as standalone top-level JS/Python helpers in the current public bindings

Reverb insert availability

effects.reverb.plate / effects.reverb.dattorro, effects.reverb.fdn, effects.reverb.velvet, and effects.reverb.convolution require SONARE_HAVE_FX. effects.reverb.room and effects.acoustic.roomMorph also require BUILD_ACOUSTIC_SIM.

Algorithmic and geometric room reverb are streamable. Convolution needs an IR supplied through native insert creation paths.

Mixing DSP

The mixer is DSP as well as routing.

Channel strips apply input trim, polarity, delay alignment, pan law, stereo width, insert processing, fader, mute/solo logic, sends, and metering.

Buses sum routed signals, VCA groups apply control gain, and meters compute peak/RMS/LUFS-like values, true peak, gain reduction, correlation, and goniometer buffers.

Automation lanes are sample-positioned and support linear, exponential, hold, and s-curve interpolation. Topology changes compile a routing graph; the audio processing path uses the compiled graph and preallocated state.

Real-Time Engine DSP Boundary

RealtimeEngine owns transport, tempo synchronization, graph runtime, clip playback, metronome, capture, monitor runtime, offline bounce, and telemetry. It is not a replacement for the mastering processor registry; it is the scheduler and graph runtime that can host real-time-safe DSP blocks. File-wide analysis, full repair, and loudness optimization remain offline or latency-tolerant operations.