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 (
.state↝ Tone.State READONLY #
Returns the playback state of the source, either “started”, “stopped” or “paused”.
.pause ( )#
Pause the clock. Pausing does not reset the tick counter.
.setTicksAtTime ( )#
The tick value to set
When to set the tick value
Set the clock’s ticks at the given time.
.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.
.getSecondsAtTime ( )#
Return the elapsed seconds at the given time.
.getStateAtTime ( )#
Returns the scheduled state at the given time.
.getTicksAtTime ( )#
Get the clock’s ticks at the given time.
.nextTickTime ( )#
Get the time of the next tick
.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.
.once ( )#
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
.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.