-1
$\begingroup$

This question already has an answer here:

Am trying to remove noise for certain frequency bands by attenuating freqeuncy bins in the FFT array. However this results in artifacts to be formed, where there are clicking sounds in between each frame. Im already using a frame length of 1024 with 50% overlapping hamming window at 48000 sampling rate. How do I remove the artifacts while still being able to suppress the noise?

$\endgroup$

marked as duplicate by hotpaw2, MBaz, lennon310, Stanley Pawlukiewicz, jojek May 14 at 12:58

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • $\begingroup$ filtering and spectrograms are different although not incompatible operations. $\endgroup$ – Stanley Pawlukiewicz Oct 9 '18 at 4:25
0
$\begingroup$

You do not want to do the filtering in the frequency domain with essentially a brick wall filter. A perfect rectangular brick wall filter needs infinite support in the time domain. In practice, this isn't possible so your filter coefficients ( the sinc function ) will be truncated. This is fine unless you need these segments to fit back together (audio processing, etc) because at the transitions it will not be well behaved. This is because zeroing a bin / or attenuating a bin is essentially adding a sinusoid with opposite phase and magnitude into your signal. The fft only picks up exactly periodic frequencies in your signal, all other signals will be 'spread' across the spectrum so in attenuating the exactly periodic bins you are adding sinusoids with opposite phase and magnitude to your signal and these are all adding up with the other signals in your signal to be ill behaved (not perfectly continuous) at the frame boundaries.

$\endgroup$
  • $\begingroup$ what method would you suggest to remove the noise then? $\endgroup$ – 12johnny Oct 10 '18 at 2:34
  • $\begingroup$ Filter in the time domain $\endgroup$ – spet Oct 10 '18 at 14:36
  • $\begingroup$ would it be the same if you multiply the fft array with the transfer function of a filter in the frequency domain? Ive tried using a butter filter function in Matlab, filtering in the time domain. The artifacts are reduced, however, it seems to apply a window on the filtered speech signal, resulting in the voice to sound robotic, due to some harmonics being removed $\endgroup$ – 12johnny Oct 11 '18 at 1:09
  • $\begingroup$ I'll point you to this thread which might clear up some questions: stackoverflow.com/questions/34581355/… $\endgroup$ – spet Oct 11 '18 at 18:11
0
$\begingroup$

If your FFT is not zero-padded, then your frequency domain filtering will result in a circular convolution, where the end of your filter's impulse response will corrupt the beginning of each FFT/IFFT window of data, and likely produce artifacts at each frame boundary.

If you zero-pad your FFT by the length of the impulse response of your filter, then you can use overlap-add or overlap-save fast convolution to concatenate the tail of the impulse response of each filtered frame into subsequent windows where they belong (instead of a circular corruption).

Note that just zero-ing FFT bins is the same as a brick-wall rectangular filter which has an infinite impulse response, thus will usually corrupt your data, even with a lot of added zero padding. So a more reasonable filter kernel (with a finite length impulse response) is required to do FFT filtering.

$\endgroup$

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