Web Audio API play sound to specific speaker/channel

459 views Asked by At

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>
0

There are 0 answers