Tone.Clock↳ EXTENDS Tone.Emitter
A sample accurate clock which provides a callback at the given rate. While the callback is not sample-accurate (it is still susceptible to loose JS timing), the time passed in as the argument to the callback is precise. For most applications, it is better to use Tone.Transport instead of the Clock by itself since you can synchronize multiple callbacks.
CONSTRUCTORnew Tone.Clock (
The callback to be invoked with the time of the audio event
The rate of the callback
.state↝ Tone.State READONLY #
Returns the playback state of the source, either “started”, “stopped” or “paused”.
.ticks↝ Ticks READONLY #
The number of times the callback was invoked. Starts counting at 0 and increments after the callback was invoked.
.pause ( )#
Pause the clock. Pausing does not reset the tick counter.
.start ( )#
The time the clock should start
Where the tick counter starts counting from.
Start the clock at the given time. Optionally pass in an offset of where to start the tick counter from.
.stop ( )#
Stop the clock. Stopping the clock resets the tick counter to 0.
.getStateAtTime ( )#
Returns the scheduled state at the given time.
.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.
.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.
.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.