Interface BaseAudioContext
audioWorklet: AudioWorklet;
currentTime: number;
destination: AudioDestinationNode;
listener: AudioListener;
onstatechange: (this: BaseAudioContext, ev: Event) => any;
sampleRate: number;
state: AudioContextState;
addEventListener<K extends "statechange">(
type: K,
listener: (this: BaseAudioContext, ev: BaseAudioContextEventMap[K]) => any,
options?: boolean | AddEventListenerOptions,
): void;
addEventListener(
type: string,
listener: EventListenerOrEventListenerObject,
options?: boolean | AddEventListenerOptions,
): void;
createAnalyser(): AnalyserNode;
createBiquadFilter(): BiquadFilterNode;
createBuffer(
numberOfChannels: number,
length: number,
sampleRate: number,
): AudioBuffer;
createBufferSource(): AudioBufferSourceNode;
createChannelMerger(numberOfInputs?: number): ChannelMergerNode;
createChannelSplitter(numberOfOutputs?: number): ChannelSplitterNode;
createConstantSource(): ConstantSourceNode;
createConvolver(): ConvolverNode;
createDelay(maxDelayTime?: number): DelayNode;
createDynamicsCompressor(): DynamicsCompressorNode;
createGain(): GainNode;
createIIRFilter(feedforward: number[], feedback: number[]): IIRFilterNode;
createIIRFilter(
feedforward: Iterable<number>,
feedback: Iterable<number>,
): IIRFilterNode;
createOscillator(): OscillatorNode;
createPanner(): PannerNode;
createPeriodicWave(
real: number[] | Float32Array,
imag: number[] | Float32Array,
constraints?: PeriodicWaveConstraints,
): PeriodicWave;
createPeriodicWave(
real: Iterable<number>,
imag: Iterable<number>,
constraints?: PeriodicWaveConstraints,
): PeriodicWave;
createScriptProcessor(
bufferSize?: number,
numberOfInputChannels?: number,
numberOfOutputChannels?: number,
): ScriptProcessorNode;
createStereoPanner(): StereoPannerNode;
createWaveShaper(): WaveShaperNode;
decodeAudioData(
audioData: ArrayBuffer,
successCallback?: DecodeSuccessCallback,
errorCallback?: DecodeErrorCallback,
): Promise<AudioBuffer>;
dispatchEvent(event: Event): boolean;
removeEventListener<K extends "statechange">(
type: K,
listener: (this: BaseAudioContext, ev: BaseAudioContextEventMap[K]) => any,
options?: boolean | EventListenerOptions,
): void;
removeEventListener(
type: string,
listener: EventListenerOrEventListenerObject,
options?: boolean | EventListenerOptions,
): void;
}
Hierarchy
- EventTarget
- BaseAudioContext (View Summary)
Index
Properties
Methods
Properties
ReadonlyaudioWorklet
Available only in secure contexts.
ReadonlycurrentTime
Readonlydestination
Readonlylistener
onstatechange
ReadonlysampleRate
Readonlystate
Methods
addEventListener
- addEventListener<K extends "statechange">(
type: K,
listener: (this: BaseAudioContext, ev: BaseAudioContextEventMap[K]) => any,
options?: boolean | AddEventListenerOptions,
): void 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.
Type Parameters
Parameters
- type: K
- listener: (this: BaseAudioContext, ev: BaseAudioContextEventMap[K]) => any
Optionaloptions: boolean | AddEventListenerOptions
Returns void
- addEventListener(
type: string,
listener: EventListenerOrEventListenerObject,
options?: boolean | AddEventListenerOptions,
): void 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.
Parameters
- type: string
- listener: EventListenerOrEventListenerObject
Optionaloptions: boolean | AddEventListenerOptions
Returns void
createAnalyser
- createAnalyser(): AnalyserNode
Returns AnalyserNode
createBiquadFilter
- createBiquadFilter(): BiquadFilterNode
Returns BiquadFilterNode
createBuffer
- createBuffer(
numberOfChannels: number,
length: number,
sampleRate: number,
): AudioBuffer Parameters
- numberOfChannels: number
- length: number
- sampleRate: number
Returns AudioBuffer
createBufferSource
- createBufferSource(): AudioBufferSourceNode
Returns AudioBufferSourceNode
createChannelMerger
- createChannelMerger(numberOfInputs?: number): ChannelMergerNode
Parameters
OptionalnumberOfInputs: number
Returns ChannelMergerNode
createChannelSplitter
- createChannelSplitter(numberOfOutputs?: number): ChannelSplitterNode
Parameters
OptionalnumberOfOutputs: number
Returns ChannelSplitterNode
createConstantSource
- createConstantSource(): ConstantSourceNode
Returns ConstantSourceNode
createConvolver
- createConvolver(): ConvolverNode
Returns ConvolverNode
createDelay
createDynamicsCompressor
- createDynamicsCompressor(): DynamicsCompressorNode
Returns DynamicsCompressorNode
createGain
createIIRFilter
- createIIRFilter(feedforward: number[], feedback: number[]): IIRFilterNode
Parameters
- feedforward: number[]
- feedback: number[]
Returns IIRFilterNode
- createIIRFilter(
feedforward: Iterable<number>,
feedback: Iterable<number>,
): IIRFilterNode Returns IIRFilterNode
createOscillator
- createOscillator(): OscillatorNode
Returns OscillatorNode
createPanner
- createPanner(): PannerNode
Returns PannerNode
createPeriodicWave
- createPeriodicWave(
real: number[] | Float32Array,
imag: number[] | Float32Array,
constraints?: PeriodicWaveConstraints,
): PeriodicWave Parameters
- real: number[] | Float32Array
- imag: number[] | Float32Array
Optionalconstraints: PeriodicWaveConstraints
Returns PeriodicWave
- createPeriodicWave(
real: Iterable<number>,
imag: Iterable<number>,
constraints?: PeriodicWaveConstraints,
): PeriodicWave Parameters
- real: Iterable<number>
- imag: Iterable<number>
Optionalconstraints: PeriodicWaveConstraints
Returns PeriodicWave
createScriptProcessor
- createScriptProcessor(
bufferSize?: number,
numberOfInputChannels?: number,
numberOfOutputChannels?: number,
): ScriptProcessorNode Parameters
OptionalbufferSize: numberOptionalnumberOfInputChannels: numberOptionalnumberOfOutputChannels: number
Returns ScriptProcessorNode
createStereoPanner
- createStereoPanner(): StereoPannerNode
Returns StereoPannerNode
createWaveShaper
- createWaveShaper(): WaveShaperNode
Returns WaveShaperNode
decodeAudioData
- decodeAudioData(
audioData: ArrayBuffer,
successCallback?: DecodeSuccessCallback,
errorCallback?: DecodeErrorCallback,
): Promise<AudioBuffer> Parameters
- audioData: ArrayBuffer
OptionalsuccessCallback: DecodeSuccessCallbackOptionalerrorCallback: DecodeErrorCallback
Returns Promise<AudioBuffer>
dispatchEvent
removeEventListener
- removeEventListener<K extends "statechange">(
type: K,
listener: (this: BaseAudioContext, ev: BaseAudioContextEventMap[K]) => any,
options?: boolean | EventListenerOptions,
): void Removes the event listener in target's event listener list with the same type, callback, and options.
Type Parameters
Parameters
- type: K
- listener: (this: BaseAudioContext, ev: BaseAudioContextEventMap[K]) => any
Optionaloptions: boolean | EventListenerOptions
Returns void
- removeEventListener(
type: string,
listener: EventListenerOrEventListenerObject,
options?: boolean | EventListenerOptions,
): void Removes the event listener in target's event listener list with the same type, callback, and options.
Parameters
- type: string
- listener: EventListenerOrEventListenerObject
Optionaloptions: boolean | EventListenerOptions
Returns void
EventTarget is a DOM interface implemented by objects that can receive events and may have listeners for them.
MDN Reference