IntervalTimeline

Similar to Tone.Timeline, but all events represent intervals with both "time" and "duration" times. The events are placed in a tree structure optimized for querying an intersection point with the timeline events. Internally uses an Interval Tree to represent the data.

Hierarchy

  • Tone
    • IntervalTimeline

Properties

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.

length #

readonly number

The number of items in the timeline.

static version #

string

The version number semver

Methods

add #

The event to add to the timeline. All events must have a time and duration value

add (
event:IntervalTimelineEvent

The event to add to the timeline

) => this

cancel #

Remove events whose time time is after the given time

cancel (
after:number

The time to query.

) => this

dispose #

Clean up

dispose ( ) => this

forEach #

Iterate over everything in the timeline.

forEach (
callback:IteratorCallback

The callback to invoke with every item

) => this

forEachAtTime #

Iterate over everything in the array in which the given time overlaps with the time and duration time of the event.

forEachAtTime (
time:number ,

The time to check if items are overlapping

callback:IteratorCallback

The callback to invoke with every item

) => this

forEachFrom #

Iterate over everything in the array in which the time is greater than or equal to the given time.

forEachFrom (
time:number ,

The time to check if items are before

callback:IteratorCallback

The callback to invoke with every item

) => this

get #

Get an event whose time and duration span the give time. Will return the match whose "time" value is closest to the given time.

get (
time:number
) => IntervalTimelineEvent | null
The event which spans the desired time

static getDefaults #

Returns all of the default options belonging to the class.

getDefaults ( ) => BaseToneOptions

remove #

Remove an event from the timeline.

remove (
event:IntervalTimelineEvent

The event to remove from the timeline

) => this

toString #

Convert the class to a string


import { Oscillator } from "tone";
const osc = new Oscillator();
console.log(osc.toString());
toString ( ) => string