# filtering difference b/w freq and time domain

When you want to get the specific frequency (ex. around 1000Hz), you might

1. take FFT, remain the frequency you want, and reduce the power of the other frequencies you do not. ex.) if fs=16khz and fftsize=1024, remain the power of bin64 and reduce all other bins
2. design band pass filtering (Butterworth or others) to pass 1000Hz (with stop/transition band also)

In short, 1 is in frequency domain, and 2 is in time domain.

Then my question is: are these two methods same? (I think yes in terms of "extracting 1000Hz signal"(Both can do)) If yes, how would you utilize these two methods? If not, how different are these (and how would you utilize)? I would appreciate your answers. Thank you.

are these two methods same?

no

If not, how different are these (and how would you utilize)?

First of all you can't be "extracting 1000Hz signal" . Sine waves are an interesting theoretical concept but they don't exist in practice: in order for a sine wave to be an actual sine wave it needs to be infinitely long which is impossible in the real world.

So best you can do is "determine the energy in a finite band around 1kHz". The exact shape of this band depends heavily on the specific needs and requirements of your application. For example: the more narrow the band is, the longer the time domain signal needs to be.

In this regard the bandpass method is typically preferable, since you can directly control the shape of the band to your requirements through the band pass filter. The FFT method also applies a bandpass filter, but it's an implicit filter that's difficult to control it's not a great bandpass filter to star with.

FFT is the better choice in terms of efficiency if you have to calculate the energy over a LOT of frequency bands and you can live with the band-pass shape of the FFT.

• Thank you for the answer. I meant "to determine the energy in a finite band around 1kHz" as you said, not the one at the very specific frequency. In this case filtering in time/freq domain are similar? ex. when fs=16kHz and fftsize=1024, the resolution will be fs/fftsize=15.625[Hz], which means you can take a (implicit) filter to pass 1000±15.625[Hz] ? In this case I think it would be the same to take a filter in the time domain (passing 1000-15.625Hz to 1000+15.625Hz) – Ted Feb 5 at 7:40
• @Ted: No, it's not the same. Bandpass filters always have a "shape" and it's not rectangular. A filter that implements: "1000-15.625Hz to 1000+15.625Hz" would have to have a gain of 1 at 1015.625Hz and a gain of 0 at 1015.62500001 Hz. That doesn't exist. There are always some transitions bands, pass band ripple, stop band attenuation, side lobes etc. The exact shape of the bandpass makes a big difference. FFTs also implement an implicit bandpass which has a $sin(x)/x$ shape. That's just not a very good bandpass. – Hilmar Feb 6 at 13:51

Multiplication in the frequency domain is the equivalent of convolution (digital filtering) in the time domain - one of the fundamental properties of the Fourier transform.

Using an FFT in practice to filter requires stitching together overlapping chunks and a large delay if in real-time. However in the frequency domain you can immplement brick-wall filters as easy as any, which is much more costly in time-domain.

The algorithms for fft convolution include "overlap-add" and "overlap-save", these are useful search terms on the matter.

The Python scipy.signal library has an implementation of convolve that automatically selects direct filtering or fft convolution based on an estimate of which will be faster.