js实现浏览器中使用莫格滤波器Moog Filter实时捕获麦克风声音并变声输出代码
代码语言:html
所属分类:其他
代码描述:js实现浏览器中使用莫格滤波器Moog Filter实时捕获麦克风声音并变声输出代码
代码标签: js 浏览器 实时 捕获 麦克风 声音 变声 输出 代码 莫格滤波器 Moog Filter
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width,initial-scale=1.0,maximum=1.0,minimum=1.0,user-scalable=0" /> <title>BFW NEW PAGE</title> <script type="text/javascript"> navigator.mediaDevices.getUserMedia({ audio: true }) .then(function(stream) { let audioContext = new AudioContext(); let microphoneStream = audioContext.createMediaStreamSource(stream); var bufferSize = 4096; // 创建变声效果的处理节点 let processor = audioContext.createScriptProcessor(bufferSize, 1, 1); let pitchShift = 1.7; // 设置音调变化倍率 var in1, in2, in3, in4, out1, out2, out3, out4; in1 = in2 = in3 = in4 = out1 = out2 = out3 = out4 = 0.0; processor.cutoff = 0.765; // between 0.0 and 1.0 processor.resonance = 1.99; // between 0.0 and 4.0 processor.onaudioprocess = function(e) { var input = e.inputBuffer.getChannelData(0); var output = e.outputBuffer.getChannelData(0); var f = processor.cutoff * 1.........完整代码请登录后点击上方下载按钮下载查看
网友评论0