Skip to content
Tone.js

Gate

class Component ↳ extends ToneAudioNode<GateOptions>

Gate only passes a signal through when the incoming signal exceeds a specified threshold. It uses Follower to follow the ampltiude of the incoming signal and compares it to the threshold value using GreaterThan.

const gate = new Tone.Gate(-30, 0.2).toDestination();
const mic = new Tone.UserMedia().connect(gate);
// the gate will only pass through the incoming
// signal when it's louder than -30db
new Gate(threshold?: number, smoothing?: Time)

Parameters

  • threshold number optional

    The threshold above which the gate will open.

  • smoothing Time optional

    The follower’s smoothing time

new Gate(options?: Partial<GateOptions>)

Parameters

read-only

The input node or nodes. If the object is a source, it does not have any input and this.input is undefined.

read-only

name: string

The name of the class

Default: "Gate"

read-only

The output nodes. If the object is a sink, it does not have any output and this.output is undefined.

smoothing: Time

The attack/decay speed of the gate.

See also: Follower.smoothing

threshold: number

The threshold of the gate in decibels

dispose(): this

Dispose and disconnect

Returns this

static

getDefaults(): GateOptions

Returns all of the default options belonging to the class.

Returns GateOptions