Blog / Mixing

Compressor Ballistics: The Hidden Math That Shapes Your Dynamics

Compressor Ballistics: The Hidden Math That Shapes Your Dynamics

Put an 1176 and a modern digital compressor side by side. Set the same threshold, ratio, attack, and release on both. Hit play. They do not sound the same. Most engineers chalk this up to "analog character," but that explanation stops where the interesting part starts. The real answer lives in two architectural choices: how the compressor measures the signal level, and where it does the smoothing.

The Two-Stage Model

Every compressor, analog or digital, performs two distinct operations in sequence. This architecture was formalized by Giannoulis, Massberg, and Reiss in their 2012 AES paper "Digital Dynamic Range Compressor Design: A Tutorial and Analysis," but the underlying structure has existed in hardware since the 1960s.

Stage 1: The gain computer. This takes the input level in decibels and outputs the required gain reduction according to the static characteristic: the threshold, ratio, and knee settings. It is a purely static, memoryless function. No timing information enters here.

Stage 2: The gain smoother. This takes the gain computer's output and applies a time-varying filter driven by the attack and release settings. It is the only part of the compressor that has memory. It decides how quickly the computed gain reduction gets applied.

Most discussions of compression conflate these two stages. The distinction matters because different compressor designs diverge precisely in how each stage is implemented.

What the Gain Computer Actually Does

The gain computer implements the input/output characteristic of the compressor in decibel space. For a hard-knee compressor with threshold T and ratio R:

  • If the input level xL (in dB) is below the threshold: output gain = 0 dB (no reduction)
  • If xL exceeds T: output gain = (xL - T) * (1/R - 1)

A ratio of 4:1 means that for every 4 dB the signal exceeds the threshold, only 1 dB comes through. The gain computer outputs the difference: 3 dB of reduction per 4 dB of overshoot.

Soft knee introduces a transition zone of width W around the threshold. Within that region, the gain computer interpolates between no compression and full compression using a quadratic function. When W equals 0, you get a hard knee. Wider values of W produce the gentle onset characteristic of optical compressors.

Level Detection: Peak vs. RMS

Before the gain computer can do anything, it needs a level estimate. This is where designs diverge most dramatically.

Peak detection tracks the maximum absolute sample value over time. The envelope follows rapid transients immediately. A peak detector on a snare hit will react to the attack front within a single sample cycle.

RMS detection computes the root mean square of the signal, which is proportional to signal power. The squaring operation averages out peaks. An RMS detector responds to the energy content of a region, not its instantaneous maximum. It is inherently slower, and that slowness is musically meaningful: RMS detectors respond the way the ear perceives loudness, not the way a voltmeter reads voltage.

The 1176 uses peak detection, which is part of why its attack time can be set to very fast values (as low as 20 microseconds) and still produce audible transient shaping. Many modern bus compressors favor RMS detection because it creates a less aggressive response on material with high peak-to-RMS ratios, like full mixes.

In code, the difference is clear:

// Peak detection
float envPeak = max(envPeak * release_coeff, abs(inputSample));

// RMS detection  
float squared = inputSample * inputSample;
float rmsSmoothed = attack_coeff * rmsSmoothed + (1.0f - attack_coeff) * squared;
float envRMS = sqrt(rmsSmoothed);

The peak detector tracks the maximum and decays. The RMS detector is a lowpass filter on the squared signal, followed by a square root.

The Smoothing Filter and Its Time Constant

Once the gain computer outputs a gain reduction value, the gain smoother applies it gradually. This is a first-order recursive filter, also called a leaky integrator. Its behavior is defined by one coefficient alpha, derived from the attack or release time:

alpha_att = exp(-1 / (Fs * T_att))
alpha_rel = exp(-1 / (Fs * T_rel))

Where Fs is the sample rate in Hz and T is the time constant in seconds. At 44,100 Hz with a 10ms attack:

alpha_att = exp(-1 / (44100 * 0.01)) = exp(-1 / 441) ≈ 0.9977

The filter update per sample:

if (gainReduction < smoothedGain)
    smoothedGain = alpha_att * smoothedGain + (1 - alpha_att) * gainReduction;
else
    smoothedGain = alpha_rel * smoothedGain + (1 - alpha_rel) * gainReduction;

Here is the part that surprises most engineers: the filter never reaches its target. It is an exponential approach. After one time constant T, the filter has covered 63.2% of the distance to its target. After two time constants, 86.5%. After five, 99.3%. Full compression is, mathematically, at infinity.

What the attack time knob actually controls is the speed of an exponential curve, not a linear ramp. A compressor with a 10ms attack does not apply full compression after exactly 10ms. It applies 63.2% of the computed gain reduction after 10ms, then continues.

This asymptotic behavior is not a flaw. It produces the characteristic of most analog compressors, where compression onset is smooth rather than a hard gate flip.

Log Domain vs. Linear Domain

The smoother can operate on the gain value in one of two domains, and the choice has audible consequences.

Log domain smoothing applies the attack/release filter to the gain reduction value already expressed in decibels. The exponential smoothing then produces a linear slope in decibels over time, which corresponds to an exponential slope in linear amplitude. This is how most classic analog VCA compressors behave.

Linear domain smoothing applies the filter to the gain multiplier as a linear ratio rather than decibels. When converted back to decibels, the result is a curved slope. The attack sounds faster at the beginning and trails off.

Neither is correct. Log domain sounds more predictable and transparent. Linear domain can produce a more aggressive initial transient grab. Some designs deliberately combine both. The Giannoulis et al. paper found that placing the smoother in the log domain after the gain computer produces the smoothest envelope with no attack lag.

Feedforward vs. Feedback Topology

The final major architectural variable is where the detector samples the signal.

In a feedforward compressor, the sidechain detector reads from the input, before any gain reduction occurs. The gain computer and smoother react to what the signal is doing right now. The response is predictable: set 4:1 and you get 4:1 at every level. The drawback is that fast transients can pass through the gain cell before the computed gain reduction is applied, causing a brief overshoot on very short attacks.

In a feedback compressor, the sidechain reads from the output, after gain reduction is applied. This is a closed-loop system: the compressor continuously adjusts based on what it already did. The effective ratio varies dynamically, appearing high at large input levels and relaxing at lower ones. This variability is part of what gives feedback compressors their reputation for breathing and program-dependent response. The 1176 and Neve 2254 are both feedback designs.

Because the feedback compressor's control signal is the output rather than the input, its behavior is harder to predict mathematically and is more sensitive to time constants. A very fast release on a feedback design can cause the gain to hunt, creating audible pumping. The same release setting on a feedforward compressor simply decays predictably.

Why This Explains Real-World Compressor Differences

When engineers describe a compressor as "fast," "grabby," or "musical," they are reacting to the interaction of four variables: detection method (peak vs. RMS), domain (log vs. linear), smoothing coefficients (the exact alpha values from the time constant formula), and topology (feedforward vs. feedback).

Two compressors with the same attack and release labels can implement them completely differently. One may define attack time as the interval to reach 63.2% of target gain reduction (one time constant). Another might define it as the time to reach 90%. A third might define it as the -3 dB point of an equivalent lowpass filter. There is no industry standard.

This is why blind matching of compressor settings across different units rarely works. The knob values are not units; they are interface-specific parameters for an underlying filter whose characteristics are defined by the manufacturer.

Understanding the gain computer and the gain smoother as separate stages also clarifies something else: you can describe a compressor's character without touching the ratio at all. Two compressors with a 4:1 gain computer but different smoothing domains and topologies will process the same transient in meaningfully different ways. The gain computer tells you how much. Everything else tells you when and how.