Skip to content

Instantly share code, notes, and snippets.

@JamesDBartlett3
Last active January 12, 2022 23:57
Show Gist options
  • Save JamesDBartlett3/9820db1be59b38431fee8cf138127e49 to your computer and use it in GitHub Desktop.
Save JamesDBartlett3/9820db1be59b38431fee8cf138127e49 to your computer and use it in GitHub Desktop.
Force YouTube Audio to Play on Both Speakers [JavaScript]
/********************************************************************************************************************************\
# Description
- Some videos on YouTube have a problem where the sound only comes out of the left or right channel
- This happens when the person who edits the video forgets to convert any mono audio signals to stereo before rendering
- Run this JavaScript snippet in your web browser to make YouTube play stereo audio as mono (same audio signal on all channels)
# How To Use
- Method 1 (best): Copy/paste into "Custom script" box in "Enhancer for YouTube™ (download & instructions: bit.ly/3GmQgZC)
- Method 2: Install as a UserScript using Tampermonkey, Greasemonkey, etc. (download & instructions: bit.ly/3K6B991)
- Method 3: Copy/paste into browser console (in Dev Tools) & hit Enter
# Credit: Mike Dombrowski (https://mikedombrowski.com/2019/03/fix-youtube-mono-one-ear-audio/)
\********************************************************************************************************************************/
(function(){
var context = new AudioContext()
var videos = document.getElementsByTagName("video")
var audioElement = context.createMediaElementSource(videos[0])
context.destination.channelCount = 1
audioElement.connect(context.destination)
})()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment