diff --git a/index.html b/index.html index 14ff50929..c95a6bcf9 100644 --- a/index.html +++ b/index.html @@ -318,7 +318,7 @@

var context = new AudioContext(); function playSound() { - var source = context.createBufferSource(); + var source = new AudioBufferSourceNode(context); source.buffer = dogBarkingBuffer; source.connect(context.destination); source.start(0); @@ -363,15 +363,15 @@

context = new AudioContext(); // Create the effects nodes. - lowpassFilter = context.createBiquadFilter(); - waveShaper = context.createWaveShaper(); - panner = context.createPanner(); - compressor = context.createDynamicsCompressor(); - reverb = context.createConvolver(); + lowpassFilter = new BiquadFilterNode(context); + waveShaper = new WaveShaperNode(context); + panner = new PannerNode(context); + compressor = new DynamicsCompressorNode(context); + reverb = new ConvolverNode(context); // Create master wet and dry. - masterDry = context.createGain(); - masterWet = context.createGain(); + masterDry = new GainNode(context); + masterWet = new GainNode(context); // Connect final compressor to final destination. compressor.connect(context.destination); @@ -384,17 +384,17 @@

reverb.connect(masterWet); // Create a few sources. - source1 = context.createBufferSource(); - source2 = context.createBufferSource(); - source3 = context.createOscillator(); + source1 = new AudioBufferSourceNode(context); + source2 = new AudioBufferSourceNode(context); + source3 = new OscillatorNode(context); source1.buffer = manTalkingBuffer; source2.buffer = footstepsBuffer; source3.frequency.value = 440; // Connect source1 - dry1 = context.createGain(); - wet1 = context.createGain(); + dry1 = new GainNode(context); + wet1 = new GainNode(context); source1.connect(lowpassFilter); lowpassFilter.connect(dry1); lowpassFilter.connect(wet1); @@ -402,8 +402,8 @@

wet1.connect(reverb); // Connect source2 - dry2 = context.createGain(); - wet2 = context.createGain(); + dry2 = new GainNode(context); + wet2 = new GainNode(context); source2.connect(waveShaper); waveShaper.connect(dry2); waveShaper.connect(wet2); @@ -411,8 +411,8 @@

wet2.connect(reverb); // Connect source3 - dry3 = context.createGain(); - wet3 = context.createGain(); + dry3 = new GainNode(context); + wet3 = new GainNode(context); source3.connect(panner); panner.connect(dry3); panner.connect(wet3); @@ -445,15 +445,15 @@

var context = new AudioContext(); // Create the low frequency oscillator that supplies the modulation signal - var lfo = context.createOscillator(); + var lfo = new OscillatorNode(context); lfo.frequency.value = 1.0; // Create the high frequency oscillator to be modulated - var hfo = context.createOscillator(); + var hfo = new OscillatorNode(context); hfo.frequency.value = 440.0; // Create a gain node whose gain determines the amplitude of the modulation signal - var modulationGain = context.createGain(); + var modulationGain = new GainNode(context); modulationGain.gain.value = 50; // Configure the graph and start the oscillators @@ -661,7 +661,7 @@

This interface represents a set of AudioNode objects and their connections. It allows for arbitrary routing of signals to an AudioDestinationNode. Nodes are - created from the context and are then connected together.

@@ -691,10 +691,8 @@

This context has been released, and can no longer be used to process audio. All system audio resources have been released. Attempts to create new Nodes on this context will throw - InvalidStateError. (AudioBuffers may still be created, through + InvalidStateError. (AudioBuffers may still be created by the context, through - createBuffer or decodeAudioData.) @@ -1123,18 +1121,21 @@

AnalyserNode createAnalyser()
- Create an AnalyserNode. + This method is DEPRECATED in favor of using the constructor. + Create an AnalyserNode.
GainNode createGain()
+ This method is DEPRECATED in favor of using the constructor. Create an GainNode.
DelayNode createDelay()
+ This method is DEPRECATED in favor of using the constructor. Creates a DelayNode representing a variable delay line. The initial default delay time will be 0 seconds.
@@ -1154,7 +1155,8 @@

BiquadFilterNode createBiquadFilter()
- Creates a BiquadFilterNode representing a +This method is DEPRECATED in favor of using the constructor. + Creates a BiquadFilterNode representing a second order filter which can be configured as one of several common filter types.
@@ -1162,6 +1164,7 @@

IIRFilterNode createIIRFilter(Float32Array b, Float32Array a)
+ This method is DEPRECATED in favor of using the constructor. Creates an IIRFilterNode representing a general IIR Filter.
@@ -1191,6 +1194,7 @@

WaveShaperNode createWaveShaper()
+ This method is DEPRECATED in favor of using the constructor. Creates a WaveShaperNode representing a non-linear distortion.
@@ -1206,24 +1210,28 @@

SpatialPannerNode createSpatialPanner()
+ This method is DEPRECATED in favor of using the constructor. Creates a SpatialPannerNode.
StereoPannerNode createStereoPanner()
+ This method is DEPRECATED in favor of using the constructor. Creates a StereoPannerNode.
ConvolverNode createConvolver()
+ This method is DEPRECATED in favor of using the constructor. Creates a ConvolverNode.
ChannelSplitterNode createChannelSplitter()
+ This method is DEPRECATED in favor of using the constructor. Creates an ChannelSplitterNode representing a channel splitter. An IndexSizeError exception MUST be thrown for invalid parameter values. @@ -1241,6 +1249,7 @@

ChannelMergerNode createChannelMerger()
+ This method is DEPRECATED in favor of using the constructor. Creates a ChannelMergerNode representing a channel merger. An IndexSizeError exception MUST be thrown for invalid parameter values. @@ -1259,18 +1268,21 @@

DynamicsCompressorNode createDynamicsCompressor()
+ This method is DEPRECATED in favor of using the constructor. Creates a DynamicsCompressorNode
OscillatorNode createOscillator()
+ This method is DEPRECATED in favor of using the constructor. Creates an OscillatorNode
PeriodicWave createPeriodicWave()
+ This method is DEPRECATED in favor of using the constructor. Creates a PeriodicWave representing a waveform containing arbitrary harmonic content. The real and imag parameters must be of type @@ -1393,10 +1405,15 @@

document.

+
Constructor
+
+ Creates an AudioContext. +
MediaElementAudioSourceNode createMediaElementSource()
+ This method is DEPRECATED in favor of using the constructor. Creates a MediaElementAudioSourceNode given an HTMLMediaElement. As a consequence of calling this method, @@ -1415,6 +1432,7 @@

MediaStreamAudioSourceNode createMediaStreamSource()
+ This method is DEPRECATED in favor of using the constructor.
MediaStream mediaStream @@ -1428,6 +1446,7 @@

MediaStreamAudioDestinationNode createMediaStreamDestination()

+ This method is DEPRECATED in favor of using the constructor. Creates a MediaStreamAudioDestinationNode
@@ -1443,38 +1462,43 @@

hardware, but instead renders as quickly as possible, fulfilling the returned promise with the rendered result as an AudioBuffer. -

The OfflineAudioContext is constructed with the same arguments as - AudioContext.createBuffer. A NotSupportedException exception MUST be - thrown if any of the arguments is negative, zero, or outside its - nominal range. -
-
- unsigned long numberOfChannels -
-
- Determines how many channels the buffer will have. See - createBuffer for the supported number of channels. -
-
- unsigned long length -
-
- Determines the size of the buffer in sample-frames. -
-
- float sampleRate -
-
- Describes the sample-rate of the linear PCM audio data in the - buffer in sample-frames per second. See - createBuffer for valid sample rates. -
-
+

+
Constructor
+
+ The OfflineAudioContext is constructed with the same arguments as + the + AudioBuffer constructor. A NotSupportedException exception MUST be + thrown if any of the arguments is negative, zero, or outside its + nominal range. +
+
+ unsigned long numberOfChannels +
+
+ Determines how many channels the buffer will have. See the + AudioBuffer constructor for the supported number of channels. +
+
+ unsigned long length +
+
+ Determines the size of the buffer in sample-frames. +
+
+ float sampleRate +
+
+ Describes the sample-rate of the linear PCM audio data in the + buffer in sample-frames per second. See the + AudioBuffer constructor for valid sample rates. +
+
+
Promise<AudioBuffer> startRendering()
@@ -1604,8 +1628,6 @@

-

The OfflineAudioCompletionEvent Interface @@ -2831,6 +2853,13 @@

AudioParam.

+
Constructor
+
+
+
BaseAudioContext context
+
The context to which this node belongs.
+
+
readonly attribute AudioParam gain
@@ -2883,6 +2912,27 @@

layout.

+
Constructor
+
+

+ Creates a DelayNode representing a variable + delay line. The initial default delay time will be 0 seconds. +

+
+
BaseAudioContext context
+
The context to which this node belongs.
+
+ optional double maxDelayTime = 1.0 +
+
+ The maxDelayTime parameter is optional and specifies + the maximum delay time in seconds allowed for the delay line. + If specified, this value MUST be greater than zero and less + than three minutes or a NotSupportedError exception MUST be + thrown. +
+
+
readonly attribute AudioParam delayTime
@@ -2926,6 +2976,36 @@

AudioContext.

+
Constructor
+
+ Creates an AudioBuffer of the given size. The audio data in the + buffer will be zero-initialized (silent). A NotSupportedError + exception MUST be thrown if any of the arguments is negative, zero, + or outside its nominal range. +
+
+ unsigned long numberOfChannels +
+
+ Determines how many channels the buffer will have. An + implementation must support at least 32 channels. +
+
+ unsigned long length +
+
+ Determines the size of the buffer in sample-frames. +
+
+ float sampleRate +
+
+ Describes the sample-rate of the linear PCM audio data in the + buffer in sample-frames per second. An implementation must + support sample rates in at least the range 8192 to 96000. +
+
+
readonly attribute float sampleRate
@@ -3136,6 +3216,14 @@

one channel of silence if .buffer is NULL.

+
Constructor
+
+ Creates an AudioBufferSourceNode. +
+
BaseAudioContext context
+
The context to which this node belongs.
+
+
attribute AudioBuffer? buffer
@@ -3399,12 +3487,26 @@

will be one silent channel.

-

- A MediaElementAudioSourceNode is created given an - HTMLMediaElement using the AudioContext - createMediaElementSource() method. -

+ "idl"> +
Constructor
+
+ Creates a MediaElementAudioSourceNode + given an HTMLMediaElement. As a consequence of creating this node, + audio playback from the HTMLMediaElement will be re-routed into the + processing graph of the AudioContext. +
+
AudioContext context
+
The context to which this node belongs.
+
+ HTMLMediaElement mediaElement +
+
+ The media element that will be re-routed. +
+
+
+

The number of channels of the single output equals the number of channels of the audio referenced by the HTMLMediaElement @@ -3424,7 +3526,7 @@

   var mediaElement = document.getElementById('mediaElementID');
-  var sourceNode = context.createMediaElementSource(mediaElement);
+  var sourceNode = new MediaElementSourceNode(context, mediaElement);
   sourceNode.connect(filterNode);
 
@@ -4495,6 +4597,13 @@

+
Constructor
+
+
+
BaseAudioContext context
+
The context to which this node belongs.
+
+
attribute PanningModelType panningModel @@ -4634,6 +4743,10 @@

details about spatialization.

+
Constructor
+
+ Creates an AudioListener. +
void setPosition(float x, float y, float z)
@@ -4774,6 +4887,13 @@

+
Constructor
+
+
+
BaseAudioContext context
+
The context to which this node belongs.
+
+
attribute PanningModelType panningModel
@@ -4904,6 +5024,10 @@

for more details about spatialization.

+
Constructor
+
+ Creates a SpatialListener. +
readonly attribute AudioParam positionX
@@ -5032,6 +5156,13 @@

cannot be configured.

+
Constructor
+
+
+
BaseAudioContext context
+
The context to which this node belongs.
+
+
readonly attribute AudioParam pan
@@ -5069,6 +5200,13 @@

channelCountMode is set to "max".

+
Constructor
+
+
+
BaseAudioContext context
+
The context to which this node belongs.
+
+
attribute AudioBuffer? buffer
@@ -5234,6 +5372,14 @@

+
Constructor
+
+
+
BaseAudioContext context
+
The context to which this node belongs.
+
+
+
void getFloatFrequencyData()
@@ -5560,9 +5706,9 @@

outputs will be two (one from the left channel and one from the right). There are always a total number of N outputs (determined by the numberOfOutputs parameter to the - AudioContext method - createChannelSplitter()), The default number is 6 if + ChannelSplitterNode + constructor), The default number is 6 if this value is not provided. Any outputs which are not "active" will output silence and would typically not be connected to anything.

@@ -5585,7 +5731,25 @@

"matrix mixing" where individual gain control of each channel is desired.

-
+
+
Constructor
+
+ Creates an ChannelSplitterNode representing a + channel splitter. An IndexSizeError exception MUST be thrown for + invalid parameter values. +
+
BaseAudioContext context
+
The context to which this node belongs.
+
+ optional unsigned long numberOfOutputs = 6 +
+
+ The number of outputs. Values of up to 32 must be supported. If + not specified, then 6 will be used. +
+
+
+

@@ -5646,7 +5810,28 @@

A diagram of ChannelMerger -
+
+
+ Constructor +
+
+ Creates a ChannelMergerNode representing a + channel merger. An IndexSizeError exception MUST be thrown for + invalid parameter values. +
+
BaseAudioContext context
+
The context to which this node belongs.
+
+ optional unsigned long numberOfInputs = 6 +
+
+ The numberOfInputs parameter determines the number + of inputs. Values of up to 32 must be supported. If not + specified, then 6 will be used. +
+
+
+

@@ -5676,6 +5861,13 @@

channelInterpretation = "speakers";
+
Constructor
+
+
+
BaseAudioContext context
+
The context to which this node belongs.
+
+
readonly attribute AudioParam threshold
@@ -6060,6 +6252,18 @@

a-rate AudioParam.

+
Constructor
+
+

+ Creates a BiquadFilterNode representing a + second order filter which can be configured as one of several + common filter types. +

+
+
BaseAudioContext context
+
The context to which this node belongs.
+
+
attribute BiquadFilterType type
@@ -6413,6 +6617,37 @@

channels of the input.

+
Constructor
+
+

+ Creates an IIRFilterNode representing a general + IIR Filter. +

+
+
BaseAudioContext context
+
The context to which this node belongs.
+
+ Float32Array feedforward +
+
+ An array of the feedforward (numerator) coefficients for the + transfer function of the IIR filter. The maximum length of this + array is 20. If all of the values are zero, an + InvalidStateError MUST be thrown. A NotSupportedError MUST be + thrown if the array length is 0 or greater than 20. +
+
+ Float32Array feedback +
+
+ An array of the feedback (denominator) coefficients for the + tranfer function of the IIR filter. The maximum length of this + array is 20. If the first element of the array is 0, an + InvalidStateError MUST be thrown. A NotSupportedError MUST be + thrown if the array length is 0 or greater than 20. +
+
+
void getFrequencyResponse()
@@ -6454,10 +6689,10 @@

Let \(b_m\) be the feedforward coefficients and - \(a_n\) be the feedback coefficients specified by + \(a_n\) be the feedback coefficients specified by the - createIIRFilter. Then the transfer function of the + "#widl-ctor-IIRFilterNode--BaseAudioContext-context-Float32Array-feedforward-Float32Array-feedback"> + IIRFilterNode constructor. Then the transfer function of the general IIR filter is given by

@@ -6532,6 +6767,13 @@ 

+
Constructor
+
+
+
BaseAudioContext context
+
The context to which this node belongs.
+
+
attribute Float32Array? curve
@@ -6703,6 +6945,13 @@

+
Constructor
+
+
+
BaseAudioContext context
+
The context to which this node belongs.
+
+
attribute OscillatorType type
@@ -6844,13 +7093,77 @@

PeriodicWave represents an arbitrary periodic waveform to be used - with an OscillatorNode. Please see - createPeriodicWave() and OscillatorNode. Also see - setPeriodicWave() and for more details. + setPeriodicWave() for additional details.

-
+
+
Constructor
+
+ Creates a PeriodicWave representing a waveform + containing arbitrary harmonic content. The real and + imag parameters must be of type + Float32Array (described in [[!TYPED-ARRAYS]]) of equal + lengths greater than zero or an IndexSizeError exception MUST be + thrown. All implementations must support arrays up to at least + 8192. These parameters specify the Fourier coefficients of a + Fourier + series representing the partials of a periodic waveform. The + created PeriodicWave will be used with an + OscillatorNode and, by default, will represent + a normalized time-domain waveform having maximum absolute + peak value of 1. Another way of saying this is that the generated + waveform of an OscillatorNode will have maximum + peak value at 0dBFS. Conveniently, this corresponds to the + full-range of the signal values used by the Web Audio API. Because + the PeriodicWave is normalized by default on creation, the + real and imag parameters represent + relative values. If normalization is disabled via the + disableNormalization parameter, this normalization is + disabled, and the time-domain waveform has the amplitudes as given + by the Fourier coefficients. +

+ As PeriodicWave objects maintain their own copies of these + arrays, any modification of the arrays used as the + real and imag parameters after the creation + of the PeriodicWave object will have no effect. +

+
+
+ Float32Array real +
+
+ The real parameter represents an array + of cosine terms (traditionally the A terms). In + audio terminology, the first element (index 0) is the DC-offset + of the periodic waveform. The second element (index 1) + represents the fundamental frequency. The third element + represents the first overtone, and so on. The first element is + ignored and implementations must set it to zero internally. +
+
+ Float32Array imag +
+
+ The imag parameter represents an array + of sine terms (traditionally the B terms). The + first element (index 0) should be set to zero (and will be + ignored) since this term does not exist in the Fourier series. + The second element (index 1) represents the fundamental + frequency. The third element represents the first overtone, and + so on. +
+
+ optional PeriodicWaveConstraints constraints +
+
+ If not given, the waveform is normalized. Otherwise, the + waveform is normalized according the value given by + constraints. +
+
+
+

PeriodicWaveConstraints @@ -6873,8 +7186,8 @@

The - createPeriodicWave() method takes two arrays to specify the + "#widl-ctor-PeriodicWave--Float32Array-real-Float32Array-imag-PeriodicWaveConstraints-constraints"> + PeriodicWave constructor takes two arrays to specify the Fourier coefficients of the PeriodicWave. Let \(a\) and \(b\) represent the real and imaginary arrays of length \(L\). Then the basic time-domain waveform, \(x(t)\), can be computed using: @@ -6944,10 +7257,10 @@

In the following descriptions, let \(a\) be the array of real - coefficients and \(b\) be the array of imaginary coefficients for + coefficients and \(b\) be the array of imaginary coefficients for the - createPeriodicWave(). In all cases \(a[n] = 0\) + "#widl-ctor-PeriodicWave--Float32Array-real-Float32Array-imag-PeriodicWaveConstraints-constraints"> + PeriodicWave constructor. In all cases \(a[n] = 0\) for all \(n\) because the waveforms are odd functions. Also, \(b[0] = 0\) in all cases. Hence, only \(b[n]\) for \(n \ge 1\) is specified below. @@ -7025,7 +7338,23 @@

silent channel.

+ "idl"> +
+ Constructor +
+
+
+
AudioContext context
+
The context to which this node belongs.
+
+ MediaStream mediaStream +
+
+ The media stream that will act as source. +
+
+
+

@@ -7057,6 +7386,15 @@

+
+ Constructor +
+
+
+
AudioContext context
+
The context to which this node belongs.
+
+
readonly attribute MediaStream stream
@@ -7189,37 +7527,37 @@

function setupRoutingGraph() { context = new AudioContext(); - compressor = context.createDynamicsCompressor(); + compressor = new DynamicsCompressorNode(context); // Send1 effect - reverb = context.createConvolver(); + reverb = new ConvolverNode(context); // Convolver impulse response may be set here or later // Send2 effect - delay = context.createDelay(); + delay = new DelayNode(context); // Connect final compressor to final destination compressor.connect(context.destination); // Connect sends 1 & 2 through effects to main mixer - s1 = context.createGain(); + s1 = new GainNode(context); reverb.connect(s1); s1.connect(compressor); - s2 = context.createGain(); + s2 = new GainNode(context); delay.connect(s2); s2.connect(compressor); // Create a couple of sources - source1 = context.createBufferSource(); - source2 = context.createBufferSource(); + source1 = new AudioBufferSourceNode(context); + source2 = new AudioBufferSourceNode(context); source1.buffer = manTalkingBuffer; source2.buffer = footstepsBuffer; // Connect source1 - g1_1 = context.createGain(); - g2_1 = context.createGain(); - g3_1 = context.createGain(); + g1_1 = new GainNode(context); + g2_1 = new GainNode(context); + g3_1 = new GainNode(context); source1.connect(g1_1); source1.connect(g2_1); source1.connect(g3_1); @@ -7228,9 +7566,9 @@

g3_1.connect(delay); // Connect source2 - g1_2 = context.createGain(); - g2_2 = context.createGain(); - g3_2 = context.createGain(); + g1_2 = new GainNode(context); + g2_2 = new GainNode(context); + g3_2 = new GainNode(context); source2.connect(g1_2); source2.connect(g2_2); source2.connect(g3_2); @@ -7334,12 +7672,12 @@

function setupAudioContext() { context = new AudioContext(); - compressor = context.createDynamicsCompressor(); - gainNode1 = context.createGain(); + compressor = new DynamicsCompressorNode(context); + gainNode1 = new GainNode(context); // Create a streaming audio source. var audioElement = document.getElementById('audioTagID'); - streamingAudioSource = context.createMediaElementSource(audioElement); + streamingAudioSource = new MediaElementSourceNode(context, audioElement); streamingAudioSource.connect(gainNode1); gainNode1.connect(compressor); @@ -7349,13 +7687,13 @@

// Later in response to some user action (typically mouse or key event) // a one-shot sound can be played. function playSound() { - var oneShotSound = context.createBufferSource(); + var oneShotSound = new AudioBufferSourceNode(context); oneShotSound.buffer = dogBarkingBuffer; // Create a filter, panner, and gain node. - var lowpass = context.createBiquadFilter(); - var panner = context.createPanner(); - var gainNode2 = context.createGain(); + var lowpass = new BiquadFilterNode(context); + var panner = new PannerNode(context); + var gainNode2 = new GainNode(context); // Make connections oneShotSound.connect(lowpass);