Higher order filters

Nyquist has some definitions for 4-pole, 6-pole, and 8-pole butterworth filters.

For instance, from dspprims.lsp:

(defun highpass8 (x hz)
  (highpass2 (highpass2 (highpass2 (highpass2 x hz 0.57622191)
                                                hz 0.66045510) 
                                                hz 0.94276399)
                                                hz 2.57900101))

However I fear that the Q values being used are incorrect as they disagree with multiple sources:



Web applet:


Both give Q values of:


The disagreement between these sources and nyquist look significant to me. Can anyone confirm or refute the veracity of either set of values?

I think the values used in Nyquist were tweaked by hand to give better approximations of the ideal filter characteristics than are achieved using the theoretically “correct” values. The frequency response and group delay of the Nyquist filters certainly appear to be pretty close to “ideal”.

Arent the theoretically correct values also the only ones that will give a maximally flat (“butterworth”) frequency response?

Does anyone know which are the theoretically correct values?

The theory is explained here: http://www.earlevel.com/main/2016/09/29/cascading-filters/

You can try out different values yourself using Nyquist’s BIQUAD ( or BIQUAD-M) functions:

The Biquad Calculator from the same site will help you determine the biquad parameters:

Yes and those values disagree with Nyquists. See the problem?

I wanted to plug in those earlevel 20-pole values, but first I compared the 8-pole values to nyquists 8-pole values. The 6-pole and 4-pole also disagree. Something aint right.

Only one set can be right, and when I see conflicting values I think maybe I should do a google search of those values:

The Nyquist 8-pole butterworth Q’s only seem to appear in pages about audacity/nyquist.
The Earlevel 8-pole butterworth Q’s only seem to appear there and in ButterQValues.pdf at evansville.edu. Possibly the former is copying the later.

I worry about details like this. In butterworth filters the only quality parameter being played with is the number of poles. Playing with Q’s gives you other types of filters like chebyshev.

Given the sparsity of google search results for the 8-pole Q’s, I think that there is a very real chance that neither set of Q’s is right. Quite depressing.

I don’t think that is correct.

By way of analogy, if you were creating these filters in hardware as capacitor-resistor networks, there are many alternative choices of values to produce the required filter. The important thing is that the set of values used produces the required result. High order IIR filters are usually produced by cascading multiple low order feedback delay filters. An error at one level of the cascade will be compounded by subsequent levels of the cascade. Alternatively, the subsequent levels of the cascade can be tweaked to compensate for errors higher up the cascade, so that the overall result is better than using the “right” values. The situation is not a bad for digital filters as for traditional analogue filters because we are not limited by choices of standard component values, but we still don’t have infinite precision.

The big question is: “Do the Nyquist filters produce the right results?”
Some years ago I noticed this difference from the usual quoted values, so I tested the filters, and was pleasantly surprised by how close they model “ideal” filters.
It’s all open source, so you are free to hack the code and substitute the “correct” values, then compare the results with what Nyquist uses. I expect that the result will be very similar, but not quite as good.

After a bit of research (and some sleeping on it) …

All the butterworth tables out there are for the s-domain coefficients … analog filters … there is only one set of these coefficients once normalized so there you go… people put them in tables.

There isnt “One True Table” for digital butterworths like there is analog butterworths because as a digital filter it is the z-domain coefficients that are needed. I’m not much of a advanced math guy, but my understanding is that the sampling rate is a factor of the bilinear transform from the normalized s-domain coefficients to the z-domain coefficients, therefore there can be no One True Table for the digital world.

The earlevel/evansville coefficients are pulled “directly” out of the s-domain polynomials, each the reciprocal of one of the polynomials constants.

So there it is I guess. The earlevel/evansville values can’t be right for a digital filter, and the nyquist values are probably “optimized” for nyquists default sound-srate of 44100

Here is all the evidence necessary… the signal is a linear chirp from 1hz to the nyquist rate (24000hz)

The top is filtered by nyquists lowpass8() function with a 12000hz cutoff
The bottom is filtered using the Q values given elsewhere at the same 12000hz cutoff.


Clearly the alternative Q values produce significant attenuation all the way across the pass band.

Avoid those Q’s. Would not recommend.

Simple test rig:

;nyquist plug-in
;version 4
;type process
;codetype sal
;name "8 pole butter testing"

;control hz "cutoff" float-text "hz" "12000" nil nil
;control method "method" choice "Nyquist, Alternative" 0

variable butterQ-8 = vector(0.50979558, 0.60134489, 0.89997622, 2.5629154)

function lowpass-8(s, hz) return lowpass2(lowpass2(lowpass2(lowpass2(s, hz, butterQ-8[0]), hz, butterQ-8[1]), hz, butterQ-8[2]), hz, butterQ-8[3])

function main() begin
  return #?(method = 0, lowpass8(*track*, hz), lowpass-8(*track*, hz))

So you’re happy that the Nyquist filters work correctly?

I guess it works as advertised.

Was hoping those Q tables would be correct. This news doesnt help help at all with getting a significantly higher order lowpass capability into a nyquist effect.

Here’s an 8th order 10000 Hz low pass filter based on cascading biquad filters with Q values from this page: http://www.earlevel.com/main/2016/09/29/cascading-filters/ and biquad parameters from this page: http://www.earlevel.com/main/2013/10/13/biquad-calculator-v2/

(setf b0 0.21683529588969896)
(setf b1 0.43367059177939793)
(setf b2 0.21683529588969896)
(setf a0 1.0)
(setf a1 -0.14770935819940134)
(setf a2 0.015050541758197231)
(setf *track* (biquad-m *track* b0 b1 b2 a0 a1 a2))

(setf b0 0.23441015370614224)
(setf b1 0.4688203074122845)
(setf b2 0.23441015370614224)
(setf a0 1.0)
(setf a1 -0.15968144492938235)
(setf a2 0.09732205975395142)
(setf *track* (biquad-m *track* b0 b1 b2 a0 a1 a2))

(setf b0 0.2757000746652961)
(setf b1 0.5514001493305922)
(setf b2 0.2757000746652961)
(setf a0 1.0)
(setf a1 -0.18780835895394715)
(setf a2 0.29060865761513177)
(setf *track* (biquad-m *track* b0 b1 b2 a0 a1 a2))

(setf b0 0.3581186053323747)
(setf b1 0.7162372106647494)
(setf b2 0.3581186053323747)
(setf a0 1.0)
(setf a1 -0.24395230091976342)
(setf a2 0.6764267222492621)
(biquad-m *track* b0 b1 b2 a0 a1 a2)

and this is the effect on a 100 to 20000 Hz chirp with constant (0.8) level:
and this is the spectrum of filtered white noise:
window-Frequency Analysis-000.png