<body>
<audio id="myAudio" src="audio/Squirrel Nut Zippers - Trou Macacq.mp3"></audio>
</body>
<script>
var myAudio = document.getElementById('myAudio')
var context = new AudioContext();
var audioSource = context.createMediaElementSource(myAudio)
var splitter = context.createChannelSplitter(2);
audioSource.connect(splitter);
var merger = context.createChannelMerger(2)
//REDUCE VOLUME OF LEFT CHANNEL ONLY
var gainNode = context.createGain();
gainNode.gain.setValueAtTime(0.5, context.currentTime);
splitter.connect(gainNode, 0);
//CONNECT SPLITTER BACK TO SECOND INPUT OF THE MERGER
gainNode.connect(merger, 0, 1);
splitter.connect(merger, 1, 0);
var destination = context.createMediaStreamDestination();
merger.connect(destination)
myAudio.play()
</script>
I am trying to make the audio playing through the left channel silent so that the audio on the right channel is the only thing playing through both speakers. My understanding is that this is done by splitting the channels, adjusting the gain of one channel and then merging them back together, however I am unsure on how to do this and need help