I've been playing around with the Web Audio API and using my laptop's microphone as an input source. I can hear a lot of white noise when I listen to the input though; how can I create a filter to reduce the noise so that the sound is clearer? Are there any libraries that provide a pre-written noise filter for this situation?
'`m working on some POC and reduced laptop "life noses" with a BiquadFilter. I have also use a compressor but you don't have to ))
(function(){
var filter, compressor, mediaStreamSource;
// Start off by initializing a new context.
var context = new (window.AudioContext || window.webkitAudioContext)();
navigator.getUserMedia = navigator.getUserMedia || navigator.webkitGetUserMedia;
navigator.getUserMedia( {audio:true}, initAudio , function(err){
console.log('usermedia error', err)
});
function initAudio(stream) {
compressor = context.createDynamicsCompressor();
compressor.threshold.value = -50;
compressor.knee.value = 40;
compressor.ratio.value = 12;
compressor.reduction.value = -20;
compressor.attack.value = 0;
compressor.release.value = 0.25;
filter = context.createBiquadFilter();
filter.Q.value = 8.30;
filter.frequency.value = 355;
filter.gain.value = 3.0;
filter.type = 'bandpass';
filter.connect(compressor);
compressor.connect(context.destination)
filter.connect(context.destination)
mediaStreamSource = context.createMediaStreamSource( stream );
mediaStreamSource.connect( filter );
}
})();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With