[linux-audio-dev] Equalizer(was Still blabla...) and more

New Message Reply About this list Date view Thread view Subject view Author view Other groups

Subject: [linux-audio-dev] Equalizer(was Still blabla...) and more
From: Alexander Ehlert (alexander.ehlert_AT_uni-tuebingen.de)
Date: Thu Dec 20 2001 - 18:25:37 EET


Hi,

lets swap back to interesting stuff. This "Still..." thread sucks.
So I just added some documentation to glame about "How to make funny
realtime networks". We recently had lots of fun at a party doing
some Mickey Mouse Effect on the voice or creating a network that
loops a sample input. So you can do sort of voice drum loops, I think
we already had that a the Linuxtag. In the meantime though I have
less problems with dropouts. Using my SBAwe32 for sampling and my
SBLive for output, I can use framesizes of 64. And that with
the multithreaded approach of glame. So that's not too bad.

> Just curious, but could somebody explain *how* delay lines can be used
> implement EQ? I have a strong maths background, but no DSP experience if
> that helps.

I would suggest to just use a few convolution filters, that are
logarithmically distributed over the frequency range. Just setup a FIR/IIR
filter for every desired frequency. IIR should be really fast compared
to FFT/FIR, but it's hard to get those filters stable over a long time
period. IIR is so fast because you only need small kernels for
convolution, IIR uses feedback. With FIR and the same quality you need a
larger kernel. If you have really large kernels, you have to use FFT
convolution anyway to be fast. ok, back to the delay lines Paul mentioned.
I haven't implemented that myself, but for eq with delay lines you
probably use IIR.

For example a biquad IIR looks like that:

y[n] = x[n]*a0 + x[n-1]*a1 + x[n-2]*a2 + b1*y[n-1] + b2*y[n-2]

If you want a 2 pole bandpass you would setup a0,a1,a2,b1,b2 like this:

omega = 2.0*M_PI*center;
alpha = sin(omega)*sinh(log(2.0)/2.0*bandwidth*omega/sin(omega));
a0 = alpha;
a1 = 0.0;
a2 = -alpha;
b1 = 2.0 * cos(omega);
b2 = alpha - 1.0;
gain = 1.0 + alpha;
a0/=gain
a1/=gain
...
center is the normalized frequency of the bandpass:
center = center_frequency/sample_frequency

bandwidth is given in octaves between the -3dB attenuation levels
of the passband

Have a look back at the formula, you see that we need y[n-1], y[n-2].
That would be your delay line, y[n] contains your output sample.
Now you can aplly gain on that frequency band and sum up all your bands.
That should be way faster than FFT. Using FFT your frequency bands
are distributed linear over the frequency range. That is untypical
for equalizers anyway, as they always use a logarithmic scale. Which
is obvious, because musical harmonies are perceived on a logarithmic
scale, f.i. one octave up corresponds to a doubling in frequency.

Cheers, Alex

-- 

Work consists of whatever a body is obliged to do. Play consists of whatever a body is not obliged to do. -- Mark Twain


New Message Reply About this list Date view Thread view Subject view Author view Other groups

This archive was generated by hypermail 2b28 : Thu Dec 20 2001 - 18:13:48 EET