title: I WANT TO: Play .mp3 through only one speaker
body: <p>I'm using javascript, and I'm trying to write a program that will, among other things, play an mp3 through either the left or the right speaker (it will vary), but not both.  However, I want it to be absolutely silent on the other speaker.</p>
  
  <p>In the past, I have found ways to play a sound loudly through one speaker, and although it should be silent in the other speaker, it always plays through (albeit quietly). I thought it was a fault of my computer, until I found a youtube Left Right speaker test, that correctly plays through just one speaker.</p>
  
  <p>I have searched for hours, trying pannerNodes, splitter, but whatever I do, it never seems to work correctly (or at all).</p>
  
  <p>Any help would be greatly appreciated!</p>
  
  <p>Ideally, here's what I'd like to add on to:</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>sound1 = new Audio();
  sound1.src = 'pizza.mp3';
  sound1.play();</code></pre>
  </div>
  </div>
  </p>
  
  <p>If code can be added on to make that play through only the left (or right) speaker, that would be awesome.  And if that's possible, then read no further!</p>
  
  <p>I have tried splitter code, which I got online, and it is supposed to be able to mute the left or the right, but it seems like it'll only play at the left volume (or, more accurately, whichever one I attach to the 0-spot of "splitter.connect(something,0);" Also, it plays through both speakers at the left volume. It may be because I'm using an oscillator as a test (wasn't sure how to attach an mp3 to it), or it could be I'm doing something drastically wrong.  Like I said, hours of trying various things, and audio in javascript is not my strength.</p>
  
  <p>Below is what I tried to use based off of something I read from: MarijnS95.  However, like I said, I cannot get it to play an .mp3, and it'll always play at the left volume, but through both speakers.
  <a href="https://stackoverflow.com/questions/20287890/audiocontext-panning-audio-of-playing-media">original post</a>
  <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>tone = new AudioContext();
  tone.createGain = tone.createGain||tone.createGainNode; //fallback for gain naming
  gainL = tone.createGain();
  gainR = tone.createGain();
  
  splitter = this.tone.createChannelSplitter(2);
  
  //Connect splitter' outputs to each Gain Nodes
  splitter.connect(gainR, 1);
  splitter.connect(gainL, 0);
  
  //Connect to source
  source = tone.createOscillator();
  
  //Connect the source to the splitter
  source.connect(splitter,0,0);
  
  //Connect Left and Right Nodes to the output
  //Assuming stereo as initial status
  gainL.connect(tone.destination, 0);
  gainR.connect(tone.destination, 0);
  
  //Mute left channel and set the right gain to normal
  gainL.gain.value = 1;
  gainR.gain.value = 0;
  
  source.start();</code></pre>
  </div>
  </div>
  </p>
  
  <p>Hope that makes some sense.</p>
  
  <p>Thanks in advance!</p>