How to adjust the Q: FilterDesign::designIIRHighpassHighOrderButterworthMethod

the dsp::FilterDesign::designIIRHighpassHighOrderButterworthMethod functions let us compute the coefficients for a highpass filter with a slope that is a multiple of 6db/oct (the order).
However, they don’t let us adjust the Q. Instead, the Q is computed for us automatically based on the filter order we supply.

I’m trying to replicate the Q control in Logic Pro X’s channel EQ.

Screen Shot 2021-01-25 at 1.59.13 AM Screen Shot 2021-01-25 at 1.58.50 AM

I know I need to directly call IIR::Coefficients::makeHighPass() or makeFirstOrderHighPass for each link in my ProcessChain required for the slope I need, but I don’t know what to supply for the Q parameter to these functions.

the helper function that produces the array of coefficients computes the Q via this if the order is a multiple of 12db/oct:

auto Q = 1.0 / (2.0 * std::cos ((2.0 * i + 1.0) * MathConstants<double>::pi / (order * 2.0)));

or this, if the order is not:

auto Q = 1.0 / (2.0 * std::cos ((i + 1.0) * MathConstants<double>::pi / order));

Can anyone shed some insight on how the 0.10 and 100 work as a Q parameter in the Logic Pro X channel EQ?

How would that same computation be used as the IIR::Coefficients::makeHighPass() Q param?

if you take the 2nd order highpass definition in the s domain

H(s) = -----------------------
        s^2 + (wc/Q) s + wc^2

then Q is the gain at the cutoff frequency (solve |H(jwc)|).

If you cascade two of these filters together to get a 4th order filter:

G(s) = H(s) H(s)

Then the gain at wc will be Q^2.

Looking at the plots, it looks like for the 4th order highpass, they cascade two 2nd order highpass filters whose independent Q factor is sqrt(Q) if Q > 1, Q ottherwise, (so, if user Q > 1, Q1 = sqrt(Q), Q2 = sqrt(Q), else, Q1 = Q2 = Q)

You can see this assymmetry where the gain at the cutoff frequency is 100 (20dB) when the Q factor is 100, but 0.01 (-40dB) when the Q factor is 0.1 (so Q^2). I’m not sure why they would do that, maybe to keep the cutoff gain -6dB when Q = 0.707?