The topic of zeroing frequency bins before IFFT has been discussed here : Why is it a bad idea to filter by zeroing out FFT bins? It was very helpful to understand why it is a bad idea.

What do you think about, instead of zeroing, multiplying by a window (in the frequency domain!) which is 0 at the centre and smoothly goes to 1 outside of a small interval ?

t = linspace(0, 1, 256, endpoint=False)
x = sin(2 * pi * 3 * t) + cos(2 * pi * 100 * t)
X = fft(x)
window = 1 - scipy.hamming(128)
X[64:192] *= window
y = ifft(X)

Then it would not be a "rectangular" zeroing, but a "smoothed zeroing" in the frequency domain. What do you think about such a filter ?


The Fourier transform of your window-shaped frequency response is its impulse response. Evaluate the transform of your window function, look at its length above your desired noise floor, adjust the filter response as required to make the impulse length appropriately short, add zero-padding of this length to your original signal before the FFT, and you approach classic convolution filtering.

The added zero-padding is required to remove or reduce artifacts due to circular convolution using FFT/IFFT fast convolution. Knowing the length of the impulse response is required to know how much zero padding is needed. Smoother (with wider transition bands) frequency responses tend to produce shorter impulse responses. And using smooth window shaped functions tends to imply smoother wider transition bands (although there are many other methods that may do better).

| improve this answer | |
  • $\begingroup$ thanks! so this method (zeroing frequency bins BUT with a window in the freq domain) is close to the classic convolution filtering ? $\endgroup$ – Basj Nov 19 '13 at 17:56
  • $\begingroup$ When used with the "right" amount of zero-padding. If the frequency domain window is too narrow, the amount of zero-padding required could be huge. $\endgroup$ – hotpaw2 Nov 19 '13 at 18:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.