0
$\begingroup$

Please forgive my bad English.

Hello, I'm trying to understand Shibatch's super equalizer Winamp plugin source, but I'm not good at DSP and mathematics.

It seems that super equalizer plugin uses overlap-add method to evaluate FIR filter. The code that calculates the FIR filter coefficients in super equalizer is like this: (Just the simplified pseudocode... not the exact code.)

for (int i = 0; i != FILTER_LENGTH; ++i)
{
    int t = i - FILTER_LENGTH / 2;

    result[i] =
        band_gain[0] * LPF(t, band_freq[0]) +
        band_gain[1] * (LPF(t, band_freq[1]) - LPF(a, band_freq[0])) +
        band_gain[2] * (LPF(t, band_freq[2]) - LPF(a, band_freq[1])) +
        band_gain[3] * (LPF(t, band_freq[3]) - LPF(a, band_freq[2])) +
        band_gain[4] * (IMPULSE(t) - LPF(t, band_freq[3]));

    result[i] *= WINDOW(t);
}

LPF is lowpass filter function. LPF(t, CutoffFrequency)

IMPULSE(t) is 1 when t is 0. Otherwise IMPULSE(t) is 0.

WINDOW(t) is Kaiser window function.

band_freq array contains equalizer frequency bands.

band_gain array contains the weight of each frequency bands.

I assumed there are just four frequency bands.

band_gain[0] = weight of 0Hz ~ band_freq[0]Hz
band_gain[1] = weight of band_freq[0]Hz ~ band_freq[1]Hz
band_gain[2] = weight of band_freq[1]Hz ~ band_freq[2]Hz
band_gain[3] = weight of band_freq[2]Hz ~ band_freq[3]Hz
band_gain[4] = weight of band_freq[3]Hz ~ SAMPLING_RATE / 2

I want to know this part:

result[i] =
    band_gain[0] * LPF(t, band_freq[0]) +
    band_gain[1] * (LPF(t, band_freq[1]) - LPF(a, band_freq[0])) +
    band_gain[2] * (LPF(t, band_freq[2]) - LPF(a, band_freq[1])) +
    band_gain[3] * (LPF(t, band_freq[3]) - LPF(a, band_freq[2])) +
    band_gain[4] * (IMPULSE(t) - LPF(t, band_freq[3]));

What formula does the code using? Or... what should I study to understand the code?

Any answer is welcome. Keyword suggestion is welcome.

Thanks.

$\endgroup$
2
$\begingroup$
result[i] =
band_gain[0] * LPF(t, band_freq[0]) +
band_gain[1] * (LPF(t, band_freq[1]) - LPF(a, band_freq[0])) +
band_gain[2] * (LPF(t, band_freq[2]) - LPF(a, band_freq[1])) +
band_gain[3] * (LPF(t, band_freq[3]) - LPF(a, band_freq[2])) +
band_gain[4] * (IMPULSE(t) - LPF(t, band_freq[3]));

is actually very simple to explain with pictures. First we assume f0 < f1 < f2 < f3.... lets look at one section

band_gain[0] * LPF(t, band_freq[0]) means create a low pass filter with cutoff frequency band_freq[0] it then says to multiply the amplitude of the filter by band_gain[0] something like this enter image description here

now lets move onto the more complicated lines

band_gain[1] * (LPF(t, band_freq[1]) - LPF(a, band_freq[0])) means make a LPF with Cutoff band_freq[1] then subtract from it a LPF with cutoff band_freq[0] if you look at the image below thats the pink section. Then you multiply the result by `band_gain1' enter image description here

you can find the other bands in a similar fashion . Now lets add them together, something like this, just 'superposition' enter image description here

which makes our final filter look roughly like this enter image description here

I hope those pictures make sense

|improve this answer|||||
$\endgroup$
  • $\begingroup$ If this works depends highly on the kind of low pass filter used. It needs to be zero phase (so linear phase with delay compensation) and the pass band ripples have to be very small to create a proper rejection in the complemental filter. I somehow doubt that this simple design approach got the low pass filter really right. Maybe the EQ is not so "super" after all. $\endgroup$ – Jazzmaniac Mar 20 '15 at 8:29
  • $\begingroup$ I'm sorry for late comment. Thanks for great answer! $\endgroup$ – torl pees Mar 22 '15 at 11:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.