Tone.Transport↳ EXTENDS Tone.Emitter
Transport for timing musical events. Supports tempo curves and time changes. Unlike browser-based timing (setInterval, requestAnimationFrame) Tone.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.
CONSTRUCTORnew Tone.Transport ( )
.PPQ↝ Number #
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.
.loopStart↝ Time #
When the Tone.Transport.loop = true, this is the starting position of the loop.
.position↝ BarsBeatsSixteenths #
The Transport’s position in Bars:Beats:Sixteenths. Setting the value will jump to that position right away.
.progress↝ NormalRange #
The Transport’s loop position as a normalized value. Always returns 0 if the transport if loop is not true.
.seconds↝ Seconds #
The Transport’s position in seconds Setting the value will jump to that position right away.
.state↝ Tone.State READONLY #
Returns the playback state of the source, either “started”, “stopped”, or “paused”
.swing↝ NormalRange #
The swing value. Between 0-1 where 1 equal to the note + half the subdivision.
.swingSubdivision↝ Time #
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.
.timeSignature↝ Number or Array #
The time signature as just the numerator over 4. For example 4/4 would be just 4 and 6/8 would be 3.
.cancel ( )#
Clear all events after this time.
Remove scheduled events from the timeline after the given time. Repeated events will be removed if their startTime is after the given time
.clear ( )#
Clear the passed in event id from the timeline
.getSecondsAtTime ( )#
Return the elapsed seconds at the given time.
.getTicksAtTime ( )#
Get the clock’s ticks at the given time.
.nextSubdivision ( )#
The subdivision to quantize to
The context time of the next subdivision.
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.
.pause ( )#
Pause the transport and all sources synced to the transport.
.schedule ( )#
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 along the timeline.
.scheduleOnce ( )#
The callback to invoke once.
The time the callback should be invoked.
The ID of the scheduled event.
Schedule an event that will be removed after it is invoked. Note that if the given time is less than the current transport time, the event will be invoked immediately.
.scheduleRepeat ( )#
The callback to invoke.
The duration between successive callbacks. Must be a positive number.
When along the timeline the events should start being invoked.
How long the event should repeat.
The ID of the scheduled event. Use this to cancel the event.
Schedule a repeated event along the timeline. The event will fire at the
interval starting at the
startTime and for the specified
.setLoopPoints ( )#
Set the loop start and stop at the same time.
.start ( )#
The time when the transport should start.
The timeline offset to start the transport.
Start the transport and all sources synced to the transport.
.stop ( )#
Stop the transport and all sources synced to the transport.
.syncSignal ( )#
Optionally pass in the ratio between the two signals. Otherwise it will be computed based on their current values.
Attaches the signal to the tempo control signal so that any changes in the tempo will change the signal in the same ratio.
.toggle ( )#
Toggle the current state of the transport. If it is started, it will stop it, otherwise it will start the Transport.
.unsyncSignal ( )#
Unsyncs a previously synced signal from the transport’s control. See Tone.Transport.syncSignal.
.emit ( )#
The name of the event.
The arguments to pass to the functions listening.
Invoke all of the callbacks bound to the event with any arguments passed in.
.off ( )#
The event to stop listening to.
The callback which was bound to the event with Tone.Emitter.on. If no callback is given, all callbacks events are removed.
Remove the event listener.
.on ( )#
The name of the event to listen for.
The callback to invoke when the event is emitted
Bind a callback to a specific event.