 # maxiFilters

hey guys, so I was working with the maximilian filters and was wondering what exactly lores was doing because its calculating values and I thought I should know what its doing just in case I end up going wrong somewhere.

``````double maxiFilter::lores(double input,double cutoff1, double resonance) {
cutoff=cutoff1;
if (cutoff<10) cutoff=10;
if (cutoff>(maxiSettings::sampleRate)) cutoff=(maxiSettings::sampleRate);
if (resonance<1.) resonance = 1.;
z=cos(TWOPI*cutoff/maxiSettings::sampleRate);
c=2-2*z;
double r=(sqrt(2.0)*sqrt(-pow((z-1.0),3.0))+resonance*(z-1))/(resonance*(z-1));
x=x+(input-y)*c;
y=y+x;
x=x*r;
output=y;
return(output);
}
``````

Weird little filter (and looking at this source it seems to be the same as `hires`?). I’m not doing any analysis and this is really quick, so if there’s a mistake correct me.

Here are the design formula:

• `F` = cutoff frequency
• `Q` = resonance,
• `Fs` = sample rate
• `x[n]` is the input signal
• `y[n]` is the output signal
• `u[n]` and `q[n]` are internal signals
``````z = cos (2π F ÷ Fs)
c = 2 (1 - z)

(z - 1)^3 + Q(z - 1)
r^2 = 2 ----------------------
Q (z - 1)

u[n] = q[n-1] + c (x[n] - y[n-1])
y[n] = u[n] + y[n-1]
q[n] = r u[n]
``````

The filter topology looks a little like this (forgive formatting, this was quick and dirty) : `u[n]` and `q[n]` are the feed forward and feedback paths of the network between the two summers with y[n-1], respectively.

What’s neat is that if you remove that network, you get the difference equation

`````` y[n] = c(x[n] - y[n-1]) + y[n-1]
``````

Which is an exponential moving average. My guess is that internal network allows for adjustable resonance in a one-zero lowpass, but you might want to inspect it a bit more. Try taking the impulse response and using Octave or sigpy to analyze it with different settings.

This would be a good practice problem for Mason’s Gain Rule to figure out the transfer function in terms of `c` and `r`.

1 Like