我试图在环绕声系统中播放除左或右之外的特定扬声器的声音。我可以轻松地在左右声道之间切换,但无法从任何其他扬声器获得声音。试过Firefox和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>