title: Web Audio API split mono to stereo
body: <p>Lets say I have a source node that's connected to the destination node.
  Even if the audio is mono, I want to be able to control each ear's volume independently, like I can do when I have stereo audio with splitter and merger node.</p>
  
  <p>Already tried to use splitter and merger nodes on the mono source node, but right channel comes out empty.</p>
  
  <p>example for stereo:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>var audioCtx = new AudioContext();
  var source = audioCtx.createMediaElementSource(myAudio);
  var gainNodeL = audioCtx.createGain();
  var gainNodeR = audioCtx.createGain();
  var splitter = audioCtx.createChannelSplitter(2);
  var merger = audioCtx.createChannelMerger(2);
  
  source.connect(splitter);
  splitter.connect(gainNodeL, 0);
  splitter.connect(gainNodeR, 1);
  
  gainNodeL.connect(merger, 0, 0);
  gainNodeR.connect(merger, 0, 1);
  
  merger.connect(audioCtx.createMediaStreamDestination());</code></pre>
  </div>
  </div>
  </p>
  
  <p>When I do this with mono audio, the right channel comes out empty.</p>