# Gate

> Noise gate and downward expander with a sidechain key input, range, hold, lookahead, detector filtering and channel linking.

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

A gate turns a signal down while it is quiet: hiss between notes, spill between drum hits, or anything below a level you choose.

## What it does

A detector follows each channel's peak level. While it is above Threshold the gate is open and the audio passes unchanged. When it falls below, the gate waits for Hold, then closes over Release; when the level returns it opens over Attack. Closed means turned down by Range: −80 dB is near silence, −10 dB only softens the gaps. With Ratio below its top value the node is a downward expander: below threshold, every decibel the level falls takes Ratio − 1 more decibels off the output, never more than Range. At the top of the Ratio range, 20, it is a gate and closes fully.

The `key` input is a sidechain. While something is connected to it, the key's level opens and closes the gate and the main input is what is heard: a beat on the key chops a sustained pad into a rhythm. 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. The detector high-pass filters only what the detector measures, and Listen plays that filtered signal so you can hear what opens the gate.

Lookahead delays the audio by up to 10 ms while the detector reads it undelayed, so the gate is already open when an onset arrives. The node reports a fixed processing latency equal to the largest Lookahead its control can reach, and the rest of the graph is delayed to match; a smaller Lookahead inside that range moves only the detector, never the latency.

## When to use it

Use it to clean up noise between phrases, tighten drums, or, with a key, to gate one sound with the rhythm of another. To turn loud parts down rather than quiet parts, use the [Compressor](https://docs.tune.toys/nodes/std.compressor/); to change the attack and decay of hits without a threshold, use the [Transient shaper](https://docs.tune.toys/nodes/std.transient/).

## 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          | -80 to 0    | -40     | dBFS | linear | The gate is open while the detector level is above this.                                              |
| `range`       | Range              | -80 to 0    | -80     | dB   | linear | Attenuation when fully closed; 0 dB leaves the audio untouched.                                       |
| `ratio`       | Ratio              | 1 to 20     | 20      | :1   | linear | Downward expansion below threshold; 20 closes fully, a gate.                                          |
| `attack`      | Attack             | 0.01 to 100 | 0.5     | ms   | log    | How quickly the gate opens.                                                                           |
| `hold`        | Hold               | 0 to 500    | 20      | ms   | linear | How long the gate stays open after the level falls below threshold.                                   |
| `release`     | Release            | 1 to 2000   | 80      | ms   | log    | How quickly the gate closes after the hold.                                                           |
| `lookahead`   | Lookahead          | 0 to 10     | 0       | ms   | linear | Delays the audio so the gate opens before an onset; adds latency equal to its largest admitted value. |
| `detector_hp` | Detector high-pass | 0 to 2000   | 0       | Hz   | linear | High-pass only in the detector (on the key when it is connected); zero bypasses it.                   |
| `listen`      | Listen             | 0 to 1      | 0       |      | linear | Outputs the filtered detector signal instead of the gated audio. Choices: 0 Off, 1 On.                |
| `link`        | Channel link       | 0 to 1      | 1       |      | linear | Blends independent detectors with the strongest detector across the bundle.                           |

<!-- parameters:end -->

### Threshold (`threshold`)

The detector level, from −80 to 0 dBFS, above which the gate is open.

### Range (`range`)

How far the gate turns the audio down when fully closed, from 0 dB (no change) to −80 dB. A closed gate attenuates by exactly this amount.

### Ratio (`ratio`)

Downward expansion below the threshold, from 1:1 (none) to 20, which closes fully like a classic gate. In between, the further the level falls below the threshold, the more it is turned down, until Range stops it.

### Attack (`attack`)

How quickly the gate opens, from 0.01 to 100 ms. Very short attacks can click on low notes; Lookahead lets you keep them short without losing the onset.

### Hold (`hold`)

How long, up to 500 ms, the gate stays open after the level falls below the threshold, so it does not chatter on short dips.

### Release (`release`)

How quickly the gate closes after the hold, from 1 to 2000 ms.

### Lookahead (`lookahead`)

Delays the audio by up to 10 ms so the gate opens before each onset. It adds latency equal to its largest reachable value.

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

A high-pass, 0 to 2000 Hz, applied only to the detector (on the key when it is connected). Zero bypasses it. Raising it keeps bass from opening the gate.

### Listen (`listen`)

On replaces the output with the signal the detector measures, after its high-pass. The gate keeps working underneath.

### Channel link (`link`)

From independent detectors per channel (0) to one detector that follows the loudest channel across the bundle (1), so every channel opens and closes together.

## Tips

- Set Threshold just above the noise you want gone, then lower Range until the gaps are as quiet as you like.
- Raise Hold before raising Release when a gate flutters on decaying notes.
- Use a Ratio of 2 to 4 for a natural expander that softens noise instead of cutting it.
- A keyed gate on a pad, driven by a kick or a hi-hat, is a quick trance gate.

## See also

[Compressor](https://docs.tune.toys/nodes/std.compressor/), [Transient shaper](https://docs.tune.toys/nodes/std.transient/), [Envelope](https://docs.tune.toys/nodes/std.envelope/), [Filter](https://docs.tune.toys/nodes/std.svf/).
