Tone.Event

↳ EXTENDS Tone

Tone.Event abstracts away Tone.Transport.schedule and provides a schedulable callback for a single or repeatable events along the timeline.

CONSTRUCTOR

new Tone.Event (
callback
,
value
)
callback

The callback to invoke at the time.

type: function
value

The value or values which should be passed to the callback function on invocation.

type: *

DEFAULTS

{
callback : Tone.noOp ,
loop : false ,
loopEnd : 1m ,
loopStart : 0 ,
playbackRate : 1 ,
value : ,
probability : 1 ,
mute : false ,
humanize : false
}

EXAMPLE

var chord = new Tone.Event(function(time, chord){
	//the chord as well as the exact time of the event
	//are passed in as arguments to the callback function
}, ["D4", "E4", "F4"]);
//start the chord at the beginning of the transport timeline
chord.start();
//loop it every measure for 8 measures
chord.loop = 8;
chord.loopEnd = "1m";

Members

.state

String READONLY #

Returns the playback state of the note, either “started” or “stopped”.

</>

.loop

Boolean or Positive #

If the note should loop or not between Tone.Event.loopStart and Tone.Event.loopEnd. An integer value corresponds to the number of loops the Event does after it starts.

</>

.loopEnd

TransportTime #

The loopEnd point is the time the event will loop if Tone.Event.loop is true.

</>

.loopStart

TransportTime #

The time when the loop should start.

</>

.mute

Boolean #

If mute is true, the callback won’t be invoked.

</>

.playbackRate

Positive #

The playback rate of the note. Defaults to 1.

EXAMPLE

note.loop = true;
//repeat the note twice as fast
note.playbackRate = 2;
</>

.probability

NormalRange #

The probability of the notes being triggered.

</>

.progress

NormalRange READONLY #

The current progress of the loop interval. Returns 0 if the event is not started yet or it is not set to loop.

</>

.callback

function #

The callback to invoke.

</>

Methods

.cancel ( )

#
time

The time after which events will be cancel.

default: 0
↪ returns Tone.Event

this

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

</>

.dispose ( )

#
↪ returns Tone.Event

this

Clean up

</>

.start ( )

#
time

When the note should start.

↪ returns Tone.Event

this

Start the note at the given time.

</>

.stop ( )

#
time

When the note should stop.

↪ returns Tone.Event

this

Stop the Event at the given time.

</>
docs generated Sep 15 2019