Tone.Sampler
↳ EXTENDS Tone.InstrumentAutomatically 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.
CONSTRUCTOR
new Tone.Sampler (An object of samples mapping either Midi Note Numbers or Scientific Pitch Notation to the url of that sample.
DEFAULTS
EXAMPLE
Members
.context
↝ Tone.Context READONLY #Get the audio context belonging to this instance.
.volume
↝ Decibels #The volume of the output in decibels.
EXAMPLE
Methods
.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.
.triggerAttack ( )
#The note to play
When to play the note
The velocity to play the sample back.
this
.triggerAttackRelease ( )
#The note to play
The time the note should be held
When to start the attack
The velocity of the attack
this
Invoke the attack phase, then after the duration, invoke the release.
.triggerRelease ( )
#The note to release.
When to release the note.
this
.connect ( )
#optionally which output to connect from
optionally which input to connect to
this
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.
this
disconnect the output
.toMaster ( )
#this
Connect ‘this’ to the master output. Shorthand for this.connect(Tone.Master)