Created
June 14, 2017 08:42
-
-
Save Deliaz/a62265a8bf7c177cb8b52eee4bb19698 to your computer and use it in GitHub Desktop.
Just some tips apply filters to an audio from video stream
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
// # 1st way | |
var context = new AudioContext(); | |
var source = context.createMediaElementSource(document.querySelector('.video-stream.html5-main-video')); | |
//Now we want to create a filter | |
var filter = context.createBiquadFilter(); | |
source.connect(filter); //and of course connect it | |
filter.type = "highshelf"; //this is a lowshelffilter (try excuting filter1.LOWSHELF in your console) | |
filter.frequency.value = 200; //as this is a lowshelf filter, it strongens all sounds beneath this frequency | |
filter.gain.value = 50; //the gain with which it should increase | |
//now we want to connect that to the output | |
filter.connect(context.destination); | |
// # 2nd way | |
var context = new AudioContext(); | |
var source = context.createMediaElementSource(document.querySelector('.video-stream.html5-main-video')); | |
var gainNode = context.createGain(); | |
gainNode.gain.value = 10; | |
source.connect(gainNode); | |
gainNode.connect(context.destination); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment