Hi,
You can try to use IIR filter, it's easy to use in c.
because you only want the range of 20 to 400hz, you must calculate twice, low pass and high pass.
while impliment low pass filter, you can use
Yn=A0*Xn+B1*Yn-1,
where
Yn: current filtered value,
Xn: current sampled value,
Yn-1: previous filtered value,
and the A0 and B1 can be set by
A0=1-x
B1=x,
you can set x to 0.95, the larger the x, the lower the cut-off frequency.
for high pass filter, please search by yourself.