Forums

Low-pass filter algorithm

Started by Cristiano August 5, 2004
I'm trying to write (in C++) a low-pass filter for audio frequencies.

I used this:
 H[i]= sin(2*PI*FC * (i-M/2)) / (i-M/2) *
    * 0.54 - 0.46*cos(2*PI*i/M)
where M= 100 points and FC is the cutoff frequency (0 to 0.5), but I guess I
don't know how to use it because the filtered music is really bad.

I have the real and the imaginary part of the transformed input signal.
Could anybody tell me how to convolve the input signal and the filter kernel
H[]?

Thanks
Cristiano


In article <D3wQc.76974$OR2.4340761@news3.tin.it>,
Cristiano <cristiano.pi@NSquipo.it> wrote:
>I'm trying to write (in C++) a low-pass filter for audio frequencies.
This may help: http://unicorn.us.com/alex/buttercrit.html -A
axlq wrote:
> In article <D3wQc.76974$OR2.4340761@news3.tin.it>, > Cristiano <cristiano.pi@NSquipo.it> wrote: >> I'm trying to write (in C++) a low-pass filter for audio frequencies. > > This may help: > > http://unicorn.us.com/alex/buttercrit.html
In that page I only seen the filter design, but as I said, I need to know how to convolve the input signal and the filter kernel. Cristiano
Cristiano wrote:
> In that page I only seen the filter design, but as I said, I need to know > how to convolve the input signal and the filter kernel.
N y(k) = sum x(n-k)*h(n) n=0 For various implementations, go to dspguru.com and read the FIR FAQ. -- Jim Thomas Principal Applications Engineer Bittware, Inc jthomas@bittware.com http://www.bittware.com (703) 779-7770 Better to ask a stupid question than to make a stupid mistake.
Jim Thomas wrote:
> N > y(k) = sum x(n-k)*h(n) > n=0 >
Oops! I reversed the n and k. Try this instead: N y(k) = sum x(k-n)*h(n) n=0 -- Jim Thomas Principal Applications Engineer Bittware, Inc jthomas@bittware.com http://www.bittware.com (703) 779-7770 Better to ask a stupid question than to make a stupid mistake.
Jim Thomas wrote:
> N > y(k) = sum x(k-n)*h(n) > n=0
It works! Thank you. Cristiano