Studio Dynamic Compressor — User Guide

RMS-based downward compression with separate attack and release, quadratic soft knee, phase-safe multichannel linking, optional sidechain filtering, and explicit output-level policies.

Author: Shai Cohen Affiliation: Department of Music, Bar-Ilan University, Israel Version: 1.3 (2026) License: MIT License Output: Sound object
Contents:

What this does

The script applies one linked gain envelope to the selected Sound. It first builds an RMS-style detector from all input channels, optionally filters the sidechain, smooths the detected level with separate attack and release constants, converts the smoothed level to a gain-reduction curve, adds optional makeup gain, and multiplies that curve into every source channel.

Multichannel behavior: the detector is phase-safe. Each channel is optionally sidechain-filtered in its original signed form, squared, accumulated, averaged across channels, and square-rooted. The result is sqrt(mean(channel²)), so opposite-polarity channels do not cancel each other. The same final gain curve is then applied to every channel.

The processor is an offline RMS compressor. Even the two fastest presets are not sample-accurate peak limiters. The optional sidechain filters are zero-phase frequency-domain filters, which are useful offline but are acausal and can create a small amount of gain movement before a transient.

Quick start

  1. Select exactly one Sound object. Mono, stereo, and wider multichannel Sounds are supported.
  2. Run Compressor.praat.
  3. Choose a preset or leave Custom.
  4. Set threshold, ratio, knee, attack, release, and makeup behavior.
  5. Enable Advanced settings only when detector, sidechain, output policy, statistics, or original-object handling needs to be changed.
  6. Run the processor. The result remains selected and can optionally be played.
Default Custom behavior: threshold −20 dB, ratio 4:1, knee 6 dB, attack 10 ms, release 100 ms, Auto makeup on, 8 ms detector window, 2 ms detector update, no sidechain filter, and the scale-down-only output policy with target peak 0.99.

Controls

Main form

ControlDefaultImplemented behavior
PresetCustomSelects one of six fixed starting configurations. Presets override several detector and dynamics fields; details are listed below.
Threshold_dB−20.0Detector level at which compression begins. No fixed GUI range is enforced.
Ratio4.0Downward-compression ratio. The script rejects values below 1:1.
Knee_dB6.0Width of the quadratic soft-knee region. 0 gives a hard knee; negative values are rejected.
Attack_ms10Smoothing time used when the detected level rises.
Release_ms100Smoothing time used when the detected level falls.
Makeup_gain_dB0.0Flat gain added after gain reduction. If Auto makeup is on, this value is replaced by the script's automatic estimate.
Auto_makeupYesComputes makeup from threshold and ratio; it is not loudness matching or input/output RMS matching.
Advanced_settingsNoOpens the detector/output-policy dialog.
Draw_resultYesDraws transfer, waveform, metering, gain-reduction, and summary panels.
Play_resultYesPlays the final Sound after processing.

Advanced settings

ControlDefaultImplemented behavior
Rms_window_ms8.0Controls the Praat Intensity analysis window through pitch_floor = 3.2 / window_seconds.
Detector_update_ms2.0Time step of the Intensity analysis.
Sidechain_filterOffOff; high-pass 80 Hz; high-pass 150 Hz; or low-pass 8 kHz. Filtering is detector-only.
Output_modeLimiter (scale down only if needed)Three final level policies are available. In this guide the middle mode is described more precisely as a peak ceiling; it is global scaling, not a dynamic limiter.
Scale_peak0.99Target used by the scale-down and normalize modes. Must be >0 and ≤1.
Show_statsYesReports output peak, output RMS, and maximum compression-only gain reduction.
Keep_originalYesIf disabled, the original Sound is removed after successful processing.
Preset interaction: the advanced dialog appears before preset values are applied. Non-Custom presets therefore override their own RMS window, detector update, sidechain filter, makeup gain, and Auto makeup values. They do not override Output mode, Scale peak, Show stats, or Keep original.

Factory presets

PresetThresholdRatioKneeA / RRMS / updateMakeupSidechainSuffix
Vocal Leveler−24 dB2.5:18 dB15 / 150 ms15 / 3 ms+4 dB, Auto offHP 150 Hz_Vocal
Drum Punch−18 dB6:13 dB1 / 50 ms3 / 1 ms+3 dB, Auto offOff_Drum
Mix Bus Glue−14 dB2:110 dB30 / 200 ms25 / 5 ms+2 dB, Auto offOff_Bus
Fast Compressor RMS−3 dB20:10 dB0.5 / 50 ms2 / 0.5 ms0 dB, Auto offOff_FastComp
Squash−30 dB10:16 dB5 / 80 ms5 / 1 ms+8 dB, Auto offOff_Squash
NUKE Extreme RMS−40 dB100:10 dB0.5 / 30 ms2 / 0.5 ms+15 dB, Auto offOff_NUKE

