Table of Contents

Class GateEffect

Namespace
NAudio.Effects
Assembly
NAudio.Core.dll

Noise gate / downward expander. Below the threshold the signal is attenuated; with a high Ratio it behaves as a hard gate, with a lower ratio as a gentle expander. Includes hysteresis (separate open/close points), a hold time to avoid chatter, and independent attack/release. Detection is channel-linked.

public sealed class GateEffect : AudioEffect, IAudioEffect, IParameterized
Inheritance
GateEffect
Implements
Inherited Members

Properties

AttackMs

Attack (open) time in milliseconds. Default 1 ms.

public float AttackMs { get; set; }

Property Value

float

GainReductionDb

The most recent gain reduction in dB (≥ 0), for metering.

public float GainReductionDb { get; }

Property Value

float

HoldMs

Hold time in milliseconds before the gate is allowed to close. Default 10 ms.

public float HoldMs { get; set; }

Property Value

float

HysteresisDb

Hysteresis in dB: the gate re-closes this far below the threshold. Default 3 dB.

public float HysteresisDb { get; set; }

Property Value

float

Parameters

Generic parameter list (excludes Bypass/Mix, which are on the base).

public IReadOnlyList<EffectParameter> Parameters { get; }

Property Value

IReadOnlyList<EffectParameter>

RangeDb

Maximum attenuation in dB when fully closed (negative). Default -80 dB.

public float RangeDb { get; set; }

Property Value

float

Ratio

Expansion ratio; higher is more gate-like. Default 10.

public float Ratio { get; set; }

Property Value

float

ReleaseMs

Release (close) time in milliseconds. Default 100 ms.

public float ReleaseMs { get; set; }

Property Value

float

ThresholdDb

Level (dBFS) below which the gate starts to close. Default -40 dB.

public float ThresholdDb { get; set; }

Property Value

float

Methods

OnConfigure(WaveFormat)

Called by Configure(WaveFormat) after the format is stored. Derived effects allocate and size their sample-rate-dependent state here.

protected override void OnConfigure(WaveFormat format)

Parameters

format WaveFormat

ProcessBlock(Span<float>)

Transforms buffer in place into the fully-wet signal. The base class handles dry/wet mixing and bypass around this call.

protected override void ProcessBlock(Span<float> buffer)

Parameters

buffer Span<float>

Reset()

Clears internal state (delay lines, envelopes, smoothers) so the next block starts as if from silence.

public override void Reset()