I'm trying to smooth a signal in order to reduce white noise as a result of changes in amplitude across sequential frames of an audio signal.

I've been investigating using a moving average or boxcar filter to help minimise the issue. In my investigations it would appear normal implementations of a boxcar filter only smooth the contents of a single frame/buffer of audio.

Can a boxcar filter be implemented in order to smooth the transition across frames as well? or is there a better approach?

  • $\begingroup$ The problem of the frames of an audio signal being processed with different parameters is usually dealt with by crossfading between subsequent frames. This seems to be the best way to solve it. First introducing the artifacts and afterwards removing them with a filter seems suboptimal as the filter will not only remove the artifacts but also affect the desired signal. Crossfading is simple: just let the blocks overlap by a certain length (typically in the order of 10 ms) and fade the first one out and the second one in. To do so, e.g., half von-Hann windows can be used. (see also WOLA.) $\endgroup$ – applesoup Oct 16 '17 at 10:57

A boxcar filter is a FIR filter, suppose your frame has length N and your boxcar has a length of M, you will have M+N-1 filtered values.There are 2 properties, time invariance and superposition that you can use.

Assume your boxcar has length 5, and examine 2 sequential frames,data is $x$

$$ \begin{align}xxxxxxxxxxxxxxxxxxxx&0000 \quad \text{Frame 1 with 4 zeros post appended} \\ 0000&xxxxxxxxxxxxxxxxxxxxxxx \quad \text{Frame 2, 4 zeros pre appended} \end{align} $$

If we could time align the 2 frames, and added them together, we would have continuity across the frames. This is a consequence of superposition.

If we run the boxcar over each frame,including the zeros $$ \begin{align}yyyyyyyyyyyyyyyyyyyyy&yyyy \quad \text{Filtered Frame 1 } \\ yyyy&yyyyyyyyyyyyyyyyyyyyy \quad \text{Filtered Frame 2 } \end{align} $$

Adding the 2 time aligned filtered frames, is the same as filtering a gapless buffer. This is superposion, and time invariance of the filter.

| improve this answer | |

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.