Custom uses suffix _Comp. Every preset preserves the source duration, sample rate, and channel count because compression is applied to a copy of the selected Sound.

Detector and sidechain

Phase-safe linked detector

For each source channel c: 1. optionally apply the selected zero-phase sidechain filter to the raw signed waveform 2. square the filtered channel 3. add it to a one-channel accumulator After all channels: sidechain(t) = sqrt( (Σ channel_c(t)²) / Nchannels )

This prevents anti-phase channels from cancelling the detector. A mono Sound and the same mono signal duplicated across two identical channels therefore drive the linked detector consistently.

Sidechain filters

ModePraat filterPurpose / limitation
OffNoneFull-band detector.
Highpass 80 HzPass Hann band: 80 Hz → Nyquist, 50 Hz smoothingReduces low-bass influence on gain reduction.
Highpass 150 HzPass Hann band: 150 Hz → Nyquist, 50 Hz smoothingFurther reduces low-frequency influence; the Vocal preset uses this mode.
Lowpass 8 kHzPass Hann band: DC → 8 kHz, 50 Hz smoothingReduces high-frequency contribution to the detector. It is explicitly not a dedicated de-esser.

Praat's Hann-band frequency-domain filtering is zero-phase. That avoids phase shift in the detector path, but its symmetric impulse response is acausal, so gain movement can begin slightly before a transient. The filter also has a Nyquist validation check before processing.

RMS-style level conversion

The linked magnitude signal is passed to Praat's Intensity analysis with subtract mean = no. The script then applies a fixed calibration offset:

dBFS detector ≈ Praat Intensity dB − 93.9794

This follows Praat's pressure convention (reference pressure 2×10−5 Pa) and keeps a sidechain filter's level change intact. It is an approximation to a conventional rectangular-window RMS meter because Praat's Intensity analysis uses its own analysis window.

Attack and release

The detector is smoothed in the dB domain. Rising detector values use the attack constant; falling values use the release constant. For each direction:

N = round(time_constant / detector_frame_step) α = 1 − exp(−2.2 / max(1,N)) smoothed = previous + α × (current − previous)

Compression law

Gain reduction is computed from the smoothed detector level. With a hard knee (Knee_dB = 0), levels below threshold pass unchanged and levels above threshold follow the selected ratio.

Above threshold: GR_dB = −(level − threshold) × (1 − 1/ratio) gain = 10^(GR_dB / 20)

For a non-zero knee, the transition region extends from threshold − knee/2 to threshold + knee/2. Inside that region the script uses the standard quadratic interpolation:

over = level − threshold + knee/2 GR_dB = −[over² / (2 × knee)] × (1 − 1/ratio)

The visualization's transfer curve uses the same formula as the audio engine. That graph shows the static compression law only: it does not include makeup gain, sidechain timing, attack/release behavior, or final output scaling.

Auto makeup

Auto makeup is a fixed heuristic, not loudness matching:

headroom = min(abs(threshold_dB), 20) auto_makeup_dB = (headroom / 2) × (1 − 1/ratio)

When Auto makeup is enabled, this calculated value replaces the manual Makeup gain value for the run.

Output policies

ModeExact behaviorEffect on makeup gain
Preserve levelNo final scaling. If the processed peak exceeds 0 dBFS, the Info window warns but the Sound is left unchanged.Fully preserved.
Limiter (scale down only if needed)If the final peak exceeds Scale_peak, Praat scales the entire file down so its peak equals the target. If it is already below the target, no scaling occurs.Preserved unless the global peak ceiling is hit.
Normalize to targetFor any non-silent result, Praat scales the entire file so its peak equals Scale_peak.The absolute magnitude of makeup gain is cancelled by the subsequent normalization.
Terminology: the GUI retains the word “Limiter” for compatibility, but Output mode 2 is not a dynamic limiter. It is a whole-file, attenuation-only peak ceiling. The Fast Compressor RMS and NUKE presets are likewise RMS compressors, not sample-accurate peak limiters.

The default target is 0.99. The script rejects targets ≤0 or >1. A fully silent result is left silent in Normalize mode rather than being passed to Scale peak.

Visualization

When Draw result is enabled, the Picture window shows:

The waveform and gain-reduction panels use the Sound's actual xmin/xmax; they do not assume the file starts at 0 seconds.

Notes and limitations