Tone.TickSource
↳ EXTENDS ToneUses Tone.TickSignal to track elapsed ticks with complex automation curves.
CONSTRUCTOR
new Tone.TickSource (The initial frequency that the signal ticks at
A parameter to control (such as playbackRate)
DEFAULTS
Members
.seconds
↝ Seconds #The time since ticks=0 that the TickSource has been running. Accounts for tempo curves
.state
↝ Tone.State READONLY #Returns the playback state of the source, either “started”, “stopped” or “paused”.
.ticks
↝ Ticks #The number of times the callback was invoked. Starts counting at 0 and increments after the callback was invoked. Returns -1 when stopped.
Methods
.stop ( )
#The time when the clock should stop.
this
Stop the clock. Stopping the clock resets the tick counter to 0.
EXAMPLE
.forEachTickBetween ( )
#The beginning of the search range
The end of the search range
The callback to invoke with each tick
this
Invoke the callback event at all scheduled ticks between the start time and the end time
.getSecondsAtTime ( )
#Return the elapsed seconds at the given time.
.getTicksAtTime ( )
#Get the elapsed ticks at the given time
.getTimeOfTick ( )
#The tick number.
When to measure the tick value from.
The time of the tick
Get the time of the given tick. The second argument is when to test before. Since ticks can be set (with setTicksAtTime) there may be multiple times for a given tick value.
.pause ( )
#The time when the clock should stop.
this
Pause the clock. Pausing does not reset the tick counter.
.setTicksAtTime ( )
#The tick value to set
When to set the tick value
this
Set the clock’s ticks at the given time.
.start ( )
#The time the clock should start
The number of ticks to start the source at
this
Start the clock at the given time. Optionally pass in an offset of where to start the tick counter from.
.cancel ( )
#When to clear the events after
this
Cancel start/stop/pause and setTickAtTime events scheduled after the given time.