Support

If you have a problem or need to report a bug please email : support@dsprobotics.com

There are 3 sections to this support area:

DOWNLOADS: access to product manuals, support files and drivers

HELP & INFORMATION: tutorials and example files for learning or finding pre-made modules for your projects

USER FORUMS: meet with other users and exchange ideas, you can also get help and assistance here

Band splitter with ideal phase response and no latency ??

DSP related issues, mathematics, processing and techniques

Band splitter with ideal phase response and no latency ??

Postby Rocko » Sun Jun 18, 2017 1:19 pm

Hi,

I'm experimenting with a three-band splitter (crossover) for a potential multi-band compressor.

I've read this (excellent) post and the FlowStone GURU example by Martin (really great job. Thanks ;-) ):
http://flowstone.guru/downloads/multi-band-splitter-tutorial/#changelog



AFAIU, Martin has explained how to design a three band splitter which has a perfect frequency response curve (when all bands are unified) - i.e. flat.
However, there is still the issue of phase response.

Is there a way of designing a splitter which has no latency (or very small latency) and perfect phase reponse?

If not, what do the commercial companies refer to as "phase compensated crossover" ?

Rocko
Rocko
 
Posts: 160
Joined: Tue May 15, 2012 12:42 pm

Re: Band splitter with ideal phase response and no latency ?

Postby martinvicanek » Sun Jun 18, 2017 5:42 pm

Any filter will have a latency depending on the characteristic frequency and filter steepness.
Minimum phase filters have the lowest latency for a given filter specification.
Recursive filters are often minimum phase, but latency depends on frequency.
If you want the same latency for all frequencies use linear phase filters.
martinvicanek
 
Posts: 709
Joined: Sat Jun 22, 2013 8:28 pm

Re: Band splitter with ideal phase response and no latency ?

Postby Rocko » Sun Jun 18, 2017 9:17 pm

Hi,

This might be very obvious for you, but no so much for me. Could you please elaborate on this?

This is what I know. Am I totally wrong ?
For me there are two 'basic' digital filter types Recursive (IIR) and FIR.
IIR have a very short latency in the order of 1-2 samples, depending upon design.
For instance a second order IIR filter with a transfer equation of:

y[n] = a0 * x[n] + a1 * x[n-1] +a2 * x[n-2] + b1 * y[n-1] + b2 * y[n-2]

has a latency of two samples.
This however is negligible and such VST's (IIR based EQ as an example) report to host 'zero latency' (PDC).
IIR based filters are referred to as 'minimum phase'.

An FIR filter however has a latency which is as long as its buffer. Such a VST will have to report to DAW its latency (PDC) such as 64 samples, 128 samples, etc.
These are referred to as 'linear phase'.

Is this all wrong? Am I missing it?
Rocko
 
Posts: 160
Joined: Tue May 15, 2012 12:42 pm

Re: Band splitter with ideal phase response and no latency ?

Postby KG_is_back » Sun Jun 18, 2017 10:41 pm

You are not totally wrong but there are few misconceptions there. Let's make the terms well defined:
Delay - time between input coming in and output coming out. Different parts of the input may have different delay, in case of filters the delay may depend on frequency.
Phase-shift - delay multiplied by frequency. For example: phase shift 180° at 1000Hz = delay of 0.0005s. Phase shift 180° at 10Hz = delay of 0.05s
Latency - a special kind of delay that is hard-wired to a software - it is a side-effect of HOW the software is implemented, not of WHAT it is meant to do. DAWs can typically compensate for latency.

In most filters the delay is frequency dependent and is usually expressed in terms of phase, because phase is also relevant when adding signals (phase cancellation etc.). A linear phase filter is simply a filter that has constant delay across the whole frequency spectrum. A minimum-phase filter is a filter that has mathematically minimal delay at any frequency for given frequency response (aka. the EQ curve), without being able to "see into the future". NOTE: You can make a the filter to "see into the future" by implementing the software with build in latency.

