Tone.Sampler↳ EXTENDS Tone.Instrument
Automatically interpolates between a set of pitched samples. Pass in an object which maps the note’s pitch or midi value to the url, then you can trigger the attack and release of that note like other instruments. By automatically repitching the samples, it is possible to play pitches which were not explicitly included which can save loading time. For sample or buffer playback where repitching is not necessary, use Tone.Player.
CONSTRUCTORnew Tone.Sampler (
An object of samples mapping either Midi Note Numbers or Scientific Pitch Notation to the url of that sample.
The callback to invoke when all of the samples are loaded.
The root URL of all of the samples, which is prepended to all the URLs.
.context↝ Tone.Context READONLY #
Get the audio context belonging to this instance.
.numberOfOutputs↝ Number READONLY #
The number of outputs coming out of the AudioNode.
.numberOfInputs↝ Number READONLY #
The number of inputs feeding into the AudioNode. For source nodes, this will be 0.
.channelCount↝ Number READONLY #
channelCount is the number of channels used when up-mixing and down-mixing connections to any inputs to the node. The default value is 2 except for specific nodes where its value is specially determined.
.channelCountMode↝ String READONLY #
channelCountMode determines how channels will be counted when up-mixing and down-mixing connections to any inputs to the node. The default value is “max”. This attribute has no effect for nodes with no inputs.
.channelInterpretation↝ String READONLY #
channelInterpretation determines how individual channels will be treated when up-mixing and down-mixing connections to any inputs to the node. The default value is “speakers”.
.volume↝ Decibels #
The volume of the output in decibels.
.add ( )#
Either the url of the bufer, or a buffer which will be added with the given name.
The callback to invoke when the url is loaded.
Add a note to the sampler.
.releaseAll ( )#
Release all currently active notes.
.sync ( )#
.triggerAttack ( )#
When to play the note
The velocity to play the sample back.
.triggerAttackRelease ( )#
When to start the attack
The velocity of the attack
Invoke the attack phase, then after the duration, invoke the release.
.triggerRelease ( )#
When to release the note.
.chain ( )#
Connect the output of this node to the rest of the nodes in series.
.connect ( )#
optionally which output to connect from
optionally which input to connect to
connect the output of a ToneNode to an AudioParam, AudioNode, or ToneNode
.disconnect ( )#
Either the output index to disconnect if the output is an array, or the node to disconnect from.
disconnect the output
.fan ( )#
connect the output of this node to the rest of the nodes in parallel.
.toMaster ( )#
Connect ‘this’ to the master output. Shorthand for this.connect(Tone.Master)