# Easy Filter with FFT and Convolution

I'am pretty new to this topic so i dont have much experience with DSP. I want to filter(highpass) a WAVE file, i have already programmed the FFT, and now want to filter the FFT vector via convolution (which is a multiplication in frequency domain ?!).

1) Can anyone give me an easy equation for such a filter?

2) If i have an equation i compute it, also Fourier-Transform it, an multiply it with my FFT vector and inverse Transform it an i have applied the filter?!

• Google "overlap add", that's the algorithm you want to use. Highpass it typically much easier done with an IIR filter than with an FFT. – Hilmar Jan 25 '14 at 14:25
• dspguide.com/ch18.htm – sellibitze Jan 25 '14 at 21:25
• IF you don't already know the impulse response you want your signal convolved with then "filter design" is the topic you should research. try "windowed sinc" or use a tool like Gnu/Octave which comes with various nice functions for designing these things. Apart from the "windowed since" approach most of the others are kind of a black art and many people just rely on tools to compute the coefficients for them. – sellibitze Jan 25 '14 at 21:30

Actually, yes. As Hilmar pointed out, it might be cheaper to use an ordinary filter, but that depends on the circumstances.

If you have two signals $A$ and $B$ with Fourier transform being $\mathcal{F}$, their convolution $A\ast B$ will be

\begin{equation} A\ast B = \tilde{\mathcal{F}}(\mathcal{F}(A)\cdot\mathcal{F}(B)) \end{equation}

With $\tilde{\mathcal{F}}$ being the inverse transform. This is the well known "convolution lemma". There is not much of a theory to see. In the Fourier domain, you just replace convolution by (point-wise) multiplication. Your question already contained the answer, to me it just appears that you were not sure about the details.

• Well thank you =) But can you give me an equation to campute the signal to convolute with? – ShuftY Jan 25 '14 at 15:10
• I didn't notice you are asking for that. The signal you mean depends on the situation. Eg. if you want to have a highpass, you should set the "low" Fourier coefficients (The ones with low indices and their symmetry partners with high indices) to zero. You would then multiply with a "box" function. The signal you would be convolving with then is the inverse transform of that box function. – user7358 Jan 25 '14 at 15:17
• Okay just to get it right. Lets say i want to boost all above 100Hz. I got 44100 samplepoints. I make a new vector with vector to and  to = 0 an the rest is set to 1. This is my "Box" function. Then i inverse Transform this vector and then multiply it with my Fouriertransformed vector of samplingpoints and denn inverse transform it? – ShuftY Jan 25 '14 at 15:53
• No. You would multiply the transformed of the signal you want to filter with that box function. You could also convolve the signal with the inverse transform of the box function instead. – user7358 Jan 25 '14 at 15:54
• Note that you have to use an FFT that is longer than the sum of the length of your samples and the length of the impulse response of your filter. Just zeroing bins can cause ringing artifacts. See: dsp.stackexchange.com/questions/6220/… If you have more than 1 second of data, you will have to use overlap-add or overlap save fast convolution to combine your 1 second frames. – hotpaw2 Jan 25 '14 at 17:19