Filtering by FIR

 Part 2

At different places in this blog you can find information on how to setup your sound system in such way that it behaves as an overall All pass filter.
Using conventional IIR filters or even plain old analogue filters if the components don't have a delay offset that needs to be dealt with.

Now: long, long time ago when I got my first DSP (somewhere beginning '90) I had to do system setup just by ear. Measurement systems did exist (Meyer SIM) but where simply not affordable. In those days  I ran components full range and set delay by ear. It is simple. Just use common sense to get the ball park and tweak till audio nirvana.
Next you set the X-over as dictated by the text books and there goes your audio nirvana out of the window.
Quickly we did realise you need to find a way of phase alignment too, to get your filtering correct.
All rather common these days, but that sense of audio nirvana as in above never really happened in these filtered systems.
And phase by itself is inaudible, so all the big names say...

Stubborn as we are we kept on searching, using weak filter slopes (6 dB) and using coaxial sources. Till at some point that "new thing" FIR filtering entered our industry in the form of these brick wall filters in the Dolby Lake processor (2004).
Now that was eye opening, most certainly after we did realise that you could also develop your own filters and not use those dreaded brick wall filters because they sound horrible. Unfortunately my business was way to small to get the access to load custom FIR in a Dolby Lake. So the the quest for a platform with custom FIR started.
 
But first let's explain how FIR filtering works. 
In fact it is a very simple operation once you are in the digital domain.  Imagine a chunk of sampled data over time, maybe from some temperature sensor. Now if you would like to know the average over a certain period you could add say 10 samples and divide by 10. Or in other words multiply those 10 samples by 0,1 and add the results to the total averaging output value. And keep on doing this over and over again.This is called a moving average filter and in fact is a very crude high cut FIR filter.
The number of 'taps' in the above filter is 10 and the filter 'kernel' is an array with 10 (the number of taps) positions with a value each of 0,1.

You could imagine those filter kernels to be more elaborate, right? 
Now with the same mathematics as has been used with the measuring setup described in an other post you can derive those filter kernels: Fourier Transform!

Just use a iFFT to calculate the Impulse Response from a desired Frequency Response. 
The process of using an Impulse Response as a filter kernel is also called Convolution, which you will have heard of as being used in reverbs, cabinet emulations etc.
 
    The ImpulseResponse of your desired FreqResponse will be used as the filter kernel!

Rephase
Now how can we do that without getting familiar with Matlab (like I had to do 20 years ago) 
Well: thank Thomas Drugeon for REphase.  It's a very nifty little program, around for some 10 years now, to help you develop your filterkernels. For free! (but do donate some if you like it!!)
 
 
 
So to round it up: FIR filtering is about using a Impulse Response derived from your desired Frequency Response. That by itself doesn't mean all FIR filters are linear phase.  A lot of people in our industry use FIR as a synonym for lin. phase (meaning not having any impact on the phase) and start talking about 'latency' of these filters. This concept is both limited and wrong.
 
Let me explain in simple terms.
To make a lin.phase filter you start of by taking the IR of a conventional filter as in described above. It will have its associated phase response. Next make a copy, reverse all coefficients and glue this to the original IR. The filter kernel is now totally symmetric around the middle coefficient and as such will not have any impact on the phase (uhmm, well just believe me, there's heavy math behind this)
But it will also be twice as long as would be needed for a non-linear phase filter.
So it takes some time for the signal to pass through such a filter. In fact half the length of the filter kernel (as expressed in number of taps).
This will not get any faster if processors would run faster so the expression "latency" as we use when we are talking about using a PC and audio processing is not correct. 
 
Let's call it filter processing delay and do understand this is depended only on both the sample freq. and the number of taps used for the filter. 
 
Which is something we would have to discuss too, but you can find the background at different places. For now do understand that both sample freq. and the number of available taps determine the resolution of your FIR: the lower the freq. and the higher the Q of the filters: the more taps you will need. 
 
In a real world live situation there is a limit to the time difference between the moment a sound is produced and the moment that sound comes out of the speakers. (from there on it's acoustic path length differences, but we do understand this intuitively, right?) So you have to determine what for your situation is acceptable.

Examples?
Maybe the sound coming from your mainsystem shouldn't arrive after the backline/drumkit? In a club situation that is, where indeed the levels of backline/ acoustic drums are in the same order as the levels of your PA. So say something like 3 mtrs (or 10mS) in this situation?.
But what about that little, processed wedge next to that grand piano? (I ended up putting it on a little riser to overcome the timing issues).
 
 
...Maybe best to keep on using your ears!