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();
Constructor
Section titled “Constructor”new DestinationClass(options: Partial<DestinationOptions>)Parameters
- options
Partial<DestinationOptions>
Properties
Section titled “Properties”input: VolumeThe input node or nodes. If the object is a source, it does not have any input and this.input is undefined.
output
Section titled “output”output: GainThe output nodes. If the object is a sink, it does not have any output and this.output is undefined.
volume
Section titled “volume”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);
maxChannelCount
Section titled “maxChannelCount”read-only
maxChannelCount: numberThe maximum number of channels the system can output
console.log(Tone.Destination.maxChannelCount);
mute: booleanMute the output.
const oscillator = new Tone.Oscillator().start().toDestination();
setTimeout(() => {
// mute the output
Tone.Destination.mute = true;
}, 1000);Methods
Section titled “Methods”chain()
Section titled “chain()”chain(...args: (AudioNode | ToneAudioNode<ToneWithContextOptions>)[]): thisAdd 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
-
args
(AudioNode | ToneAudioNode<ToneWithContextOptions>)[]All arguments will be connected in a row and the Master will be routed through it.
Returns this
getDefaults()
Section titled “getDefaults()”static
getDefaults(): DestinationOptionsReturns all of the default options belonging to the class.
Returns DestinationOptions
Inherited members
Section titled “Inherited members”- From
ToneWithContext: context, blockTime, sampleTime, get(), immediate(), now(), set(), toFrequency(), toSeconds(), toTicks() - From
Tone: debug, version, disposed, toString() - From
ToneAudioNode: channelCount, channelCountMode, channelInterpretation, numberOfInputs, numberOfOutputs, connect(), disconnect(), fan(), toDestination(), toMaster()