I'm working on a wav audio file using MATLAB. What i would like to do is:

  • load a wav file and divide it into frames of the same dimension
  • filter these frames (with a different filter for each different frame) using, for instance, iirnotch
  • put all the filtered frames together again without having discontinuities between them

I already wrote a script using the overlap-and-add technique using a "Hann" window and it works quite well but between the different frames I'm not able to avoid the discontinuities so that when I listen to the wav file (made by adding these frames together again) I hear an annoying glitch disturbance.

Anyone know how to avoid this problem?

  • $\begingroup$ Can you post some code or exemplary plots of frames to be overlapped and which are causing you some problems? Smart way of averaging could be solution. How long is your window? Please provide more data. $\endgroup$
    – jojeck
    Commented Jun 13, 2014 at 16:59
  • $\begingroup$ Are you doing FFT filtering or time-domain filtering on the frames? $\endgroup$
    – endolith
    Commented Jun 13, 2014 at 20:52
  • $\begingroup$ I'm using iirnotch on the time-domain frames $\endgroup$
    – user10202
    Commented Jun 16, 2014 at 10:28
  • $\begingroup$ Ok, so time-domain IIR filtering $\endgroup$
    – endolith
    Commented Jun 16, 2014 at 13:49

1 Answer 1


add technique using ann "hann" window and it works quite well but between the different frames I'm not able to avoid the discontinuities

That's probably because the filtering has tails that extend beyond the frame. The window is supposed to taper the signal to 0 at the edges, but after filtering it is no longer 0 at the edges, which introduces discontinuities.

Are you zero-padding before filtering to keep these response tails?

I believe you need to apply a sqrt(window) before filtering ("analysis window"), and then another sqrt(window) after filtering ("synthesis window"), so the combination is a normal window, and the tails are tapered to 0, and then overlap the windows by the appropriate amount so that they sum back to unity. Maybe also need to zero-pad before filtering so that the filtering tails don't wrap around, if you're doing FFT filtering, for instance. More information here: http://www.dsprelated.com/dspbooks/sasp/Weighted_Overlap_Add.html

(If you're doing positive-phase time-domain filtering, it might be sufficient to use a regular window, zero-pad before filtering, and then instead of windowing again, just keep the entire zero-pad region with the tail in it when you sum back together, but I haven't tried it so I'm not sure.)

  • $\begingroup$ Hi, first of all: thanks a lot. Then: I tried to zero-padding and to apply a squared Hanning window before filtering and a squared Hanning window after filtering. The sound improves a lot but I have two problems: -lower in volume (but still present) discontinuities between frames; -very slow computational time (maybe is because I zero-pad too much?). Any other tips? $\endgroup$
    – user10202
    Commented Jun 16, 2014 at 10:23
  • $\begingroup$ 1. You can zero-pad to a power of 2 size to improve computation time. 2. It should be sqrt(Hann), not Hann^2. 3. Even with Hann^2 window applied after filtering you should not have discontinuities, though. You need to plot the signal at each step of your process and see where the discontinuities are coming from. $\endgroup$
    – endolith
    Commented Jun 16, 2014 at 14:11
  • 1
    $\begingroup$ The problem was successfully solved using a power of 2 zero-padding, a sqrt(hann) window before filtering and a sqrt(hann) window after filtering. Thank you very much endolith! $\endgroup$
    – user10202
    Commented Jun 17, 2014 at 8:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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