You can have my dsp filter code for free.

It's a 18dB lowpass resonant filter and it sounds awesome.

input and output are signed 16-bit int and CUTOFF and RESONANCE are 8-bit unsigned int.

Uses only 132 CPU cycles.

// 18dB 3pole lowpass DCF with resonance. The MX-filter

coefficient=CUTOFF^0xFF;

#define M(MX, MX1, MX2) \

asm volatile ( \

"clr r26 \n\t"\

"mulsu %B1, %A2 \n\t"\

"movw %A0, r0 \n\t"\

"mul %A1, %A2 \n\t"\

"add %A0, r1 \n\t"\

"adc %B0, r26 \n\t"\

"clr r1 \n\t"\

: \

"=&r" (MX) \

: \

"a" (MX1), \

"a" (MX2) \

:\

"r26"\

)

M(MX1, M0, coefficient);

M(MX2, M1, CUTOFF);

M0=MX1+MX2;

M(MX1, M1, coefficient);

M(MX2, M2, CUTOFF);

M1=MX1+MX2;

M(MX1, M2, coefficient);

M(MX2, M3, CUTOFF);

M2=MX1+MX2;

M(MX1, M3, coefficient);

M(MX2, M4, CUTOFF);

M3=MX1+MX2;

M(MX1, M4, coefficient);

M(MX2, M5, CUTOFF);

M4=MX1+MX2;

M(MX1, M5, coefficient);

M(MX2, M6, CUTOFF);

M5=MX1+MX2;

M(MX1, M0, RESONANCE);

M6 = input-MX1;

output=M0;

code]