I'd like to display the freq response of a Sallen Key filter type (in the specific case, this simple resonant filter).
on biquad, for example, I calculate magnitude and phase from zeros and poles, such as (in cpp):
// zeros
std::complex<double> resZeros(0.0, 0.0);
resZeros += mCoefficients.mA0 * std::exp(std::complex<double>(0.0, -0 * freq * k2PI));
resZeros += mCoefficients.mA1 * std::exp(std::complex<double>(0.0, -1 * freq * k2PI));
resZeros += mCoefficients.mA2 * std::exp(std::complex<double>(0.0, -2 * freq * k2PI));
// poles
std::complex<double> resPoles(0.0, 0.0);
resPoles += 1.0 * std::exp(std::complex<double>(0.0, -0 * freq * k2PI));
resPoles += mCoefficients.mB1 * std::exp(std::complex<double>(0.0, -1 * freq * k2PI));
resPoles += mCoefficients.mB2 * std::exp(std::complex<double>(0.0, -2 * freq * k2PI));
std::complex<double> res = resZeros / resPoles;
// magnitude
float magnitude = (float)std::abs(res);
if (std::isnan(magnitude)) {
magnitude = 0.0f;
}
// phase
float phase = (float)std::arg(res); // i.e. math.atan2(res.im, res.re)
if (std::isnan(phase)) {
phase = 0.0f;
}
return std::polar(magnitude, phase);
this code is taken from the web :) can I do the same with the filter above? generally, can I do it with different kind of filters?

buf0andbuf1get defined in terms of their previous values. – robert bristow-johnson Jul 03 '23 at 20:59