Skip to content
Tone.js

DestinationClass

internal class Core ↳ extends ToneAudioNode<DestinationOptions>

A single master output which is connected to the AudioDestinationNode (aka your speakers). It provides useful conveniences such as the ability to set the volume and mute the entire application. It also gives you the ability to apply master effects to your application.

const oscillator = new Tone.Oscillator().start();
// the audio will go from the oscillator to the speakers
oscillator.connect(Tone.getDestination());
// a convenience for connecting to the master output is also provided:
oscillator.toDestination();
new DestinationClass(options: Partial<DestinationOptions>)

Parameters

input: Volume

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: "Destination"

output: Gain

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

volume: Param<"decibels">

The volume of the master output in decibels. -Infinity is silent, and 0 is no change.

const osc = new Tone.Oscillator().toDestination();
osc.start();
// ramp the volume down to silent over 10 seconds
Tone.getDestination().volume.rampTo(-Infinity, 10);

read-only

maxChannelCount: number

The maximum number of channels the system can output

console.log(Tone.Destination.maxChannelCount);
mute: boolean

Mute the output.

const oscillator = new Tone.Oscillator().start().toDestination();
setTimeout(() => {
	// mute the output
	Tone.Destination.mute = true;
}, 1000);
chain(...args: (AudioNode | ToneAudioNode<ToneWithContextOptions>)[]): this

Add a master effects chain. NOTE: this will disconnect any nodes which were previously chained in the master effects chain.

// route all audio through a filter and compressor
const lowpass = new Tone.Filter(800, "lowpass");
const compressor = new Tone.Compressor(-18);
Tone.Destination.chain(lowpass, compressor);

Parameters

Returns this

dispose(): this

Clean up

Returns this

static

getDefaults(): DestinationOptions

Returns all of the default options belonging to the class.

Returns DestinationOptions