Skip to content

AudioContext

Values

addEventListener

Appends an event listener for events whose type attribute value is type. The callback argument sets the callback that will be invoked when the event is dispatched.

The options argument sets listener-specific options. For compatibility this can be a boolean, in which case the method behaves exactly as if the value was specified as options's capture.

When set to true, options's capture prevents callback from being invoked when the event's eventPhase attribute value is BUBBLING_PHASE. When false (or not present), callback will not be invoked when event's eventPhase attribute value is CAPTURING_PHASE. Either way, callback will be invoked if event's eventPhase attribute value is AT_TARGET.

When set to true, options's passive indicates that the callback will not cancel the event by invoking preventDefault(). This is used to enable performance optimizations described in § 2.8 Observing event listeners.

When set to true, options's once indicates that the callback will only be invoked once after which the event listener will be removed.

If an AbortSignal is passed for options's signal, then the event listener will be removed when signal is aborted.

The event listener is appended to target's event listener list and is not appended if it has the same type, callback, and capture. Read more on MDN

let addEventListener: (
WebAPI.WebAudioAPI.audioContext,
~type_: WebAPI.EventAPI.eventType,
~callback: WebAPI.EventAPI.eventListener<'event>,
~options: WebAPI.EventAPI.addEventListenerOptions=?,
) => unit

addEventListener_useCapture

Appends an event listener for events whose type attribute value is type. The callback argument sets the callback that will be invoked when the event is dispatched.

The options argument sets listener-specific options. For compatibility this can be a boolean, in which case the method behaves exactly as if the value was specified as options's capture.

When set to true, options's capture prevents callback from being invoked when the event's eventPhase attribute value is BUBBLING_PHASE. When false (or not present), callback will not be invoked when event's eventPhase attribute value is CAPTURING_PHASE. Either way, callback will be invoked if event's eventPhase attribute value is AT_TARGET.

When set to true, options's passive indicates that the callback will not cancel the event by invoking preventDefault(). This is used to enable performance optimizations described in § 2.8 Observing event listeners.

When set to true, options's once indicates that the callback will only be invoked once after which the event listener will be removed.

If an AbortSignal is passed for options's signal, then the event listener will be removed when signal is aborted.

The event listener is appended to target's event listener list and is not appended if it has the same type, callback, and capture. Read more on MDN

let addEventListener_useCapture: (
WebAPI.WebAudioAPI.audioContext,
~type_: WebAPI.EventAPI.eventType,
~callback: WebAPI.EventAPI.eventListener<'event>,
) => unit

asBaseAudioContext

let asBaseAudioContext: WebAPI.WebAudioAPI.audioContext => WebAPI.WebAudioAPI.baseAudioContext

asEventTarget

let asEventTarget: WebAPI.WebAudioAPI.audioContext => WebAPI.EventAPI.eventTarget

close

let close: WebAPI.WebAudioAPI.audioContext => Promise.t<unit>

Parameters

WebAPI.WebAudioAPI.audioContext

Return type

Promise.t< unit >

createAnalyser

let createAnalyser: WebAPI.WebAudioAPI.audioContext => WebAPI.WebAudioAPI.analyserNode

createBiquadFilter

let createBiquadFilter: WebAPI.WebAudioAPI.audioContext => WebAPI.WebAudioAPI.biquadFilterNode

createBuffer

let createBuffer: (
WebAPI.WebAudioAPI.audioContext,
~numberOfChannels: int,
~length: int,
~sampleRate: float,
) => WebAPI.WebAudioAPI.audioBuffer

createBufferSource

let createBufferSource: WebAPI.WebAudioAPI.audioContext => WebAPI.WebAudioAPI.audioBufferSourceNode

createChannelMerger

let createChannelMerger: (
WebAPI.WebAudioAPI.audioContext,
~numberOfInputs: int=?,
) => WebAPI.WebAudioAPI.channelMergerNode

createChannelSplitter

let createChannelSplitter: (
WebAPI.WebAudioAPI.audioContext,
~numberOfOutputs: int=?,
) => WebAPI.WebAudioAPI.channelSplitterNode

createConstantSource

let createConstantSource: WebAPI.WebAudioAPI.audioContext => WebAPI.WebAudioAPI.constantSourceNode

createConvolver

let createConvolver: WebAPI.WebAudioAPI.audioContext => WebAPI.WebAudioAPI.convolverNode

createDelay

let createDelay: (
WebAPI.WebAudioAPI.audioContext,
~maxDelayTime: float=?,
) => WebAPI.WebAudioAPI.delayNode

