Tone.Sequence

↳ EXTENDS Tone.Part

A sequence is an alternate notation of a part. Instead of passing in an array of [time, event] pairs, pass in an array of events which will be spaced at the given subdivision. Sub-arrays will subdivide that beat by the number of items are in the array. Sequence notation inspiration from Tidal

CONSTRUCTOR

new Tone.Sequence (
callback
,
events
,
subdivision
)
callback

The callback to invoke with every note

type: function
events

The sequence

type: Array
subdivision

The subdivision between which events are placed.

type: Time

DEFAULTS

{
subdivision : 4n
}

EXAMPLE

var seq = new Tone.Sequence(function(time, note){
	console.log(note);
//straight quater notes
}, ["C4", "E4", "G4", "A4"], "4n");
 

EXAMPLE

var seq = new Tone.Sequence(function(time, note){
	console.log(note);
//subdivisions are given as subarrays
}, ["C4", ["E4", "D4", "E4"], "G4", ["A4", "G4"]]);

Members

.subdivision

Time READONLY #

The subdivision of the sequence. This can only be set in the constructor. The subdivision is the interval between successive steps.

</>
inherited from Tone.Event

.mute

Boolean #

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

</>
inherited from Tone.Event

.callback

function #

The callback to invoke.

</>
inherited from Tone.Event

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

</>
inherited from Tone.Event

.state

String READONLY #

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

</>
inherited from Tone.Part

.length

Positive READONLY #

The number of scheduled notes in the part.

</>
inherited from Tone.Part

.playbackRate

Positive #

The playback rate of the part

</>
inherited from Tone.Part

.probability

NormalRange #

The probability of the notes being triggered.

</>
inherited from Tone.Part

.loop

Boolean or Positive #

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

EXAMPLE

//loop the part 8 times
part.loop = 8;
</>
inherited from Tone.Part

.loopEnd

TransportTime #

The loopEnd point determines when it will loop if Tone.Part.loop is true.

</>
inherited from Tone.Part

.loopStart

TransportTime #

The loopStart point determines when it will loop if Tone.Part.loop is true.

</>

Methods

.add ( )

#
index

The index to add the event to

type: Number
value

The value to add at that index

type: *
↪ returns Tone.Sequence

this

Add an event at an index, if there’s already something at that index, overwrite it. If value is an array, it will be parsed as a subsequence.

</>

.at ( )

#
index

The index to get or set

value

Optionally pass in the value to set at the given index.

type: *

Get/Set an index of the sequence. If the index contains a subarray, a Tone.Sequence representing that sub-array will be returned.

EXAMPLE

var sequence = new Tone.Sequence(playNote, ["E4", "C4", "F#4", ["A4", "Bb3"]])
sequence.at(0)// => returns "E4"
//set a value
sequence.at(0, "G3");
//get a nested sequence
sequence.at(3).at(1)// => returns "Bb3"
</>

.dispose ( )

#
↪ returns Tone.Sequence

this

Clean up.

</>

.remove ( )

#
index

The index of the event to remove

type: Number
↪ returns Tone.Sequence

this

Remove a value from the sequence by index

</>
inherited from Tone.Part

.stop ( )

#
time

When to stop the part.

↪ returns Tone.Part

this

Stop the part at the given time.

</>
inherited from Tone.Part

.removeAll ( )

#
↪ returns Tone.Part

this

Remove all of the notes from the group.

</>
inherited from Tone.Part

.cancel ( )

#
after

The time after which to cancel the scheduled events.

↪ returns Tone.Part

this

Cancel scheduled state change events: i.e. “start” and “stop”.

</>
inherited from Tone.Part

.start ( )

#
time

When to start the part.

offset

The offset from the start of the part to begin playing at.

type: Time
optional
↪ returns Tone.Part

this

Start the part at the given time.

</>
docs generated Sep 15 2019