Sequence < ValueType >

  • ValueType: [object Object]

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


const synth = new Tone.Synth().toDestination();
const seq = new Tone.Sequence((time, note) => {
	synth.triggerAttackRelease(note, 0.1, time);
	// subdivisions are given as subarrays
}, ["C4", ["E4", "D4", "E4"], "G4", ["A4", "G4"]]).start(0);
Tone.Transport.start();

Hierarchy

Constructor

new Sequence (
callback?:ToneEventCallback<ValueType > ,

The callback to invoke with every note

events?:SequenceEventDescription<ValueType > ,
subdivision?:Time

The subdivision between which events are placed.

) => Sequence
new Sequence (
options?:Partial<SequenceOptions<ValueType > >
) => Sequence

Properties

blockTime #

readonly Seconds

The number of seconds of 1 processing block (128 samples)


console.log(Tone.Destination.blockTime);

callback #

ToneEventCallback<ValueType >

The callback to invoke.

context #

BaseContext

The context belonging to the node.

debug #

boolean

Set this debug flag to log all events that happen in this class.

disposed #

readonly boolean

Indicates if the instance was disposed. 'Disposing' an instance means that all of the Web Audio nodes that were created for the instance are disconnected and freed for garbage collection.

events #

any []

The sequence

humanize #

boolean | Time

length #

readonly number

The number of scheduled events

loop #

boolean | number

loopEnd #

number

The index at which the sequence should end looping

loopStart #

number

The index at which the sequence should start looping

mute #

boolean

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

name #

string

sampleTime #

readonly Seconds

The duration in seconds of one sample.


console.log(Tone.Transport.sampleTime);

state #

readonly BasicPlaybackState

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

subdivision #

readonly Seconds

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

value #

ValueType

The value which is passed to the callback function.

static version #

string

The version number semver

Methods

cancel #

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

cancel (
time?:TransportTime | TransportTimeClass

The time after which events will be cancel.

) => this

clear #

Clear all of the events

clear ( ) => this

dispose #

disconnect and dispose.

dispose ( ) => this

get #

Get the object's attributes.


const osc = new Tone.Oscillator();
console.log(osc.get());
get ( ) => ToneEventOptions<ValueType >

static getDefaults #

Returns all of the default options belonging to the class.

getDefaults ( ) => SequenceOptions<any >

immediate #

Return the current time of the Context clock without any lookAhead.


setInterval(() => {
	console.log(Tone.immediate());
}, 100);
immediate ( ) => Seconds

now #

Return the current time of the Context clock plus the lookAhead.


setInterval(() => {
	console.log(Tone.now());
}, 100);
now ( ) => Seconds

set #

Set multiple properties at once with an object.


const filter = new Tone.Filter();
// set values using an object
filter.set({
	frequency: 300,
	type: "highpass"
});
set (
props:RecursivePartial<ToneEventOptions<ValueType > >
) => this

start #

Start the part at the given time.

start (
time?:TransportTime ,

When to start the part.

offset?:undefined | number

The offset index to start at

) => this

stop #

Stop the part at the given time.

stop (
time?:TransportTime

When to stop the part.

) => this

toFrequency #

Convert the input to a frequency number


const gain = new Tone.Gain();
console.log(gain.toFrequency("4n"));
toFrequency (
freq:Frequency
) => Hertz

toSeconds #

Convert the incoming time to seconds


const gain = new Tone.Gain();
console.log(gain.toSeconds("4n"));
toSeconds (
time?:Time
) => Seconds

toString #

Convert the class to a string


const osc = new Tone.Oscillator();
console.log(osc.toString());
toString ( ) => string

toTicks #

Convert the input time into ticks


const gain = new Tone.Gain();
console.log(gain.toTicks("4n"));
toTicks (
time?:Time | TimeClass
) => Ticks