**Type :** Simple 1 pole LP and HP filter

**References :** Posted by scoofy[AT]inf[DOT]elte[DOT]hu

**Notes :**

Slope: 6dB/Oct

Reference: www.dspguide.com

**Code :**

Process loop (lowpass):

out = a0*in - b1*tmp;

tmp = out;

Simple HP version: subtract lowpass output from the input (has strange behaviour towards nyquist):

out = a0*in - b1*tmp;

tmp = out;

hp = in-out;

Coefficient calculation:

x = exp(-2.0*pi*freq/samplerate);

a0 = 1.0-x;

b1 = -x;

**Comments**

__from__ : nobody[AT]nowhere[DOT]com

__comment__ : Of course, you don't need tmp.
Process loop (lowpass):
out = a0*in + b1*out;

__from__ : dj_rejo[AT]hotmail[DOT]com

__comment__ : Why don't you just say:
Process loop (lowpass):
out = a0*in + b1*tmp;
tmp = out;
Simple HP version: subtract lowpass output from the input (has strange behaviour towards nyquist):
out = a0*in + b1*tmp;
tmp = out;
hp = in-out;
Coefficient calculation:
x = exp(-2.0*pi*freq/samplerate);
a0 = 1.0-x;
b1 = x;

__from__ : scoofy[AT]inf[DOT]elte[DOT]hu

__comment__ : There's a tradition among digital filter designers that the pole coefficients have a negative sign. Of course the other one is also valid, and sometimes these notations are mixed up.
If you're worried about the extra negation operation, then you could say
b1 = -x;
a0 = 1.0+b1;
so that there's no additional operation overhead.
-- peter schoffhauzer

__from__ : scoofy[AT]inf[DOT]elte[DOT]hu

__comment__ : Indeed.

__from__ : bob[AT]yahoob[DOT]com

__comment__ : Or...
out += a0 * (in - out);
:)

__from__ : djdelaflav[AT]gmail[DOT]com

__comment__ : can you please send me a few pictures to show me how you hooked up the mixer on the back...