In a typical resonant bandpass filter, resonance is set as none at 0 and full at 1, such that notes ring infinitely at 1 and not at all at 0.
If you have a two-pole resonant bandpass filter with a basic single sample impulse excitation to a maximum amplitude of "1" and a given resonance setting between 0 and 1:
What is the mathematical equation that would allow you to predict the decay time of the resonant filter based on its resonance setting? For example, to an arbitary level of "1/e"? ie. To 36.7879% its original amplitude?
Predicting decay time of a resonant bandpass filter based on its resonance setting between 0 and 1?
-
- KVRAF
- 1607 posts since 12 Apr, 2002
The 2-pole output decays as exp( t * Re p ) in analog and |p|^n in digital case, where p is one of the filter's poles.
If the poles are real you have two answers, take the one which decays slower. If you need an exact target level, you'll need to take both then, but you'll need to know their relative amplitudes, off the top of my head I wouldn't be able to write the respective equations, needs some paperwork
If the poles are real you have two answers, take the one which decays slower. If you need an exact target level, you'll need to take both then, but you'll need to know their relative amplitudes, off the top of my head I wouldn't be able to write the respective equations, needs some paperwork
-
Music Engineer Music Engineer https://www.kvraudio.com/forum/memberlist.php?mode=viewprofile&u=15959
- KVRAF
- 4293 posts since 8 Mar, 2004 from Berlin, Germany
this is the function, i'm using for this:
filter difference equation is:
y[n] = something-with-old-inputs - a1*y[n-1] - a2*y[n-2]
rsLogB is the base-B logarithm i.e. log(x)/log(B). but this formula does not take into account the positions of the zeros and i'm not sure how i would take them into account. maybe by evaluating the magnitude response at the pole-frequencies/angles? or would i need to do the partial fraction expansion to obtain the pole "residues"? dunno - so far, the pole-only based formula was good enough for my purposes.
btw. if i remember correctly, using "+" in the pole-computation instead of "-" (you may recognize the formula as the "p-q-formula") makes sure to select the larger pole (with slower decay) in case of two real poles...edit: wait - i think, i need to actually verify this...the sqrt function will return a positive number in this case, so if -a1 is positive, too, "+" will indeed result in the larger number - i think, using the negative sign convention for a-coeffs (as i do), a1 will indeed be negative, so -a1 should be positive. i hope so...
Code: Select all
template<class T>
T biquadRingingTime(T a1, T a2, T threshold)
{
std::complex<T> p = -T(a1/2.0) + sqrt(std::complex<T>(a1*T(a1/4.0)-a2)); // 1st pole
return (T) rsLogB(threshold, abs(p));
}
y[n] = something-with-old-inputs - a1*y[n-1] - a2*y[n-2]
rsLogB is the base-B logarithm i.e. log(x)/log(B). but this formula does not take into account the positions of the zeros and i'm not sure how i would take them into account. maybe by evaluating the magnitude response at the pole-frequencies/angles? or would i need to do the partial fraction expansion to obtain the pole "residues"? dunno - so far, the pole-only based formula was good enough for my purposes.
btw. if i remember correctly, using "+" in the pole-computation instead of "-" (you may recognize the formula as the "p-q-formula") makes sure to select the larger pole (with slower decay) in case of two real poles...edit: wait - i think, i need to actually verify this...the sqrt function will return a positive number in this case, so if -a1 is positive, too, "+" will indeed result in the larger number - i think, using the negative sign convention for a-coeffs (as i do), a1 will indeed be negative, so -a1 should be positive. i hope so...