Is this is an Equalizer...right?

Is this is an Equalizer...right?
0
#1

I found this on Ethans site…

// Analog Transfer Function: H(s) = s^2 / (s^2 + s/Q + 1)

float Fs = 44100;
float Pi = 3.141592;

float f0 = 100; //cut-off
float Q = 1.5; //filter Q
float w0 = 2 * Pi * f0 / Fs;
float alpha = sin(w0) / (2 * Q);
float a0 = 1 + alpha;
float a1 = -2 * cos(w0);
float a2 = 1 - alpha;
float b0 = (1 + cos(w0)) / 2;
float b1 = -(1 + cos(w0));
float b2 = (1 + cos(w0)) / 2;

float Buffer[1024];
float PrevSample[3]; //max3

int I = 0;
int N = 1024;

while (I < N) {
PrevSample[2] = PrevSample[1]; //slide sample position
PrevSample[1] = PrevSample[0];
PrevSample[0] = Buffer[I];
Buffer[I] = ( b0 / a0 * PrevSample[0]) +
(b1 / a0 * PrevSample[1]) +
(b2 / a0 * PrevSample[2]) -
(a1 / a0 * Buffer[I - 1]) -
(a2 / a0 * Buffer[I - 2]);
I = I + 1;
}

I know that’s probably way basic, but what am I looking at? Is this en entire EQ plugin or just a single band? Can anyone tell by looking at it?

1 Like

#2

It’s a single band. Low pass filter. To make multiple bands, you just run that algorithm in series a bunch of times.

these lines determine what type of filter it is:

float a0 = 1 + alpha;
float a1 = -2 * cos(w0);
float a2 = 1 - alpha;
float b0 = (1 + cos(w0)) / 2;
float b1 = -(1 + cos(w0));
float b2 = (1 + cos(w0)) / 2;

That combo indicates it’s a low pass filter.

4 Likes

#3

So it is based on trig?

0 Likes

#4

Most audio DSP is based on trig, being that it’s waves.

Although in my mind, trig is nothing more than memorizing lists of properties that have to do with sine, cosine and tangent. At least when I took a class in high school that’s all it was. When you find an actual purpose for it, it’s much less abstract and is a lot easier to understand. All the properties you had to memorize in high school made no sense at all without application.

0 Likes

#5

I agree. When I started college, I took calculus, thinking I might go into engineering. The textbook consisted of equations that would go on for 3 pages, and then say: Therefore:, and then 3 more pages. Like memorizing hieroglyphics.
Trig was a little easier, but I never figured out how to use it. I can see how it would apply to as slopes, delay times, etc. It takes a specific kind of brain to work with that stuff.

0 Likes