Pass in a constructor as the first argument
Optionalcontext: BaseContextOptionaloptions: Partial<ToneWithContextOptions>The amount of time before the scheduled time that the callback can be invoked. Default is half the time of an animation frame (0.008 seconds).
ReadonlycontextThe context belonging to the node.
Set this debug flag to log all events that happen in this class.
The duration after which events are not invoked.
ReadonlynameThe name of the class
StaticversionThe version number semver
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.
The duration in seconds of one sample.
Protected_Get a subset of the properties which are in the partial props
Cancel events scheduled after the given time
Optionalafter: Time
Time after which scheduled events will be removed from the scheduling timeline.
disconnect and dispose.
Get the object's attributes.
ProtectedlogPrints the outputs to the console log for debugging purposes.
Prints the contents only if either the object has a property
called debug set to true, or a variable called TONE_DEBUG_CLASS
is set to the name of the class.
Schedule a function at the given time to be invoked on the nearest animation frame.
Callback is invoked at the given time.
The time relative to the AudioContext time to invoke the callback.
Set multiple properties at once with an object.
Convert the incoming time to seconds. This is calculated against the current TransportClass bpm
Optionaltime: TimeConvert the input time into ticks
Optionaltime: Time | TimeClass<number, TimeBaseUnit>StaticgetReturns all of the default options belonging to the class.
Draw is useful for synchronizing visuals and audio events. Callbacks from Tone.Transport or any of the Tone.Event classes always happen before the scheduled time and are not synchronized to the animation frame so they are not good for triggering tightly synchronized visuals and sound. Draw makes it easy to schedule callbacks using the AudioContext time and uses requestAnimationFrame.
Example