The Beats Per Minute of the Transport.
const osc = new Tone.Oscillator().toDestination();
Tone.getTransport().bpm.value = 80;
// start/stop the oscillator every quarter note
Tone.getTransport().scheduleRepeat(time => {
osc.start(time).stop(time + 0.1);
}, "4n");
Tone.getTransport().start();
// ramp the bpm to 120 over 10 seconds
Tone.getTransport().bpm.rampTo(120, 10);
ReadonlycontextThe context belonging to the node.
Set this debug flag to log all events that happen in this class.
Invoke all of the callbacks bound to the event with any arguments passed in.
The name of the event.
The arguments to pass to the functions listening.
ReadonlynameThe name of the class
Remove the event listener.
The event to stop listening to.
Optionalcallback: (...args: any[]) => voidThe callback which was bound to the event with Emitter.on. If no callback is given, all callbacks events are removed.
Bind a callback to a specific event.
The name of the event to listen for.
The callback to invoke when the event is emitted
Bind a callback which is only invoked once
The name of the event to listen for.
The callback to invoke when the event is emitted
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.
If the transport loops or not.
Pulses Per Quarter note. This is the smallest resolution the Transport timing supports. This should be set once on initialization and not set again. Changing this value after other objects have been created can cause problems.
The Transport's loop position as a normalized value. Always returns 0 if the Transport.loop = false.
The duration in seconds of one sample.
The Transport's position in seconds. Setting the value will jump to that position right away.
The playback state of the transport, either "started", "stopped", or "paused".
The swing value. Between 0-1 where 1 equal to the note + half the subdivision.
Set the subdivision which the swing will be applied to. The default value is an 8th note. Value must be less than a quarter note.
The Transport's current tick position.
The time signature as just the numerator over 4. For example 4/4 would be just 4 and 6/8 would be 3.
Clear the passed in event id from the timeline
The id of the event.
Clean up.
Returns the time aligned to the next subdivision of the Transport. If the Transport is not started, it will return 0. Note: this will not work precisely during tempo ramps.
The context time of the next subdivision.
Schedule an event to be invoked at a specific time.
The callback to invoke at the given time.
The time to invoke the callback at.
The ID of the event, which can be used to cancel the event.
Schedule an event that will be removed after it is invoked.
The callback to invoke once.
The time the callback should be invoked.
The ID of the scheduled event.
Schedule a repeated event.
The event will fire at the interval starting at the startTime and for the specified duration.
The ID of the scheduled event. Use this to cancel the event.
Set multiple properties at once with an object.
Attaches the signal to the tempo control signal so that any changes in the tempo will change the signal in the same ratio.
Optionalratio: numberOptionally pass in the ratio between the two signals. Otherwise it will be computed based on their current values.
Convert the incoming time to seconds. This is calculated against the current TransportInstance bpm
Unsyncs a previously synced signal from the transport's control.
Transport for timing musical events.
Supports tempo curves and time changes.
Unlike browser-based timing (setInterval, requestAnimationFrame), Transport timing events pass in the exact time of the scheduled event in the argument of the callback function.
A single transport is created for you when the library is initialized.
The transport emits "start", "stop", "pause", and "loop" events.
Example