 # Filter explanation

Hey guys, I was working with maximilian and saw the low and high pass filters, I looking for where i can read or get an explanation of the actual computation thats actually happening. I know the low pass and high pass are essentially the same and that the lowres and hires is the same, but its more again of the computational part, like what the variables mean? and how you would go about calculating the filters and what not.

``````double maxiFilter::lopass(double input, double cutoff) {
output=outputs + cutoff*(input-outputs);
outputs=output;
return(output);
}

//as above
double maxiFilter::hipass(double input, double cutoff) {
output=input-(outputs + cutoff*(input-outputs));
outputs=output;
return(output);
}
//awesome. cuttof is freq in hz. res is between 1 and whatever. Watch out!
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);
}

//working hires filter
double maxiFilter::hires(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=input-y;
return(output);
}
``````

Sorry for all the questions in advance.

These YouTube links should get you started. He explains a lot of details & shows some code examples. The language used is Faust, which is specially designed for DSP work. You don’t really need to know anything about the language to understand the basic concepts.

CCRMA Faust Workshop 2015 - Part 7: FIR Filters and Flanger

CCRMA Faust Workshop 2015 - Part 12: Other Filters and Filter Bank

All other videos from the 2015 course. Good as well!

If you’re looking to go deep into the mathematics then this is probably not that helpful, but Jack Schaedler has a tutorial on filters and Fourrier analysis, with lots of really good animations.

https://jackschaedler.github.io/circles-sines-signals/

1 Like