title: How can I connect two input channels to the ScriptProcessorNode? (Web Audio Api, JavaScript)
body: <p>I am trying to implement a ScriptProcessorNode with two input and one output channels.</p>
  
  <pre><code>var source = new Array(2);
  
  source[0] = context.createBufferSource();
  source[0].buffer = buffer[0];
  
  source[1] = context.createBufferSource();
  source[1].buffer = buffer[1];
  
  var test = context.createScriptProcessor(4096, 2, 1);
  
  source[0].connect(test, 0, 0);
  source[1].connect(test, 0, 1);
  
  test.connect(context.destination);
  
  source[0].start();
  source[1].start();
  </code></pre>
  
  <p>When I run this code in Google Chrome as well as in Mozilla Firefox‎ I get the following error thrown. It tells me my <code>test</code>node has only one input channel.</p>
  
  <pre><code>Uncaught IndexSizeError: Failed to execute 'connect' on 'AudioNode': input index (1) exceeds number of inputs (1).
  </code></pre>
  
  <p>When I console print the number of input channels of the ScriptProcessorNode <code>test</code> I get two input channels.</p>
  
  <pre><code>test.onaudioprocess = function(evt){
      console.log("number of input channels: " + evt.inputBuffer.numberOfChannels);
  }
  </code></pre>
  
  <p>Nevertheless connecting two nodes to the input of the <code>test</code>node does not work the way I do it. I want to program a vocoder inside the ScriptProcessorNode. How can I create a ScriptProcessorNode with two input and one output channels and connect two source nodes as input channel and the <code>context.destination</code>as output channel? </p>