Tone.TickSource

↳ EXTENDS Tone

Uses Tone.TickSignal to track elapsed ticks with complex automation curves.

CONSTRUCTOR

new Tone.TickSource (
frequency
, [
param
] )
frequency

The initial frequency that the signal ticks at

param

A parameter to control (such as playbackRate)

type: Tone.Param
optional

DEFAULTS

{
frequency : 1
}

Members

.frequency

Frequency #

The frequency the callback function should be invoked.

</>

.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 ( )

#
time

The time when the clock should stop.

type: Time
default: now
↪ returns Tone.TickSource

this

Stop the clock. Stopping the clock resets the tick counter to 0.

EXAMPLE

clock.stop();
</>

.dispose ( )

#
↪ returns Tone.TickSource

this

Clean up

</>

.forEachTickBetween ( )

#
startTime

The beginning of the search range

type: Time
endTime

The end of the search range

type: Time
callback
type:
↪ returns Tone.TickSource

this

Invoke the callback event at all scheduled ticks between the start time and the end time

</>

.getSecondsAtTime ( )

#
time

When to get the elapsed seconds

type: Time
↪ returns Seconds

The number of elapsed seconds

Return the elapsed seconds at the given time.

</>

.getStateAtTime ( )

#
time

The time to query.

type: Time
↪ returns String

The name of the state input in setStateAtTime.

Returns the scheduled state at the given time.

EXAMPLE

source.start("+0.1");
source.getStateAtTime("+0.1"); //returns "started"
</>

.getTicksAtTime ( )

#
time

When to get the tick value

type: Time
↪ returns Ticks

The number of ticks

Get the elapsed ticks at the given time

</>

.getTimeOfTick ( )

#
ticks

The tick number.

type: Ticks
before

When to measure the tick value from.

type: Time
optional
↪ returns Time

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 ( )

#
time

The time when the clock should stop.

type: Time
default: now
↪ returns Tone.TickSource

this

Pause the clock. Pausing does not reset the tick counter.

</>

.setTicksAtTime ( )

#
ticks

The tick value to set

type: Ticks
time

When to set the tick value

type: Time
↪ returns Tone.TickSource

this

Set the clock’s ticks at the given time.

</>

.start ( )

#
time

The time the clock should start

type: Time
optional
offset

The number of ticks to start the source at

type: Ticks
default: 0
↪ returns Tone.TickSource

this

Start the clock at the given time. Optionally pass in an offset of where to start the tick counter from.

</>

.cancel ( )

#
time

When to clear the events after

type: Time
default: now
↪ returns Tone.TickSource

this

Cancel start/stop/pause and setTickAtTime events scheduled after the given time.

</>
docs generated Sep 15 2019