gpt4 book ai didi

javascript - 如何使用 Web Audio API 降低麦克风输入的噪音?

转载 作者:数据小太阳 更新时间:2023-10-29 05:33:45 25 4
gpt4 key购买 nike

我一直在尝试使用 Web Audio API 并将笔记本电脑的麦克风用作输入源。不过,当我听输入时,我能听到很多白噪音;我怎样才能创建一个过滤器来降低噪音,使声音更清晰?有没有针对这种情况提供预写噪声过滤器的库?

最佳答案

'`我正在研究一些 POC 并使用 BiquadFilter 减少笔记本电脑的“生命周期 Nose ”。我也用过压缩器,但你不必))

(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 );
}
})();

关于javascript - 如何使用 Web Audio API 降低麦克风输入的噪音?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16949768/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com