Skip to content

Instantly share code, notes, and snippets.

@mashiro
Last active January 5, 2019 13:59
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 mashiro/51749cb64225fe3cac06f843f20f61f0 to your computer and use it in GitHub Desktop.
Save mashiro/51749cb64225fe3cac06f843f20f61f0 to your computer and use it in GitHub Desktop.
const gain = ((el) => {
const ctx = new window.AudioContext();
const source = ctx.createMediaElementSource(el);
const gain = ctx.createGain();
source.connect(gain);
gain.connect(ctx.destination)
return (multiplier) => { gain.gain.value = Math.min(multiplier, 10); };
})(document.querySelector("video"));
gain(2);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment