Bug 21544: Specify channel mixing rules for each node
authorcrogers
Fri, 05 Apr 2013 16:05:49 -0700
changeset 286 9835d4ab4d89
parent 285 8b83d1ca7553
child 287 842c7ffec244
Bug 21544: Specify channel mixing rules for each node
webaudio/specification.html
--- a/webaudio/specification.html	Fri Apr 05 15:39:33 2013 -0700
+++ b/webaudio/specification.html	Fri Apr 05 16:05:49 2013 -0700
@@ -1490,9 +1490,14 @@
 AudioDestinationNode per AudioContext, provided through the
 <code>destination</code> attribute of <a
 href="#AudioContext-section"><code>AudioContext</code></a>. </p>
-<pre>      numberOfInputs  : 1
+<pre>
+      numberOfInputs  : 1
       numberOfOutputs : 0
-      </pre>
+
+      channelCount = 2;
+      channelCountMode = "explicit";
+      channelInterpretation = "speakers";
+</pre>
 
 <div class="block">
 
@@ -1908,9 +1913,13 @@
 href="#MixerGainStructure-section">mixers</a>.
 This interface is an AudioNode with a single input and single
 output: </p>
-<pre>    numberOfInputs  : 1
+<pre>
+    numberOfInputs  : 1
     numberOfOutputs : 1
-    </pre>
+
+    channelCountMode = "max";
+    channelInterpretation = "speakers";
+</pre>
 
 <p>It multiplies the input audio signal by the (possibly time-varying) <code>gain</code> attribute, copying the result to the output.
  By default, it will take the input and pass it through to the output unchanged, which represents a constant gain change
@@ -1971,9 +1980,13 @@
 
 <p>A delay-line is a fundamental building block in audio applications. This
 interface is an AudioNode with a single input and single output: </p>
-<pre>    numberOfInputs  : 1
+<pre>
+    numberOfInputs  : 1
     numberOfOutputs : 1
-    </pre>
+
+    channelCountMode = "max";
+    channelInterpretation = "speakers";
+</pre>
 
 <p>
 The number of channels of the output always equals the number of channels of the input.
@@ -2345,9 +2358,13 @@
 
 <p>This interface is an AudioNode which can generate, process, or analyse audio
 directly using JavaScript. </p>
-<pre>    numberOfInputs  : 1
+<pre>
+    numberOfInputs  : 1
     numberOfOutputs : 1
-    </pre>
+
+    channelCountMode = "max";
+    channelInterpretation = "speakers";
+</pre>
 
 <p>The ScriptProcessorNode is constructed with a <code>bufferSize</code> which
 must be one of the following values: 256, 512, 1024, 2048, 4096, 8192, 16384.
@@ -2486,6 +2503,10 @@
 <pre>
     numberOfInputs  : 1
     numberOfOutputs : 1
+
+    channelCount = 2;
+    channelCountMode = "clamped-max";
+    channelInterpretation = "speakers";
 </pre>
 
 <p>
@@ -2785,9 +2806,14 @@
 href="#Convolution-section">linear convolution effect</a> given an impulse
 response.  Normative requirements for multi-channel convolution matrixing are described
 <a href="#Convolution-reverb-effect">here</a>. </p>
-<pre>    numberOfInputs  : 1
+<pre>
+    numberOfInputs  : 1
     numberOfOutputs : 1
-    </pre>
+
+    channelCount = 2;
+    channelCountMode = "clamped-max";
+    channelInterpretation = "speakers";
+</pre>
 
 <div class="block">
 
@@ -2919,9 +2945,14 @@
 frequency and time-domain <a href="#AnalyserNode">analysis</a>
 information. The audio stream will be passed un-processed from input to output.
 </p>
-<pre>    numberOfInputs  : 1
+<pre>
+    numberOfInputs  : 1
     numberOfOutputs : 1    <em>Note that this output may be left unconnected.</em>
-    </pre>
+
+    channelCount = 1;
+    channelCountMode = "explicit";
+    channelInterpretation = "speakers";
+</pre>
 
 <div class="block">
 
@@ -3038,9 +3069,13 @@
 <p>The <code>ChannelSplitterNode</code> is for use in more advanced
 applications and would often be used in conjunction with <a
 href="#ChannelMergerNode-section"><code>ChannelMergerNode</code></a>. </p>
-<pre>    numberOfInputs  : 1
+<pre>
+    numberOfInputs  : 1
     numberOfOutputs : Variable N (defaults to 6) // number of "active" (non-silent) outputs is determined by number of channels in the input
-    </pre>
+
+    channelCountMode = "max";
+    channelInterpretation = "speakers";
+</pre>
 
 <p>This interface represents an AudioNode for accessing the individual channels
 of an audio stream in the routing graph. It has a single input, and a number of
@@ -3084,9 +3119,13 @@
 <p>The <code>ChannelMergerNode</code> is for use in more advanced applications
 and would often be used in conjunction with <a
 href="#ChannelSplitterNode-section"><code>ChannelSplitterNode</code></a>. </p>
-<pre>    numberOfInputs  : Variable N (default to 6)  // number of connected inputs may be less than this
+<pre>
+    numberOfInputs  : Variable N (default to 6)  // number of connected inputs may be less than this
     numberOfOutputs : 1
-    </pre>
+
+    channelCountMode = "max";
+    channelInterpretation = "speakers";
+</pre>
 
 <p>This interface represents an AudioNode for combining channels from multiple
 audio streams into a single audio stream. It has a variable number of inputs (defaulting to 6), but not all of them
@@ -3142,9 +3181,14 @@
 large numbers of individual sounds are played simultaneous to control the
 overall signal level and help avoid clipping (distorting) the audio output to
 the speakers. </p>
-<pre>    numberOfInputs  : 1
+<pre>    
+    numberOfInputs  : 1
     numberOfOutputs : 1
-    </pre>
+
+    channelCount = 2;
+    channelCountMode = "explicit";
+    channelInterpretation = "speakers";
+</pre>
 
 <div class="block">
 
@@ -3225,9 +3269,13 @@
 sweeps, etc. Each BiquadFilterNode can be configured as one of a number of
 common filter types as shown in the IDL below.  The default filter type
 is "lowpass".</p>
-<pre>    numberOfInputs  : 1
+<pre>    
+    numberOfInputs  : 1
     numberOfOutputs : 1
-    </pre>
+
+    channelCountMode = "max";
+    channelInterpretation = "speakers";
+</pre>
 <p>
 The number of channels of the output always equals the number of channels of the input.
 </p>
@@ -3478,9 +3526,13 @@
 <p>Non-linear waveshaping distortion is commonly used for both subtle
 non-linear warming, or more obvious distortion effects. Arbitrary non-linear
 shaping curves may be specified.</p>
-<pre>    numberOfInputs  : 1
+<pre>
+    numberOfInputs  : 1
     numberOfOutputs : 1
-    </pre>
+
+    channelCountMode = "max";
+    channelInterpretation = "speakers";
+</pre>
 
 <p>
 The number of channels of the output always equals the number of channels of the input.
@@ -4158,43 +4210,35 @@
 
 
 
-
-
 <h3>Examples</h3>
 
+<p class="norm">This section is informative.</p>
+
 <div class="block">
 <div class="blockTitleDiv">
 <div class="blockContent">
 <pre class="code"><code class="idl-code"> 
-// GainNode, BiquadFilterNode, DelayNode, and similar are like this by default.
-biquad.channelCountMode = "max";
-biquad.channelInterpretation = "speakers";
-
 // Set gain node to explicit 2-channels (stereo).
 gain.channelCount = 2;
 gain.channelCountMode = "explicit";
 gain.channelInterpretation = "speakers";
 
-// The “hardware output” is stereo like this by default.
-context.destination.channelCount = 2;
-context.destination.channelCountMode = "explicit";
-context.destination.channelInterpretation = "speakers";
-
 // Set “hardware output” to 4-channels for DJ-app with two stereo output busses.
 context.destination.channelCount = 4;
 context.destination.channelCountMode = "explicit";
 context.destination.channelInterpretation = "discrete";
 
+// Set “hardware output” to 8-channels for custom multi-channel speaker array
+// with custom matrix mixing.
+context.destination.channelCount = 8;
+context.destination.channelCountMode = "explicit";
+context.destination.channelInterpretation = "discrete";
+
 // Set “hardware output” to 5.1 to play an HTMLAudioElement.
 context.destination.channelCount = 6;
 context.destination.channelCountMode = "explicit";
 context.destination.channelInterpretation = "speakers";
 
-// PannerNode and ConvolverNode are like this by default.
-pannerNode.channelCount = 2;
-pannerNode.channelCountMode = "clamped-max";
-pannerNode.channelInterpretation = "speakers";
-
 // Explicitly down-mix to mono.
 gain.channelCount = 1;
 gain.channelCountMode = "explicit";