DSP.fir.OverlapAdd
Implements a finite impulse response (FIR) filter using the overlap-add algorithm. The overlap add algorithm (see Oppenheim and Schafer, Digital Signal Processing, 1975) enables FIR filters to operate on sequences of arbitrary length when the sequences are available in a series of uniform consecutive, contiguous blocks. The output is produced incrementally with the filter() method, filtering one block at a time. The algorithm is capable of filtering data from continuous, real-time streams or streams from very large archive files. However, it is suitable for filtering data segments of any length (including short, extracted event segments). The size of the sequential data blocks must be uniform (i.e. the same from one invocation of filter() to the next). The block size is specified in the first constructor, which uses it and the filter kernel size to calculate the size of the forward and inverse FFT algorithms required to implement the convolution operation. The DFT object may be large if the chosen processing block size is large. If more than one OverlapAdd instance is to be used in an application, it may be worthwhile to share fft resources among instances, which is possible provided the kernel sizes of the FIR filters are identical. For this case, a second constructor is provided that constructs a "slave" instance containing a reference to the DFT used in another "master" OverlapAdd instance. Slave instances use the DFT resources of their associated master instances. Care should be taken to keep master and slave instances in the same thread. The OverlapAdd class keeps state information from one invocation of filter() to the next on consecutive blocks of the data stream. This state information allows the algorithm to perform continuous convolutions on streams of arbitrary length, including real-time streams. If and when the end of the stream is reached, the remaining state information may be dumped using the flush() method. An example of the application of the OverlapAdd class is available in the Interpolator class.