In real-time audio applications, the input audio is typically available in blocks of finite size (equivalent in length to the input buffer). Operating on an entire signal is never practical or even possible in such a scenario. A more feasible approach is to process each individual block of samples. This concept is known as block processing. Block processing methods for FIR filtering use the convolution equation:
Here, the input sequence x(n) is of length L and can be thought of as a newly filled input buffer ready for processing:
x = [x0, x1, …, xL-1]
The FIR filter h(m) is of length M + 1, and contains carefully designed coefficients stored in either RAM or ROM memory. The filters impulse response is a vector of coefficients:
h = [h0, h1, …, hM]
The output sequence y(n) is of length L+M, and is the result of convolving the input buffer with the filter coefficients:
y = [y0, y1, …, hL+M-1]
It is useful to visualize the relative sizes of the filter vector, the input buffer sample sequence, and the output:
Figure 1: Relative sizes of impulse response, input sequence, and output sequence after convolution [1].
It can be seen that the output block y (after FIR filtering via the convolution equation) is M samples longer than the input buffer x. When the output buffer is constrained to be the same size as the input buffer, as is often the case, the extra M samples cannot be immediately sent out. A convenient way to still filter and retain no loss of information is to save the tail M samples of each block and simply add them to the first M samples of the next processed block. This is known as the overlap-add block convolution method [1]. The process is pictured below:
Figure 2: Overlap-Add Method for block processing convolution [1].
Many filtering methods are not feasible due to the characteristics of audio I/O hardware which utilize finite buffer sizes. Block processing methods, and in particular the Overlap-Add method are extremely useful in such situations. Real-time constraints must always be taken into account and place limits on the type of audio processing that can be accomplished.
More Information
References
[1] Orfanidis, S., Introduction to Signal Processing, Rutgers University, NJ, 2010.
[2] Lerch, A., An introduction to Audio Content Analysis: Applications in Signal Processing and Music Informatics, Wiley, NJ, 2012.