Parameters

WebAPI.WebAudioAPI.audioContext option< float >

Return type

WebAPI.WebAudioAPI.delayNode

createDynamicsCompressor

let createDynamicsCompressor: WebAPI.WebAudioAPI.audioContext => WebAPI.WebAudioAPI.dynamicsCompressorNode

createGain

let createGain: WebAPI.WebAudioAPI.audioContext => WebAPI.WebAudioAPI.gainNode

createIIRFilter

let createIIRFilter: (
WebAPI.WebAudioAPI.audioContext,
~feedforward: array<float>,
~feedback: array<float>,
) => WebAPI.WebAudioAPI.iirFilterNode

Parameters

WebAPI.WebAudioAPI.audioContext array< float > array< float >

Return type

WebAPI.WebAudioAPI.iirFilterNode

createMediaElementSource

let createMediaElementSource: (
WebAPI.WebAudioAPI.audioContext,
WebAPI.DOMAPI.htmlMediaElement,
) => WebAPI.WebAudioAPI.mediaElementAudioSourceNode

createMediaStreamDestination

let createMediaStreamDestination: WebAPI.WebAudioAPI.audioContext => WebAPI.WebAudioAPI.mediaStreamAudioDestinationNode

createMediaStreamSource

let createMediaStreamSource: (
WebAPI.WebAudioAPI.audioContext,
WebAPI.MediaCaptureAndStreamsAPI.mediaStream,
) => WebAPI.WebAudioAPI.mediaStreamAudioSourceNode

createOscillator

let createOscillator: WebAPI.WebAudioAPI.audioContext => WebAPI.WebAudioAPI.oscillatorNode

createPanner

let createPanner: WebAPI.WebAudioAPI.audioContext => WebAPI.WebAudioAPI.pannerNode

createPeriodicWave

let createPeriodicWave: (
WebAPI.WebAudioAPI.audioContext,
~real: array<float>,
~imag: array<float>,
~constraints: WebAPI.WebAudioAPI.periodicWaveConstraints=?,
) => WebAPI.WebAudioAPI.periodicWave

createStereoPanner

let createStereoPanner: WebAPI.WebAudioAPI.audioContext => WebAPI.WebAudioAPI.stereoPannerNode

createWaveShaper

let createWaveShaper: WebAPI.WebAudioAPI.audioContext => WebAPI.WebAudioAPI.waveShaperNode

decodeAudioData

let decodeAudioData: (
WebAPI.WebAudioAPI.audioContext,
~audioData: ArrayBuffer.t,
~successCallback: WebAPI.WebAudioAPI.decodeSuccessCallback=?,
~errorCallback: WebAPI.WebAudioAPI.decodeErrorCallback=?,
) => Promise.t<WebAPI.WebAudioAPI.audioBuffer>

dispatchEvent

Dispatches a synthetic event event to target and returns true if either event's cancelable attribute value is false or its preventDefault() method was not invoked, and false otherwise. Read more on MDN

let dispatchEvent: (
WebAPI.WebAudioAPI.audioContext,
WebAPI.EventAPI.event,
) => bool

getOutputTimestamp

let getOutputTimestamp: WebAPI.WebAudioAPI.audioContext => WebAPI.WebAudioAPI.audioTimestamp

make

let make: (
~contextOptions: WebAPI.WebAudioAPI.audioContextOptions=?,
) => WebAPI.WebAudioAPI.audioContext

removeEventListener

Removes the event listener in target's event listener list with the same type, callback, and options. Read more on MDN

let removeEventListener: (
WebAPI.WebAudioAPI.audioContext,
~type_: WebAPI.EventAPI.eventType,
~callback: WebAPI.EventAPI.eventListener<'event>,
~options: WebAPI.EventAPI.eventListenerOptions=?,
) => unit

removeEventListener_useCapture

Removes the event listener in target's event listener list with the same type, callback, and options. Read more on MDN

let removeEventListener_useCapture: (
WebAPI.WebAudioAPI.audioContext,
~type_: WebAPI.EventAPI.eventType,
~callback: WebAPI.EventAPI.eventListener<'event>,
) => unit

resume

let resume: WebAPI.WebAudioAPI.audioContext => Promise.t<unit>

Parameters

WebAPI.WebAudioAPI.audioContext

Return type

Promise.t< unit >

suspend

let suspend: WebAPI.WebAudioAPI.audioContext => Promise.t<unit>

Parameters

WebAPI.WebAudioAPI.audioContext

Return type

Promise.t< unit >