1

I am attempting to play sound out of a specific speaker other than left or right in a surround sound system. I can easily switch between left and right channel, but cannot get sound from any other speaker. Tried on Firefox and Chrome.

<script>
context = new AudioContext();
function playSound()
{
    var oscillator = context.createOscillator();
    oscillator.frequency.value = 440;
    var mergerNode = context.createChannelMerger(6);
    var silence = context.createBufferSource();
    silence.connect(mergerNode, 0, 0);
    silence.connect(mergerNode, 0, 1);
    silence.connect(mergerNode, 0, 2);
    silence.connect(mergerNode, 0, 3);
    silence.connect(mergerNode, 0, 4);
    oscillator.connect(mergerNode, 0, 5);
    mergerNode.connect(context.destination);
    currentTime = context.currentTime;
    oscillator.start(currentTime);
    oscillator.stop(currentTime + 2);    
}
playSound();
</script>
Daniel Boggs
  • 61
  • 1
  • 6
  • Have you tried using a pannerNode? Not the stereoPannerNode, but the regular pannerNode, which does 3d panning. I imagine if you position the sound source behind the audio listener, you'll hear the sound come out of your rear speakers. – Raphael Serota Jun 30 '15 at 17:10
  • Yep, that is the first thing I tried. Unfortunately what they seem to mean with "3D" is left right, and **Distance** . I tried every which way I can think of and have been unable to get anything but left and right sounds. – Daniel Boggs Jul 02 '15 at 19:37

0 Answers0