在 The Web Audio Api 中,如何为 1/3 倍频程正确设置 BiquadFilter 的 Q 值

In The Web Audio Api, How to set correctly the Q value of a BiquadFilter for 1/3 of Octave

我想模拟经典的 1/3 频段模拟均衡器和 1 倍频程均衡器。我正在使用 BiquadFilter(峰值),但我无法找到如何为此正确设置 Q 值。

WAA 文档中没有等效项或示例值的示例。有谁知道我怎样才能做到这一点?

谢谢。

编辑

我找到了 that points to The Audio EQ Cookbook 并说:

As mentioned in https://webaudio.github.io/web-audio-api/#filters-characteristics, the formulas for the biquad filters are based on notes at http://www.musicdsp.org/files/Audio-EQ-Cookbook.txt

This says the Q and bandwidth are related by the formula 1/Q = 2*sinh(ln(2)/2*BW*w0/sin(w0)) where w0 = = 2*pi*f0/Fs and f0 is the center frequency and Fs is the sample rate.

在那个等式中我不确定如何正确地获得带宽,例如在这个页面 http://www.sengpielaudio.com/calculator-bandwidth.htm 我们可以看到一个公式表明 BW = f2 − f1 其中 f2 是下一个Eq 上的频率和 f1 上一个频率?

例如,如果 EQ 是 1/3 倍频程,中心频率是 1Khz,采样率是 44100hz,

f2 = 1250Hz f0 = 1000Hz f1 = 800hz

w0 = 2*pi*1000 / 44100 = 0.14247585730565954

BW = 1250hz - 800hz = 450

但这给出的 Q 1.09283639196669×10^-68 太小了。但是,如果我将 BW 假设为 1/3(如八度的三分之一),它给出的 4.30381250657881 几乎与同一个 Sengpiel Audio 网站中的 BW 到 Q 计算器相同。

那么为什么 BW = f2 − f1?在 Q 方程中,我应该使用 BW = 1 表示一个八度还是 BW = 1/3 表示三分之一?

此外,这个 Q 值是否与 BiquadFilter.Q 值兼容,还是我必须对其进行归一化?

Peaking Equalizers 给出了一个很好的描述以及 Q 和 BW 之间的简单关系。将其与音频食谱结合起来应该可以为您提供创建所需峰值滤波器所需的信息。