AudioContext
的createBiquadFilter()
方法创建了一个 BiquadFilterNode
, 它提供了一个可以指定多个不同的一般滤波器类型的双二阶滤波器。
语法
var audioCtx = new AudioContext(); var biquadFilter = audioCtx.createBiquadFilter();
返回
一个 BiquadFilterNode
.
示例
这个例子展示了一个利用AudioContext 创建四项滤波器节点( Biquad filter node)的例子。想要查看完整工作的示例,请查看我们的For voice-change-o-matic 样例 (也可以查看 源码 ).
var audioCtx = new (window.AudioContext || window.webkitAudioContext)(); //set up the different audio nodes we will use for the app var analyser = audioCtx.createAnalyser(); var distortion = audioCtx.createWaveShaper(); var gainNode = audioCtx.createGain(); var biquadFilter = audioCtx.createBiquadFilter(); var convolver = audioCtx.createConvolver(); // connect the nodes together source = audioCtx.createMediaStreamSource(stream); source.connect(analyser); analyser.connect(distortion); distortion.connect(biquadFilter); biquadFilter.connect(convolver); convolver.connect(gainNode); gainNode.connect(audioCtx.destination); // Manipulate the Biquad filter biquadFilter.type = "lowshelf"; biquadFilter.frequency.value = 1000; biquadFilter.gain.value = 25;
规格
Specification | Status | Comment |
---|---|---|
Web Audio API createBiquadFilter() |
Working Draft |
浏览器兼容性
Feature | Chrome | Edge | Firefox (Gecko) | Internet Explorer | Opera | Safari (WebKit) |
---|---|---|---|---|---|---|
Basic support | 10.0webkit | (Yes) | 25.0 (25.0) | 未实现 | 15.0 webkit 22 |
6.0webkit |
Feature | Android | Edge | Firefox Mobile (Gecko) | Firefox OS | IE Mobile | Opera Mobile | Safari Mobile | Chrome for Android |
---|---|---|---|---|---|---|---|---|
Basic support | ? | (Yes) | 26.0 | 1.2 | ? | ? | ? | 33.0 |