# Compressor

> Peak/RMS compression with a sidechain key input, detector filtering, hold, adaptive release and channel linking.

Source: https://docs.tune.toys/nodes/std.compressor/

A compressor turns loud parts of a signal down, making the level more even.

## What it does

A detector measures the signal level, either by peak or by smoothed RMS. When the level goes above Threshold, the compressor reduces the gain according to Ratio, with a soft Knee around the threshold. Attack and Release set how quickly the gain reduction arrives and recovers, and Hold keeps the reduction in place for a moment before recovery. Makeup raises the output afterwards. The detector can be high-passed so low frequencies do not trigger compression, and the detectors of a multichannel bundle can be linked so every channel gets the same reduction.

The `key` input is a sidechain. While something is connected to it, the detector measures the key instead of the main input, and the gain it computes is applied to the main input: a kick on the key pushes a pad down on every hit (ducking), and a high-passed copy of a voice on the key turns the voice down only when it hisses (de-essing). The key carries one channel, which then drives every channel of the main input, or exactly as many channels as the main input. Left unconnected, the main input drives the detector exactly as before. A key from a node with processing latency is delayed with the rest of the graph, so it stays aligned with the audio it controls.

## When to use it

Use it to even out dynamics, add punch or control a peaky source, or with a key to duck one sound under another and to de-ess. For a hard ceiling that nothing passes, use the [Limiter](https://docs.tune.toys/nodes/std.limiter/); to silence a signal below a level, use the [Gate](https://docs.tune.toys/nodes/std.gate/); to compress bands separately, use the [Multiband compressor](https://docs.tune.toys/nodes/std.multiband/).

## Ports

<!-- ports:start -->

| Port    | Direction | Signal | Lanes                   |
| ------- | --------- | ------ | ----------------------- |
| `audio` | Input     | Audio  | Inferred from the cable |
| `key`   | Input     | Audio  | Inferred from the cable |
| `audio` | Output    | Audio  | Inferred from the cable |

<!-- ports:end -->

## Parameters

<!-- parameters:start -->

| Parameter      | Label              | Range      | Default | Unit | Scale  | Notes                                                                                                                          |
| -------------- | ------------------ | ---------- | ------- | ---- | ------ | ------------------------------------------------------------------------------------------------------------------------------ |
| `threshold`    | Threshold          | -60 to 0   | -18     | dBFS | linear | Compression starts above this detector level.                                                                                  |
| `ratio`        | Ratio              | 1 to 20    | 4       | :1   | linear | Input/output slope above threshold.                                                                                            |
| `attack`       | Attack             | 0.1 to 100 | 10      | ms   | log    | Gain-reduction attack time constant.                                                                                           |
| `release`      | Release            | 10 to 2000 | 120     | ms   | log    | Gain-reduction recovery time constant.                                                                                         |
| `knee`         | Knee               | 0 to 24    | 6       | dB   | linear | Width of the quadratic soft knee.                                                                                              |
| `makeup`       | Makeup             | 0 to 24    | 0       | dB   | linear | Gain after compression.                                                                                                        |
| `link`         | Channel link       | 0 to 1     | 1       |      | linear | Blends independent detectors with the strongest detector across the entire bundle.                                             |
| `detector`     | Detector           | 0 to 1     | 0       |      | linear | Peak amplitude or smoothed mean-square detection. Choices: 0 Peak, 1 RMS.                                                      |
| `detector_hp`  | Detector high-pass | 0 to 1000  | 0       | Hz   | linear | High-pass only in the detector (on the key when it is connected); zero bypasses it.                                            |
| `hold`         | Hold               | 0 to 250   | 0       | ms   | linear | Holds attenuation before recovery.                                                                                             |
| `auto_release` | Adaptive release   | 0 to 1     | 0       |      | linear | Blends the chosen release with a slower recovery after sustained reduction.                                                    |
| `listen`       | Listen             | 0 to 1     | 0       |      | linear | Outputs the filtered detector signal instead of the compressed audio, to tune the key and its high-pass. Choices: 0 Off, 1 On. |

<!-- parameters:end -->

### Threshold (`threshold`)

The level, from -60 to 0 dBFS, above which compression starts.

### Ratio (`ratio`)

The input-to-output slope above the threshold, from 1:1 (no compression) to 20:1 (near limiting).

### Attack (`attack`)

How quickly gain reduction arrives, from 0.1 to 100 ms. Longer attacks let more of the initial transient through.

### Release (`release`)

How quickly the gain recovers, from 10 to 2000 ms.

### Knee (`knee`)

The width, from 0 to 24 dB, of a smooth transition around the threshold.

### Makeup (`makeup`)

Gain applied after compression, from 0 to 24 dB.

### Channel link (`link`)

From independent detectors (0) to a single detector that follows the strongest channel across the whole bundle (1).

### Detector (`detector`)

Peak reacts to the highest sample; RMS follows a smoothed mean-square level and responds more like loudness.

### Detector high-pass (`detector_hp`)

A high-pass, 0 to 1000 Hz, applied only to the detector. Zero bypasses it.

### Hold (`hold`)

Keeps the gain reduction for up to 250 ms before recovery starts.

### Adaptive release (`auto_release`)

Blends the chosen Release with a slower recovery after sustained reduction.

### Listen (`listen`)

On replaces the output with the signal the detector measures: the key when it is connected, otherwise the main input, after the detector high-pass. Use it to hear what triggers compression while you set a key filter or Detector high-pass; the gain reduction keeps running underneath, so switching back is seamless.

## Tips

- Set Threshold first, then Ratio, then adjust Attack and Release by ear.
- Use Makeup to match loudness before and after, so you judge the sound and not the volume.
- A detector high-pass keeps heavy bass from pumping the whole mix.
- For ducking, use a short Attack, a Release that ends before the next hit, and a high Ratio.
- For de-essing, feed the key through a [Filter](https://docs.tune.toys/nodes/std.svf/) set to high-pass, turn Listen on, and raise the cutoff until only the hiss remains.

## See also

[Limiter](https://docs.tune.toys/nodes/std.limiter/), [Gate](https://docs.tune.toys/nodes/std.gate/), [Multiband compressor](https://docs.tune.toys/nodes/std.multiband/), [Envelope](https://docs.tune.toys/nodes/std.envelope/), [Gain](https://docs.tune.toys/nodes/std.gain/).
