Optionaloptions: Partial<TransportOptions>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[]) => void
The 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
StaticversionThe version number semver
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.
Returns the playback state of the source, 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.
Protected_Get a subset of the properties which are in the partial props
Remove scheduled events from the timeline after the given time. Repeated events will be removed if their startTime is after the given time
Optionalafter: Time
Clear all events after this time.
Clear the passed in event id from the timeline
The id of the event.
Clean up.
Get the object's attributes.
Return the elapsed seconds at the given time.
When to get the elapsed seconds
The number of elapsed seconds
Get the clock's ticks at the given time.
Optionaltime: Time
When to get the tick value
The tick value at the given time.
ProtectedlogPrints the outputs to the console log for debugging purposes.
Prints the contents only if either the object has a property
called debug set to true, or a variable called TONE_DEBUG_CLASS
is set to the name of the class.
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.
Optionalsubdivision: Time
The subdivision to quantize to
The context time of the next subdivision.
Pause the transport and all sources synced to the transport.
Optionaltime: TimeSchedule an event along the timeline.
The callback to be invoked at the time.
The time to invoke the callback at.
The id of the event which can be used for canceling 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 along the timeline. The event will fire
at the interval starting at the startTime and for the specified
duration.
The callback to invoke.
The duration between successive callbacks. Must be a positive number.
OptionalstartTime: Time | TransportTimeClass<number>
When along the timeline the events should start being invoked.
Optionalduration: Time
How long the event should repeat.
The ID of the scheduled event. Use this to cancel the event.
Set multiple properties at once with an object.
Stop the transport and all sources synced to the transport.
Optionaltime: Time
The time when the transport should stop.
Attaches the signal to the tempo control signal so that any changes in the tempo will change the signal in the same ratio.
Optionalratio: number
Optionally pass in the ratio between the two signals. Otherwise it will be computed based on their current values.
Toggle the current state of the transport. If it is started, it will stop it, otherwise it will start the Transport.
Optionaltime: Time
The time of the event
Convert the incoming time to seconds. This is calculated against the current TransportClass bpm
Optionaltime: TimeConvert the input time into ticks
Optionaltime: Time | TimeClass<number, TimeBaseUnit>Unsyncs a previously synced signal from the transport's control.
StaticgetReturns all of the default options belonging to the class.
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. Pass that time value to the object you're scheduling.
A single transport is created for you when the library is initialized.
The transport emits the events: "start", "stop", "pause", and "loop" which are called with the time of that event as the argument.
Example