Tone.Context

↳ EXTENDS Tone.Emitter

Wrapper around the native AudioContext.

CONSTRUCTOR

new Tone.Context ( [
context
] )
context

optionally pass in a context

type: AudioContext
optional

Members

.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

//set the lookAhead to 0.3 seconds
Tone.context.latencyHint = 0.3;
</>

Methods

.getConstant ( )

#
val
type: Number
↪ returns BufferSourceNode

Generate a looped buffer at some constant value.

</>

.now ( )

#
↪ returns Number

The current audio context time

</>
↳ inherited from Tone.Emitter

.dispose ( )

#
↪ returns Tone.Emitter

this

Clean up

</>
↳ inherited from Tone.Emitter

.emit ( )

#
event

The name of the event.

type: String
type:
↪ returns Tone.Emitter

this

Invoke all of the callbacks bound to the event with any arguments passed in.

</>
↳ inherited from Tone.Emitter

.off ( )

#
event

The event to stop listening to.

type: String
callback

The callback which was bound to the event with Tone.Emitter.on. If no callback is given, all callbacks events are removed.

optional
↪ returns Tone.Emitter

this

Remove the event listener.

</>
↳ inherited from Tone.Emitter

.on ( )

#
event

The name of the event to listen for.

type: String
callback

The callback to invoke when the event is emitted

↪ returns Tone.Emitter

this

Bind a callback to a specific event.

</>
docs generated Sep 15 2019