FIR Filter
FIR Filter (Finite impulse response filter) is a type of filter used on signal processing. It works by taking the sum of last Nth samples multiplied by a value, called FIR taps. It's finite because if you pass a FIR filter in an impulse response, the impulse will fade out after passing the N filter taps. That's easy to notice since the FIR filter never uses itself as feed unlike the IIR Filter.
On the SNES, the FIR filter is used together Echo feedback to determine how echo will reverb back to the echo buffer, with total 8 taps which a 8-bit 1.7 fixed point values.
The S-DSP echo has a buffer which the samples are stored and works like a FIFO: after 8*EDL milliseconds, the samples are played back multiplied by the echo volume. Once these samples have been played, they are inserted back to the buffer but before multiplied by the echo feedback and by the FIR filter to determine how much it will attenuate, allowing to the echo reverb to the buffer with some effects. This however implies that on the SNES, if the echo feedback and the DC gain of the FIR filter is large enough, the samples will stay indefinitely on the buffer and will likely result into signal overflow.
Mathematical Definition
The FIR filter can be defined in the following mathematical formula:
For the current output sample Y[n], take the sum of previous N samples from source (including current), multiplied by the FIR coefficient, which in other words is:
The SNES has eight FIR taps, which limits N to 8:
However, the samples are processed from the oldest to the newest sample. That means for the first FIR tap is applied to the oldest sample while the 8th tap is applied to the newest sample:
Which in other words, it yields to the equivalent pseudo-code:
y[n] = FIR[0] * x[n - 7] + FIR[1] * x[n - 6] + FIR[2] * x[n - 5] + FIR[3] * x[n - 4] + FIR[4] * x[n - 3] + FIR[5] * x[n - 2] + FIR[6] * x[n - 1] + FIR[7] * x[n - 0];
Where FIR is a array containing the eight taps.