Filter 网络音频过滤器响应

Filter 网络音频过滤器响应,filter,web-audio-api,Filter,Web Audio Api,我有一个简单的过滤器 var filter = ctx.createBiquadFilter(); filter.type = 'highpass'; filter.frequency.setValueAtTime(10,ctx.currentTime); 我想使用getFrequencyResponse window.setInterval(function() { var frequencyHz = new Float32Array(1), magResponse

我有一个简单的过滤器

var filter = ctx.createBiquadFilter();
filter.type = 'highpass';
filter.frequency.setValueAtTime(10,ctx.currentTime);
我想使用
getFrequencyResponse

window.setInterval(function() {
    var frequencyHz = new Float32Array(1),
        magResponse = new Float32Array(1),
        phaseResponse = new Float32Array(1);
    frequencyHz[0] = 10;
    filter.getFrequencyResponse(frequencyHz,magResponse,phaseResponse);
    console.log(magResponse);
},100);
我希望看到
[0.9565200805664062]
这是10Hz的正确响应,但我看到的是
[0.0008162903832271695]
这是350Hz的响应,默认频率值。 如果我手动设置值,我只能得到一个合理的响应,而如果我使用param方法,例如
setValueAtTime
,则过滤器响应会忽略它们并输出默认值。换句话说,
getFrequencyResponse
似乎只有在手动设置过滤器值时才起作用,从而在自动设置值时阻止过滤器分析。如果这是真的,那么这似乎不仅仅是api的一个小问题


有人请尝试与此相近的东西,如果它有效(可疑),请发布代码。

实际上,不,它应该会生效,但由于您在下一个处理块(即“.currentTime”的意思)导致瞬时值更改,该更改尚未处理-因此您看到了默认值。例如,您应该看到SetLinearamp的getFrequencyResponse会随着时间的推移而变化。

我也尝试过Linearamp,但运气不佳。我使用一个时间间隔多次查看响应数据,因此无论我使用的参数类型如何,都应该对其进行处理,并在某个时候看到效果。试试看。哦,嘿,克里斯,我不知道是你。谢谢你花时间关注这个链接,如果你是这样来到这里的。