# How does one make a Zero Latency, Linear Phase, or Natural Phase filter?

Looking at FabFilter's ProQ3 plug-in, they have an option at the bottom of the window to switch between Zero Latency and Linear Phase modes (and I think a Natural Phase option too).

I'm familiar with BiQuad filters, I'm pretty confident I understand them quite well... but I don't know how FabFilter achieve these different latency and phase modes!

If anyone has any info or references about how one can go about implementing these different types of filters, It'd be much appreciated!

• is your application real-time or not? because if it's real-time, the only zero-phase filter is a simple wire or constant gain. no filtering. but if your application is processing one file of data to another file, then the filter can look ahead to "future" samples and a simulation of a zero-phase filter (that actually filters) is possible. – robert bristow-johnson Apr 15 '20 at 22:16

To add to hotpaw's answer, Linear Phase filters can only be implemented with all zero structures (FIR Filters) but they can be approximated with IIR filters such as the Lerner Filter (https://ieeexplore.ieee.org/document/1444798) and other equiripple phase approaches. In order to achieve linear phase, the coefficients of the filter must be either symmetric and assymetric as given in the examples further below.

Zero Latency filters usually refer to Zero-phase digital filtering which is strictly a post processing technique by processing the data through the filter in both forward and reverse directions such that the phase in each direction is cancelled. The filter itself has a transfer function that is the square root of the desired since the signal is filtered twice. For more information on zero-phase digital filtering, see the filtfilt command available in Matlab/Octave and Python scipy.signal. This is not actually a filter with zero processing delay, but given an input and output data set, the two will be perfectly aligned in time as if the filter had no delay if you later compared the data set once processed (hence post-processing). It will take real time to get the first sample out of the filter that can be placed on a plot with t=0 with the input data. This is very useful for analysis in applications where you would otherwise need to compensate for the filter delay, so worth mentioning here.

With regards to Linear Phase Filters, The following are examples that demonstrate "symmetric" and "asymmetric" taps that is a requirement to implement a linear phase filter.

Linear Phase Type 1 FIR (Symmetric, N odd):

[ 1 2 3 2 1 ]

Linear Phase Type 2 FIR (Symmetric, N even):

[ 1 2 3 3 2 1 ]

Linear Phase Type 3 FIR (Asymmetric, N odd):

[ 1 2 0 -2 -1 ]

Linear Phase Type 4 FIR (asymmetric, N even):

[ 1 2 3 -3 -2 -1 ]

Note importantly how the center bin MUST be zero in order to achieve the required asymmetry for the Type 3. The structures above for each type restrict the zeros of the filter to always be on $$z = -1$$ for Type 2, and $$z = \pm 1$$ for Type 3 and $$z=0$$ for Type 4 restricting which applications can be used for each type.

The following plot further demonstrates this and shows the purpose of having the FIR linear phase "Types":

There is no such thing as a true real-time "zero latency" filter, due to the speed of light being finite, etc. Thus, there will always be some latency from input to output, unless the processing is being done off-line.

Biquad and other IIR filters can be minimum latency, but that means the latency is different for different portions of the audio frequency spectrum. Usually a higher latency for lower frequencies.

Linear phase filters (except in the degenerate case) have a latency greater than the minimum latency. This is because the latency of higher frequencies has to be increased to balance with the delay with lower frequencies, in terms of group delay.

Biquad filters are usually generated from mathematical models of pole-zero placements in a complex transfer function. FIR filters are often generated by iterative or linear optimization methods, or by a windowed impulse response of some ideal filter template.