BiquadFilterNode.Q for the NOTCH filter

2019-08-27 15:12发布

I cannot find any documentation on how the BiquadFilterNode.Q value works if you set the BiquadFilterNode.type to be 'notch'. The notch filter should, in practice, attenuate signals within a range of frequencies, but BiquadFilterNode.frequency seems to control "the center of the range of frequencies" and the Q value is said to control "the width of the frequency band".

However, there is no info on what units would be used. Say, if I want to attenuate signals with frequencies between 300 Hz - 700 Hz, the center is 500 Hz so I set the frequency to be that, but what value of Q would be correct for this range?

2条回答
仙女界的扛把子
2楼-- · 2019-08-27 15:31

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.

查看更多
Evening l夕情丶
3楼-- · 2019-08-27 15:41

Pulled this off the internet but try it out:

// fc = cutoff frequency
// f2 = upper cutoff frequency
// f1 = lower cutoff frequency 
Q = (f2 - f1) / fc;

Wikipedia article on Q factor: Q Factor Wiki

Electronics Learning website: Quality Factor Calculator

查看更多
登录 后发表回答