Error introduced by smoothing filter at the end of a processing block I'm running analysis on a multichannel audio signal and due to the size have decided to process it in blocks (my computer doesn't have enough memory to process it in one go). Some of the data produced by the analysis needs to be smoothed.
The smoothing function means that each sample was an average of the samples contained within a window and the window being centered around sample n. At the edges this obviously isn't possible so the at the start of the signal the window remains static until such point that sample n is in the centre of the window, and then the window can slide along the signal - this also means at the end of the signal there will come a point where the window can't move along and will remain static. So essentially there will be a number of identical values at the start, and then at the end of the signal. This happens at the end of each block (as it can't continuously slide in the same way it would if processing the whole signal in one chunk). I know in order avoid discontinuties at the start of each block an overlap add/save method can be used, but I'm not sure how to fix this problem that occurs at the end of a block.
Just to explain further how the smoothing window moves along the signal, if we have a window length of 5 samples, the first 3 averaged values would be identical, at the 3rd sample, our current time step would now be located at the centre of our window, when moving to sample 4 the window would also slide along by one, keeping our current time step at the centre of the window, and now producing a different value. Once we get to the end of our signal the window will remain static for the last 3 samples, again producing identical values. This is fine when processing something in one big block, but produces discontinuties when trying to process in multiple blocks.
A moving average filter is a FIR filter of equal weights 1/N and a FIR filter is a degeneralization of a IIR filter.
In a non realtime implementation, it is functionally equivalent if you consider the filter to be N samples delay, N samples lookahead or N1 samples delay and N2 = N-N1 samples look ahead. Pick whatever time philosophy makes sense in your head and minimize tedious indexing.
Matlabs filter() and filtic() functions provide the means for carrying the  result from block to block for IIR filtering. Sadly only single channel support.
If you use something like:
conv2(ones(5,1), 1, X, ‘full’);
You will get an output vector that is larger than the input vector. Those surplus samples are exactly what you need to add to the initial samples of the next block.