Last active
June 26, 2025 18:52
-
-
Save matiaslopezd/e715c9b5e69d4dbadb05027e11740ca7 to your computer and use it in GitHub Desktop.
Amplify audio/video source Javascript
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function amplify(node, gain) { | |
const audioCtx = new AudioContext(); | |
const source = audioCtx.createMediaElementSource(node); | |
// create a gain node | |
const gainNode = audioCtx.createGain(); | |
gainNode.gain.value = gain; | |
source.connect(gainNode); | |
// connect the gain node to an output destination | |
gainNode.connect(audioCtx.destination); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function amplify(node,gain){const audioCtx=new AudioContext();const source=audioCtx.createMediaElementSource(node);const gainNode=audioCtx.createGain();gainNode.gain.value=gain;source.connect(gainNode);gainNode.connect(audioCtx.destination)} |
@Saiful-Islam-Sakib thank you! I wrote this before I discovered the extension Volume Master. In my opinion, just use the extension 😄
There's no doubt the extension is great, but I prefer using the code instead I’d rather not have any extensions running in the background 😅
Btw thanks.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@Saiful-Islam-Sakib thank you! I wrote this before I discovered the extension Volume Master. In my opinion, just use the extension 😄