You can do high-order shelving filters by taking a low-pass prototype (eg. Butterworth, Bessel, whatever works, depending on the shelf-shape you want) and then performing band-pass transform twice [upon further though, I guess this is only needed for "band shelf" and not traditional low/high shelves], once for poles, once for zeroes. Then you place the poles/zeroes at offset frequencies from each other to control the shelf-gain. If you use the same prototype for both zeroes and poles and the prototype itself is monotonic, the shelf will be monotonic as well.Z1202 wrote:Ironically (or not) the method that I ended up with (and described above) does start from straight Butterworth and adjusts the Q. In the result you get a filter whose amplitude response is exactly the one of a 2-pole, just compressed in the logarithmic frequency scalemystran wrote:Yes, I just wanted to share my observation that you CAN start from straight Butterworth and then adjust the Q values directly and get something sensible. Again, for a 2-pole the Q value gives the gain at the angular frequency directly and this a rather useful property that can be used directly if the goal is to match the peaks of a 2-pole with a higher order filter of the type where all poles share the same angular frequency.
And I just started doing the same to 1-poles, works quite nicely. E.g. you can get a high-order shelving filter without resonance peaks and dips.
Calculating Q factor for cascading biquads
- KVRAF
- 7890 posts since 12 Feb, 2006 from Helsinki, Finland
Last edited by mystran on Fri Aug 18, 2017 3:53 pm, edited 1 time in total.
-
- KVRAF
- 1607 posts since 12 Apr, 2002
Essentially for 1-poles you start with a transfer function of a generic form
H(s)=(b1*s+b0)/(1+s)
Then after the substitution w<-w^N applied to |H(s)|^2=H(s)*H(s^*) the denominator turns into the Butterworth one of order N and actually so does the numerator (except that you get zeros and not poles).
This is easy to understand once we notice that
N(s)=b1*s+b0=b0*(1+s*b1/b0)=b0 * (1+ s/(b0/b1))
The expression b0/b1 works as the "cutoff" for the numerator, b0 is the global gain coefficient.
After the "Butterworth transformation" the numerator can be written in the form
b0 * Prod (s/(b0/b1)^(1/N) + p[n])
where p[n] is the negated n-th Butterworth pole (zero) for a unit-cutoff Butterworth and the product is taken for n=1 to N (notice that the "cutoff" has been compressed N times in logarithmic scale).
This further transforms as
Prod( b0^(1/N)*s/(b0/b1)^(1/N) + b0^(1/N)*p[n] )
or
Prod( b1^(1/N)*s + b0^(1/N)*p[n] )
Given a conjugate pair of poles p[n] and p^*[n] (recall that they are lying on the unit circle) the respective product is
( b1^(1/N)*s + b0^(1/N)*p[n] ) * ( b1^(1/N)*s + b0^(1/N)*p^*[n] ) =
b1^(2/N)*s^2 + (b0*b1)^(1/N)*(p[n]+p^*[n])*s + b0^(2/N) =
b1^(2/N)*s^2 + (b0*b1)^(1/N)*2R[n]*s + b0^(2/N)
where R[n] is the damping of the respective 2-pole stage
Thus, for each 2-pole stage we need a modal mixture
b1^(2/N)*HP + (b0*b1)^(1/N)*BPnorm + b0^(2/N)*LP
the mixture for the 1-pole non-resonating stage (for odd N) is obvious:
b1^(1/N)*HP + b0^(1/N)*LP
H(s)=(b1*s+b0)/(1+s)
Then after the substitution w<-w^N applied to |H(s)|^2=H(s)*H(s^*) the denominator turns into the Butterworth one of order N and actually so does the numerator (except that you get zeros and not poles).
This is easy to understand once we notice that
N(s)=b1*s+b0=b0*(1+s*b1/b0)=b0 * (1+ s/(b0/b1))
The expression b0/b1 works as the "cutoff" for the numerator, b0 is the global gain coefficient.
After the "Butterworth transformation" the numerator can be written in the form
b0 * Prod (s/(b0/b1)^(1/N) + p[n])
where p[n] is the negated n-th Butterworth pole (zero) for a unit-cutoff Butterworth and the product is taken for n=1 to N (notice that the "cutoff" has been compressed N times in logarithmic scale).
This further transforms as
Prod( b0^(1/N)*s/(b0/b1)^(1/N) + b0^(1/N)*p[n] )
or
Prod( b1^(1/N)*s + b0^(1/N)*p[n] )
Given a conjugate pair of poles p[n] and p^*[n] (recall that they are lying on the unit circle) the respective product is
( b1^(1/N)*s + b0^(1/N)*p[n] ) * ( b1^(1/N)*s + b0^(1/N)*p^*[n] ) =
b1^(2/N)*s^2 + (b0*b1)^(1/N)*(p[n]+p^*[n])*s + b0^(2/N) =
b1^(2/N)*s^2 + (b0*b1)^(1/N)*2R[n]*s + b0^(2/N)
where R[n] is the damping of the respective 2-pole stage
Thus, for each 2-pole stage we need a modal mixture
b1^(2/N)*HP + (b0*b1)^(1/N)*BPnorm + b0^(2/N)*LP
the mixture for the 1-pole non-resonating stage (for odd N) is obvious:
b1^(1/N)*HP + b0^(1/N)*LP
- KVRAF
- 7890 posts since 12 Feb, 2006 from Helsinki, Finland
Actually now that I think of it, do you even need a band-pass transform for low/high-shelves.. I guess not, I guess that's only needed for band-shelf filters.
- KVRAF
- 7890 posts since 12 Feb, 2006 from Helsinki, Finland
For what it's worth, I find it much easier to work with higher-order filters if you keep the transfer functions factored into biquads as much as possible. It isn't always possible, but it does work a surprisingly large amount of the time and makes everything a lot less tedious.
-
- KVRAF
- 1607 posts since 12 Apr, 2002
What are you referring to as "bandpass transform"? I just know s<-Q*(s+1/s), but that just doubles the order. And would you care to give a bit more detail about the above process?mystran wrote:You can do high-order shelving filters by taking a low-pass prototype (eg. Butterworth, Bessel, whatever works, depending on the shelf-shape you want) and then performing band-pass transform twice [upon further though, I guess this is only needed for "band shelf" and not traditional low/high shelves], once for poles, once for zeroes. Then you place the poles/zeroes at offset frequencies from each other to control the shelf-gain. If you use the same prototype for both zeroes and poles and the prototype itself is monotonic, the shelf will be monotonic as well.
Edit: oh, I see now, bandpass transform is not needed. Still I wonder what's your method with "poles and zeros". Sounds pretty close to what I just described. Even if it is, still sounds to me that the approach to arrive at that could have been different on your side. Would be interesting to know
Last edited by Z1202 on Fri Aug 18, 2017 3:58 pm, edited 1 time in total.
-
- KVRAF
- 1607 posts since 12 Apr, 2002
Not sure what are you referring to with that statement? FWIW, if you just care about the transfer function, I'd tend to agree, although as soon as nonlinear behavior is involved things start becoming differentmystran wrote:For what it's worth, I find it much easier to work with higher-order filters if you keep the transfer functions factored into biquads as much as possible. It isn't always possible, but it does work a surprisingly large amount of the time and makes everything a lot less tedious.
- KVRAF
- 7890 posts since 12 Feb, 2006 from Helsinki, Finland
Oh, this is exactly what I mean, but now that I think about it, it's not relevant for low/high shelves, I was somehow thinking about band-shelving filters (where, for completeness, you control the gain by using a different Q value for the BP-transform of poles vs. zeroes).Z1202 wrote:What are you referring to as "bandpass transform"? I just know s<-Q*(s+1/s), but that just doubles the order. And would you care to give a bit more detail about the above process?
- KVRAF
- 7890 posts since 12 Feb, 2006 from Helsinki, Finland
I mean when you design a transfer function for the purpose of getting a certain response in the linear case. Once you have the actual transfer function, whether you implement it with a cascade of biquads or somthing else is another thing, but it's easy to multiply things together (and then factor back to whatever structure you have) afterwards.Z1202 wrote:Not sure what are you referring to with that statement? FWIW, if you just care about the transfer function, I'd tend to agree, although as soon as nonlinear behavior is involved things start becoming differentmystran wrote:For what it's worth, I find it much easier to work with higher-order filters if you keep the transfer functions factored into biquads as much as possible. It isn't always possible, but it does work a surprisingly large amount of the time and makes everything a lot less tedious.
-
- KVRAF
- 1607 posts since 12 Apr, 2002
So would you care giving some further detail for what you've just mentioned as a way to design shelving filters by using poles/zeros. I half-way expect it's going to be very similar to what I just described, but sounds somewhat more generic and also could have a different explanation
-
- KVRAF
- 1607 posts since 12 Apr, 2002
Okay, I might get an idea of the explanation. Essentially the "denominator" and the "numerator" amplitude responses "subtract" in the logarithmic scale. Still it's interesting to know that this is exactly a "compressed" response of a 1-pole shelf.
Edit: although I'm still not sure how is monotonicity of the amplitude response guaranteed (just from this point of view)
Edit: although I'm still not sure how is monotonicity of the amplitude response guaranteed (just from this point of view)
- KVRAF
- 7890 posts since 12 Feb, 2006 from Helsinki, Finland
Take a number of poles. Places zeroes so they overlap. Now offset the frequency scale of the poles in one direction and the zeroes in the other direction. You end up with a shelf.Z1202 wrote:So would you care giving some further detail for what you've just mentioned as a way to design shelving filters by using poles/zeros. I half-way expect it's going to be very similar to what I just described, but sounds somewhat more generic and also could have a different explanation
edit: this is very easy to do if you work in a coordinate system with [omega,Q] as the basis vectors.
Last edited by mystran on Fri Aug 18, 2017 4:22 pm, edited 1 time in total.
-
- KVRAF
- 1607 posts since 12 Apr, 2002
Okay, so what I just proposed above is essentially the same, just arrived at from a different angle.mystran wrote:Take a number of poles. Places zeroes so they overlap. Now offset the frequency scale of the poles in one direction and the zeroes in the other direction. You end up with a shelf.Z1202 wrote:So would you care giving some further detail for what you've just mentioned as a way to design shelving filters by using poles/zeros. I half-way expect it's going to be very similar to what I just described, but sounds somewhat more generic and also could have a different explanation
-
- KVRer
- Topic Starter
- 5 posts since 19 Sep, 2016
How do you deal with a Q factor less than 0.5?Mayae wrote: ↑Tue Aug 01, 2017 10:57 pm Your formulas work nicely for designing butterworth filters of degree N as said, but let's assume a Q of 1. GivenThen the angle becomesCode: Select all
Q=1/(2*cos(w))
Code: Select all
w = acos(1/(2*Q)) = 60 degs (or pi/3)
When you set Q=0.5, then you're plugging a value >= 1 into acos:
Code: Select all
w = acos(1/(2*Q)) = acos(1/(2*0.5)) = acos(1) = NaN
-
- KVRAF
- 1607 posts since 12 Apr, 2002
In Butterworth designs you don't get those.
There's no angle anymore. See this Section 4.3.mibix wrote: ↑Sun Oct 14, 2018 7:04 pm How do you deal with a Q factor less than 0.5?
When you set Q=0.5, then you're plugging a value >= 1 into acos:
Is there a way to find the angle and generate the two Q values without delving into complex numbers?Code: Select all
w = acos(1/(2*Q)) = acos(1/(2*0.5)) = acos(1) = NaN
If you still want to play around with Q, one way to do that (derived from the expressed earlier ideas) is described in Section 8.7. Otherwise you're pretty free to do what you want
- KVRAF
- 7890 posts since 12 Feb, 2006 from Helsinki, Finland
NaN (not a number) here essentially means "not real-valued" since the result is imaginary (ie. instead of a complex conjugate pole-pair, you have two real-valued poles).mibix wrote: ↑Sun Oct 14, 2018 7:04 pm When you set Q=0.5, then you're plugging a value >= 1 into acos:
Code: Select all
w = acos(1/(2*Q)) = acos(1/(2*0.5)) = acos(1) = NaN
Use the identity cos(i*x)=cosh(x) to deal with these.