2
votes

I'm attempting to play audio only in my surround channels, but it seems like anytime I connect to a specific channel it plays out the other ones as well

My set up and audioContext.destination are configured for 4 channels

var merger = context.createChannelMerger(4);
audio.connect(merger, 0, 2);
audio.connect(merger, 0, 3);
merger.connect(context.destination);

my audio is stereo (but I only care about one channel) so I also tried splitting it first

var merger = context.createChannelMerger(4),
    splitter = context.createChannelSplitter(2);
audio.connect(splitter);
splitter.connect(merger, 0, 2);
splitter.connect(merger, 0, 3);
merger.connect(context.destination);

oddly enough, If I only connect it to the left/right channel it plays as expected.

I'm running chrome 45 on windows 10

2

2 Answers

1
votes

I think you're connecting the splitter to the merger incorrectly. You probably want splitter.connect(merger, 0, 2); splitter.connect(merger, 1, 3); Then the stereo source will be split and sent to channels 2 and 3 of the output.

0
votes

Can you share your set up code for AudioContext? It needs a bit of specific setup for the individual routing. See the example below:

var context = new AudioContext();
var maxChannelCount = context.destination.maxChannelCount;

context.destination.channelCount = maxChannelCount;    
var merger = context.createChannelMerger(maxChannelCount);
merger.connect(context.destination);

// This will play the sound on 3rd and 4th speakers for 1 second.
var osc = context.createOscillator();
osc.connect(merger, 0, 2);
osc.connect(merger, 0, 3);
osc.start();
osc.stop(1.0);