问题
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?
回答1:
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
回答2:
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.
来源:https://stackoverflow.com/questions/45242936/biquadfilternode-q-for-the-notch-filter