I’m trying to create a high-pass filter with -48dB roll-off, but the IIR::Coefficients::makeHighPass() does not provide such parameter.
Is there any way to achieve this? Thanks a lot.
Those methods only create 1st or 2nd order filters (6dB and 12dB of rolloff). For a steeper filter you need to chain multiple filters together, and adjust their Q factors for your requirements. EG if you want an 8th order butterworth, you cannot chain four 2nd order butterworth filters to get it.
Apologise but what can i do to achieve -48dB roll-off then
You need to chain together multiple 2nd order lowpass filters (12dB rolloff) to get steeper rolloff. But the tradeoff is that the Q factor for each section need to be tuned to keep the same shape in the passband.
Say you have a 2nd order Butterworth (Q factor of .707) which has a gain of -3dB at 1kHz.If you chain together four of these filters to get an 8th order filter (48dB rolloff) then the gain at 1kHz will be -12dB.
To get the same passband characteristics with the steeper rolloff you need to adjust the Q factors of each stage. You can look at the table here for the normalized filter coefficients. The entry for 8th order Butterworth gives you four second order polynomials. The coefficient of the middle term is 1 / Q factor.
So for an 8th order Butterworth the Q factors of each second order stage (called a “second order section”) is
Q1 = 1 / 0.39 = 2.56
Q2 = 1 / 1.11 = 0.90
Q3 = 1 / 1.66 = 0.66
Q4 = 1 / 1.196 = 0.84
Basically the idea is that each filter order gives you 6dB of rolloff (so 48dB = 8th order). You can make a higher order filter by chaining together multiple lower orders. But to get the same Q factor (which is kinda poorly defined for higher than second order filters, but for HPF/BPF/LPF just means “gain at the cutoff frequency”) the Q factors of those subfilters need to be adjusted.
Oh I’ve seen that order in the dsp::FilterDesign: designIIRHighpassHighOrderButterworthMethod(FloatType frequency, double sampleRate, int order), can i use this instead?