callback DecodeErrorCallback = void (DOMException error);
callback DecodeSuccessCallback = void (AudioBuffer decodedData);
[Constructor]
interface AudioContext : EventTarget {
readonly attribute AudioDestinationNode destination;
readonly attribute float sampleRate;
readonly attribute double currentTime;
readonly attribute AudioListener listener;
AudioBuffer createBuffer (unsigned long numberOfChannels, unsigned long length, float sampleRate);
Promise<AudioBuffer> decodeAudioData (ArrayBuffer audioData, optional DecodeSuccessCallback successCallback, optional DecodeErrorCallback errorCallback);
AudioBufferSourceNode createBufferSource ();
MediaElementAudioSourceNode createMediaElementSource (HTMLMediaElement mediaElement);
MediaStreamAudioSourceNode createMediaStreamSource (MediaStream mediaStream);
MediaStreamAudioDestinationNode createMediaStreamDestination ();
ScriptProcessorNode createScriptProcessor (optional unsigned long bufferSize = 0 , optional unsigned long numberOfInputChannels = 2 , optional unsigned long numberOfOutputChannels = 2 );
AnalyserNode createAnalyser ();
GainNode createGain ();
DelayNode createDelay (optional double maxDelayTime = 1.0 );
BiquadFilterNode createBiquadFilter ();
WaveShaperNode createWaveShaper ();
PannerNode createPanner ();
ConvolverNode createConvolver ();
ChannelSplitterNode createChannelSplitter (optional unsigned long numberOfOutputs = 6 );
ChannelMergerNode createChannelMerger (optional unsigned long numberOfInputs = 6 );
DynamicsCompressorNode createDynamicsCompressor ();
OscillatorNode createOscillator ();
PeriodicWave createPeriodicWave (Float32Array real, Float32Array imag);
};
[Constructor(unsigned long numberOfChannels, unsigned long length, float sampleRate)]
interface OfflineAudioContext : AudioContext {
Promise<AudioBuffer> startRendering ();
attribute EventHandler oncomplete;
};
interface OfflineAudioCompletionEvent : Event {
readonly attribute AudioBuffer renderedBuffer;
};enum ChannelCountMode {
"max",
"clamped-max",
"explicit"
};enum ChannelInterpretation {
"speakers",
"discrete"
};interface AudioNode : EventTarget {
void connect (AudioNode destination, optional unsigned long output = 0 , optional unsigned long input = 0);
void connect (AudioParam destination, optional unsigned long output = 0 );
void disconnect ();
readonly attribute AudioContext context;
readonly attribute unsigned long numberOfInputs;
readonly attribute unsigned long numberOfOutputs;
attribute unsigned long channelCount;
attribute ChannelCountMode channelCountMode;
attribute ChannelInterpretation channelInterpretation;
};interface AudioDestinationNode : AudioNode {
readonly attribute unsigned long maxChannelCount;
};
interface AudioParam {
attribute float value;
readonly attribute float defaultValue;
void setValueAtTime (float value, double startTime);
void linearRampToValueAtTime (float value, double endTime);
void exponentialRampToValueAtTime (float value, double endTime);
void setTargetAtTime (float target, double startTime, double timeConstant);
void setValueCurveAtTime (Float32Array values, double startTime, double duration);
void cancelScheduledValues (double startTime);
};interface GainNode : AudioNode {
readonly attribute AudioParam gain;
};
interface DelayNode : AudioNode {
readonly attribute AudioParam delayTime;
};
interface AudioBuffer {
readonly attribute float sampleRate;
readonly attribute long length;
readonly attribute double duration;
readonly attribute long numberOfChannels;
Float32Array getChannelData (unsigned long channel);
void copyFromChannel (Float32Array destination, long channelNumber, optional unsigned long startInChannel = 0);
void copyToChannel (Float32Array source, long channelNumber, optional unsigned long startInChannel = 0);
};interface AudioBufferSourceNode : AudioNode {
attribute AudioBuffer? buffer;
readonly attribute AudioParam playbackRate;
attribute boolean loop;
attribute double loopStart;
attribute double loopEnd;
void start (optional double when = 0, optional double offset = 0, optional double duration);
void stop (optional double when = 0);
attribute EventHandler onended;
};
interface MediaElementAudioSourceNode : AudioNode {
};
interface ScriptProcessorNode : AudioNode {
attribute EventHandler onaudioprocess;
readonly attribute long bufferSize;
};
interface AudioProcessingEvent : Event {
readonly attribute double playbackTime;
readonly attribute AudioBuffer inputBuffer;
readonly attribute AudioBuffer outputBuffer;
};enum PanningModelType {
"equalpower",
"HRTF"
};enum DistanceModelType {
"linear",
"inverse",
"exponential"
};interface PannerNode : AudioNode {
attribute PanningModelType panningModel;
void setPosition (double x, double y, double z);
void setOrientation (double x, double y, double z);
void setVelocity (double x, double y, double z);
attribute DistanceModelType distanceModel;
attribute double refDistance;
attribute double maxDistance;
attribute double rolloffFactor;
attribute double coneInnerAngle;
attribute double coneOuterAngle;
attribute double coneOuterGain;
};
interface AudioListener {
attribute double dopplerFactor;
attribute double speedOfSound;
void setPosition (double x, double y, double z);
void setOrientation (double x, double y, double z, double xUp, double yUp, double zUp);
};interface ConvolverNode : AudioNode {
attribute AudioBuffer? buffer;
attribute boolean normalize;
};
interface AnalyserNode : AudioNode {
void getFloatFrequencyData (Float32Array array);
void getByteFrequencyData (Uint8Array array);
void getFloatTimeDomainData (Float32Array array);
void getByteTimeDomainData (Uint8Array array);
attribute unsigned long fftSize;
readonly attribute unsigned long frequencyBinCount;
attribute double minDecibels;
attribute double maxDecibels;
attribute double smoothingTimeConstant;
};
interface ChannelSplitterNode : AudioNode {
};
interface ChannelMergerNode : AudioNode {
};
interface DynamicsCompressorNode {
readonly attribute AudioParam threshold;
readonly attribute AudioParam knee;
readonly attribute AudioParam ratio;
readonly attribute AudioParam reduction;
readonly attribute AudioParam attack;
readonly attribute AudioParam release;
};enum BiquadFilterType {
"lowpass",
"highpass",
"bandpass",
"lowshelf",
"highshelf",
"peaking",
"notch",
"allpass"
};interface BiquadFilterNode : AudioNode {
attribute BiquadFilterType type;
readonly attribute AudioParam frequency;
readonly attribute AudioParam detune;
readonly attribute AudioParam Q;
readonly attribute AudioParam gain;
void getFrequencyResponse (Float32Array frequencyHz, Float32Array magResponse, Float32Array phaseResponse);
};
enum OverSampleType {
"none",
"2x",
"4x"
};
interface WaveShaperNode : AudioNode {
attribute Float32Array? curve;
attribute OverSampleType oversample;
};enum OscillatorType {
"sine",
"square",
"sawtooth",
"triangle",
"custom"
};interface OscillatorNode : AudioNode {
attribute OscillatorType type;
readonly attribute AudioParam frequency;
readonly attribute AudioParam detune;
void start (double when = 0);
void stop (double when = 0);
void setPeriodicWave (PeriodicWave periodicWave);
attribute EventHandler onended;
};
interface PeriodicWave {
};interface MediaStreamAudioSourceNode : AudioNode {
};
interface MediaStreamAudioDestinationNode : AudioNode {
readonly attribute MediaStream stream;
};