Skip to content

Instantly share code, notes, and snippets.

@mohayonao
Created September 2, 2016 10:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mohayonao/896ceb6ef69160c033e002237b62f2a7 to your computer and use it in GitHub Desktop.
Save mohayonao/896ceb6ef69160c033e002237b62f2a7 to your computer and use it in GitHub Desktop.
function selectAudioChannel(type) {
var splitter = audioCtx.createChannelSplitter(2);
audioSource.disconnect(); // ?
switch (type) {
case 'L':
audioSource.connect(splitter);
splitter.connect(audioCtx.destination, 0);
break;
case 'R':
audioSource.connect(splitter);
splitter.connect(audioCtx.destination, 1);
break;
default:
audioSource.connect(audioCtx.destination);
break;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment