Pattern arpeggiates between the given notes in a number of patterns.
const pattern = new Tone.Pattern((time, note) => {
// the order of the notes passed in depends on the pattern
}, ["C2", "D4", "E5", "A6"], "upDown");
The number of seconds of 1 processing block (128 samples)
console.log(Tone.Destination.blockTime);
The callback to be invoked at a regular interval
The context belonging to the node.
Set this debug flag to log all events that happen in this class.
Indicates if the instance was disposed. 'Disposing' an instance means that all of the Web Audio nodes that were created for the instance are disconnected and freed for garbage collection.
Random variation +/-0.01s to the scheduled time. Or give it a time value which it will randomize by.
The time between successive callbacks.
const loop = new Tone.Loop();
loop.interval = "8n"; // loop every 8n
The number of iterations of the loop. The default value is Infinity
(loop forever).
Muting the Loop means that no callbacks are invoked.
The pattern type. See Tone.CtrlPattern for the full list of patterns.
The playback rate of the loop. The normal playback rate is 1 (no change).
A playbackRate
of 2 would be twice as fast.
The probably of the callback being invoked.
The progress of the loop as a value between 0-1. 0, when the loop is stopped or done iterating.
The duration in seconds of one sample.
console.log(Tone.Transport.sampleTime);
The state of the Loop, either started or stopped.
The current value of the pattern.
The version number semver
Cancel all scheduled events greater than or equal to the given time
disconnect and dispose.
Get the object's attributes.
const osc = new Tone.Oscillator();
console.log(osc.get());
Returns all of the default options belonging to the class.
Return the current time of the Context clock without any lookAhead.
setInterval(() => {
console.log(Tone.immediate());
}, 100);
Return the current time of the Context clock plus the lookAhead.
setInterval(() => {
console.log(Tone.now());
}, 100);
Set multiple properties at once with an object.
const filter = new Tone.Filter().toDestination();
// set values using an object
filter.set({
frequency: "C6",
type: "highpass"
});
const player = new Tone.Player("https://tonejs.github.io/audio/berklee/Analogsynth_octaves_highmid.mp3").connect(filter);
player.autostart = true;
Start the loop at the specified time along the Transport's timeline.
Convert the input to a frequency number
const gain = new Tone.Gain();
console.log(gain.toFrequency("4n"));
Convert the incoming time to seconds. This is calculated against the current Tone.Transport bpm
const gain = new Tone.Gain();
setInterval(() => console.log(gain.toSeconds("4n")), 100);
// ramp the tempo to 60 bpm over 30 seconds
Tone.getTransport().bpm.rampTo(60, 30);
Convert the class to a string
const osc = new Tone.Oscillator();
console.log(osc.toString());
Convert the input time into ticks
const gain = new Tone.Gain();
console.log(gain.toTicks("4n"));