The way we typically analyse filters is by feeding in an impulse - a signal with all frequencies of equal strength and phase. The filters "ring" when excited by this signal and this rigging, called impulse response, reveals their qualities. Here are two examples I will refer to later:
Image

The difference between FIR and IIR filters is in their design. FIR filters only contain feed-forward loops. That means their output only depends on finite amount of samples in the past. As a result, its filter response is finite, hence the name Finite Impulse Response Filter. They can only ring for finite time, hence to affect lower frequencies with more resolution they need longer internal delay-chains. They are typically somewhere in 1000 delay lines. Note: Most FIR filters use some mathematical tricks (Fourier transform) to reduce processing time, sometimes even trading latency for CPU speed.
On the other hand, IIR filters also contain feedback loops. This allows them to ring at any frequency, but as a result their ringing is infinitely long (and hopefully dampening over time, typically exponentially). It also makes them easier to construct - they can create elaborate frequency curves with much fewer delay-lines compared to FIR filters. Crushing majority of IIR filters have zero latency. However, they introduce frequency-dependent delay. The delay may be much bigger than 2 samples - the feedback loops can transmit information from infinitely long past.
NOTE: the response is infinite only theoretically, in reality the ringing eventually disappears into the noise or rounding errors within the hardware.

Now, as you can see in the image above, the hallmark of linear phase filter is that its impulse response is horizontally symmetric around a certain point. This should ring some bells - It is impossible to create true linear-phase filter as an IIR filter, because its impulse response would have to extend into the future - it would have to start ringing before the input even came in. Hence all linear-phase filters are implemented as FIR filters, for practical purposes. (NOTE: it is sort of semi-possible to make IIR linear phase filter, but it involves reversing the signal, cutting it up and glueing it together, but that's a topic for another day).


So... if you need your filter to be zero latency, you need to use minimum-phase filters, preferably IIR, and deal with the fact that it introduces some phase-shift in some of the frequencies. If you don't mind some latency, you can use linear-phase filter, implemented as FIR.
KG_is_back
 
Posts: 1130
Joined: Tue Oct 22, 2013 5:43 pm
Location: Slovakia

Re: Band splitter with ideal phase response and no latency ?

Postby 110 » Tue Oct 17, 2017 1:08 pm

if you aim is to

- first split audio
- then process the bands

you could build something like a linkwitz riley filter known from hardware frequency crossovers.

i.e. for two bands

- all you need to do to get a flat phase respose is to invert the phase of either band (usually the bass)

for three bands

- invert the phase of the bass and the hf band, then attach an allpass filter with the frequency of the upper crossing to the lowest band

for four bands

- reproduce like above for the upper three bands, and then you´ll have to add another allpass - this time phase inverted to the lowest band

you can extend this system to as many bands as you want, but starting witih 5 bands and more allpasses will start to form a tree structure and it is easy to lose overwiev.

as you can see i am not even able to explain it properly.

oh, and of course you have to do that per filter. i.e. if you are using cascades of 4 biquads or 4 butterworths, you have to repat that phase correction crap for every layer of 6 db/A ... it is a neverending story.

you know that in VST enviroments latency is not an issue, do you. :D
110
 
Posts: 38
Joined: Mon Jan 16, 2017 3:20 pm

Re: Band splitter with ideal phase response and no latency ?

Postby 110 » Tue Oct 17, 2017 1:26 pm

found this, hopefully better readable than my above post.

http://www.amusesmile.com/wp-content/up ... ematic.png

of course in flowstone, max, sc, csound, c++ it will not be requried to use butterworth cascades as allpasses, you have objects or classes for that which do it at once (or simply entirely different, for example using combs)

and... if you start with this tree structure from the first 2 bands on, you dont need to invert the phase.

the HPF 7000 and the LP 7000 in the picture are doing that already - they shift the phase for -90 and +90 already.
110
 
Posts: 38
Joined: Mon Jan 16, 2017 3:20 pm


Return to DSP

Who is online

Users browsing this forum: No registered users and 3 guests