BaseAudioContext
package js.html.audio
extends EventTarget
extended by AudioContext, OfflineAudioContext
Available on js
The BaseAudioContext
interface acts as a base definition for online and offline audio-processing graphs, as represented by AudioContext
and OfflineAudioContext
respectively.
Documentation BaseAudioContext by Mozilla Contributors, licensed under CC-BY-SA 2.5.
See also:
Variables
read onlycurrentTime:Float
Returns a double representing an ever-increasing hardware time in seconds used for scheduling. It starts at 0
.
read onlydestination:AudioDestinationNode
Returns an AudioDestinationNode
representing the final destination of all audio in the context. It can be thought of as the audio-rendering device.
read onlylistener:AudioListener
Returns the AudioListener
object, used for 3D spatialization.
onstatechange:Function
An event handler that runs when an event of type statechange
has fired. This occurs when the AudioContext
's state changes, due to the calling of one of the state change methods (AudioContext.suspend
, AudioContext.resume
, or AudioContext.close
).
read onlysampleRate:Float
Returns a float representing the sample rate (in samples per second) used by all nodes in this context. The sample-rate of an AudioContext
cannot be changed.
read onlystate:AudioContextState
Returns the current state of the AudioContext
.
Methods
createAnalyser():AnalyserNode
Creates an AnalyserNode
, which can be used to expose audio time and frequency data and for example to create data visualisations.
Throws:
null |
DOMError |
---|
createBiquadFilter():BiquadFilterNode
Creates a BiquadFilterNode
, which represents a second order filter configurable as several different common filter types: high-pass, low-pass, band-pass, etc
Throws:
null |
DOMError |
---|
createBuffer(numberOfChannels:Int, length:Int, sampleRate:Float):AudioBuffer
Creates a new, empty AudioBuffer
object, which can then be populated by data and played via an AudioBufferSourceNode
.
Throws:
null |
DOMError |
---|
createBufferSource():AudioBufferSourceNode
Creates an AudioBufferSourceNode
, which can be used to play and manipulate audio data contained within an AudioBuffer
object. AudioBuffer
s are created using AudioContext.createBuffer
or returned by AudioContext.decodeAudioData
when it successfully decodes an audio track.
Throws:
null |
DOMError |
---|
createChannelMerger(numberOfInputs:Int = 6):ChannelMergerNode
Creates a ChannelMergerNode
, which is used to combine channels from multiple audio streams into a single audio stream.
Throws:
null |
DOMError |
---|
createChannelSplitter(numberOfOutputs:Int = 6):ChannelSplitterNode
Creates a ChannelSplitterNode
, which is used to access the individual channels of an audio stream and process them separately.
Throws:
null |
DOMError |
---|
createConstantSource():ConstantSourceNode
Creates a ConstantSourceNode
object, which is an audio source that continuously outputs a monaural (one-channel) sound signal whose samples all have the same value.
Throws:
null |
DOMError |
---|
createConvolver():ConvolverNode
Creates a ConvolverNode
, which can be used to apply convolution effects to your audio graph, for example a reverberation effect.
Throws:
null |
DOMError |
---|
createDelay(maxDelayTime:Float = 1.0):DelayNode
Creates a DelayNode
, which is used to delay the incoming audio signal by a certain amount. This node is also useful to create feedback loops in a Web Audio API graph.
Throws:
null |
DOMError |
---|
createDynamicsCompressor():DynamicsCompressorNode
Creates a DynamicsCompressorNode
, which can be used to apply acoustic compression to an audio signal.
Throws:
null |
DOMError |
---|
createGain():GainNode
Creates a GainNode
, which can be used to control the overall volume of the audio graph.
Throws:
null |
DOMError |
---|
createIIRFilter(feedforward:Array<Float>, feedback:Array<Float>):IIRFilterNode
Creates an IIRFilterNode
, which represents a second order filter configurable as several different common filter types.
Throws:
null |
DOMError |
---|
createOscillator():OscillatorNode
Creates an OscillatorNode
, a source representing a periodic waveform. It basically generates a tone.
Throws:
null |
DOMError |
---|
createPanner():PannerNode
Creates a PannerNode
, which is used to spatialise an incoming audio stream in 3D space.
Throws:
null |
DOMError |
---|
createPeriodicWave(real:Float32Array, imag:Float32Array, ?constraints:Null<PeriodicWaveConstraints>):PeriodicWave
Creates a PeriodicWave
, used to define a periodic waveform that can be used to determine the output of an OscillatorNode
.
Throws:
null |
DOMError |
---|
createScriptProcessor(bufferSize:Int = 0, numberOfInputChannels:Int = 2, numberOfOutputChannels:Int = 2):ScriptProcessorNode
Creates a ScriptProcessorNode
, which can be used for direct audio processing via JavaScript.
Throws:
null |
DOMError |
---|
createStereoPanner():StereoPannerNode
Creates a StereoPannerNode
, which can be used to apply stereo panning to an audio source.
Throws:
null |
DOMError |
---|
createWaveShaper():WaveShaperNode
Creates a WaveShaperNode
, which is used to implement non-linear distortion effects.
Throws:
null |
DOMError |
---|
decodeAudioData(audioData:ArrayBuffer, ?successCallback:AudioBuffer ‑> Void, ?errorCallback:DOMException ‑> Void):Promise<AudioBuffer>
decodeAudioData(audioData:ArrayBuffer, ?successCallback:AudioBuffer ‑> Void, ?errorCallback:() ‑> Void):Promise<AudioBuffer>
Asynchronously decodes audio file data contained in an ArrayBuffer
. In this case, the ArrayBuffer is usually loaded from an XMLHttpRequest
's response
attribute after setting the responseType
to arraybuffer
. This method only works on complete files, not fragments of audio files.
Throws:
null |
DOMError |
---|
resume():Promise<Void>
Resumes the progression of time in an audio context that has previously been suspended/paused.
Throws:
null |
DOMError |
---|
© 2005–2020 Haxe Foundation
Licensed under a MIT license.
https://api.haxe.org/js/html/audio/BaseAudioContext.html