BaseAudioContext interface acts as a base definition for online and offline audio-processing graphs, as represented by
OfflineAudioContext respectively. You wouldn't use
BaseAudioContext directly — you'd use its features via one of these two inheriting interfaces.
BaseAudioContext can be a target of events, therefore it implements the
BaseAudioContext.audioWorklet(en-US) 实验性 只读
Returns a double representing an ever-increasing hardware time in seconds used for scheduling. It starts at
AudioDestinationNoderepresenting the final destination of all audio in the context. It can be thought of as the audio-rendering device.
AudioListenerobject, used for 3D spatialization.
Returns a float representing the sample rate (in samples per second) used by all nodes in this context. The sample-rate of an
AudioContextcannot be changed.
Returns the current state of the
An event handler that runs when an event of type
statechange(en-US) has fired. This occurs when the
AudioContext's state changes, due to the calling of one of the state change methods (
Also implements methods from the interface
Creates a new, empty
AudioBufferobject, which can then be populated by data and played via an
ConstantSourceNode(en-US) object, which is an audio source that continuously outputs a monaural (one-channel) sound signal whose samples all have the same value.
AudioBufferSourceNode, which can be used to play and manipulate audio data contained within an
AudioBuffers are created using
AudioContext.createBufferor returned by
AudioContext.decodeAudioDatawhen it successfully decodes an audio track.
StereoPannerNode(en-US), which can be used to apply stereo panning to an audio source.
AnalyserNode, which can be used to expose audio time and frequency data and for example to create data visualisations.
BiquadFilterNode, which represents a second order filter configurable as several different common filter types: high-pass, low-pass, band-pass, etc.
ChannelMergerNode, which is used to combine channels from multiple audio streams into a single audio stream.
ChannelSplitterNode(en-US), which is used to access the individual channels of an audio stream and process them separately.
ConvolverNode, which can be used to apply convolution effects to your audio graph, for example a reverberation effect.
DelayNode(en-US), 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.
DynamicsCompressorNode, which can be used to apply acoustic compression to an audio signal.
GainNode, which can be used to control the overall volume of the audio graph.
IIRFilterNode(en-US), which represents a second order filter configurable as several different common filter types.
OscillatorNode, a source representing a periodic waveform. It basically generates a tone.
PannerNode(en-US), which is used to spatialise an incoming audio stream in 3D space.
PeriodicWave, used to define a periodic waveform that can be used to determine the output of an
WaveShaperNode, which is used to implement non-linear distortion effects.
Asynchronously decodes audio file data contained in an
ArrayBuffer. In this case, the ArrayBuffer is usually loaded from an
responseattribute after setting the
arraybuffer. This method only works on complete files, not fragments of audio files.
Resumes the progression of time in an audio context that has previously been suspended/paused.
Basic audio context declaration:
var audioCtx = new AudioContext();
Cross browser variant:
var AudioContext = window.AudioContext || window.webkitAudioContext; var audioCtx = new AudioContext(); var oscillatorNode = audioCtx.createOscillator(); var gainNode = audioCtx.createGain(); var finish = audioCtx.destination; // etc.
|Web Audio API |
BCD tables only load in the browser