Tone.OfflineContext
↳ EXTENDS Tone.ContextWrapper around the OfflineAudioContext
CONSTRUCTOR
new Tone.OfflineContext (The number of channels to render
The duration to render in samples
the sample rate to render at
Members
.clockSource
↝ String #What the source of the clock is, either “worker” (Web Worker [default]), “timeout” (setTimeout), or “offline” (none).
.latencyHint
↝ String or Seconds #The type of playback, which affects tradeoffs between audio output latency and responsiveness. In addition to setting the value in seconds, the latencyHint also accepts the strings “interactive” (prioritizes low latency), “playback” (prioritizes sustained playback), “balanced” (balances latency and performance), and “fastest” (lowest latency, might glitch more often).
EXAMPLE
.lookAhead
↝ Number #The amount of time events are scheduled into the future
.updateInterval
↝ Number #How often the Web Worker callback is invoked. This number corresponds to how responsive the scheduling can be. Context.updateInterval + Context.lookAhead gives you the total latency between scheduling an event and hearing it.
Methods
.resume ( )
#Overwrite resume, should not do anything in the OfflineAudioContext.
.setTimeout ( )
#The callback to invoke
The timeout in seconds
ID to use when invoking Tone.Context.clearTimeout
A setTimeout which is gaurenteed by the clock source. Also runs in the offline context.
.dispose ( )
#this
Unlike other dispose methods, this returns a Promise which executes when the context is closed and disposed
.getConstant ( )
#Generate a looped buffer at some constant value.
.clearTimeout ( )
#The ID returned from setTimeout
this
Clears a previously scheduled timeout with Tone.context.setTimeout
.once ( )
#The name of the event to listen for.
The callback to invoke when the event is emitted
this
Bind a callback which is only invoked once
.off ( )
#The event to stop listening to.
The callback which was bound to the event with Tone.Emitter.on. If no callback is given, all callbacks events are removed.
this
Remove the event listener.
.emit ( )
#The name of the event.
The arguments to pass to the functions listening.
this
Invoke all of the callbacks bound to the event with any arguments passed in.
.on ( )
#The name of the event to listen for.
The callback to invoke when the event is emitted
this
Bind a callback to a specific event.