Tone.Loop

↳ EXTENDS Tone

Tone.Loop creates a looped callback at the specified interval. The callback can be started, stopped and scheduled along the Transport’s timeline.

CONSTRUCTOR

new Tone.Loop (
callback
,
interval
)
callback

The callback to invoke with the event.

type: function
interval

The time between successive callback calls.

type: Time

DEFAULTS

{
interval : 4n ,
callback : Tone.noOp ,
playbackRate : 1 ,
iterations : Infinity ,
probability : true ,
mute : false
}

EXAMPLE

var loop = new Tone.Loop(function(time){
	//triggered every eighth note. 
	console.log(time);
}, "8n").start(0);
Tone.Transport.start();
 

Members

.state

String READONLY #

The state of the Loop, either started or stopped.

</>

.humanize

Boolean or Time #

Random variation +/-0.01s to the scheduled time. Or give it a time value which it will randomize by.

</>

.interval

Time #

The time between successive callbacks.

EXAMPLE

loop.interval = "8n"; //loop every 8n
 
</>

.iterations

Positive #

The number of iterations of the loop. The default value is Infinity (loop forever).

</>

.mute

Boolean #

Muting the Loop means that no callbacks are invoked.

</>

.playbackRate

Time #

The playback rate of the loop. The normal playback rate is 1 (no change). A playbackRate of 2 would be twice as fast.

</>

.probability

NormalRange #

The probably of the callback being invoked.

</>

.progress

NormalRange READONLY #

The progress of the loop as a value between 0-1. 0, when the loop is stopped or done iterating.

</>

.callback

function #

The callback to invoke with the next event in the pattern

</>

Methods

.cancel ( )

#
time

The time after which events will be cancel.

default: 0
↪ returns Tone.Loop

this

Cancel all scheduled events greater than or equal to the given time

</>

.dispose ( )

#
↪ returns Tone.Loop

this

Clean up

</>

.start ( )

#
time

When to start the Loop.

optional
↪ returns Tone.Loop

this

Start the loop at the specified time along the Transport’s timeline.

</>

.stop ( )

#
time

When to stop the Arpeggio

optional
↪ returns Tone.Loop

this

Stop the loop at the given time.

</>
docs generated Sep 15 2019