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: 179
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.
User avatar
martinvicanek
 
Posts: 1081
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: 179
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: 1198
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

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

Postby steph_tsf » Wed Mar 04, 2020 3:19 pm

Stanley P. Lipshitz, John Vanderkooy.
"A family of linear-phase crossover networks of high slope derived by time delay".
Presented at the 69th AES Convention 1981 May 12-15 Los Angeles.
http://www.aes.org/e-lib/browse.cfm?elib=11953
Digital audio was not reigning yet in 1981. Pure, clean delays remained unfeasible. Such communication remained ignored for years.

Please try the following .fsm :

Bandsplitter - Lipshitz-Vanderkooy - 8 bands (full) (650 pix).jpg
Bandsplitter - Lipshitz-Vanderkooy - 8 bands (full) (650 pix).jpg (73.96 KiB) Viewed 2789 times

Try it for yourself. All 8 outputs are mostly phase-synchronous in the transition bands. The summed output is rigorously phase-linear. A square-wave in, leads to a reconstructed rigorously exact square-wave out. Quite unbelievable, isn't?

Latency is not zero. I think that a zero latency is physically impossible.
Latency depends mainly on the 1st crossover frequency, here 42 Hz, obliging a 356 samples latency.
Latency also depends on the 2nd, 3rd and 4th crossover frequency, here 96 Hz, 219 Hz and 503 Hz, obliging a 156 + 68 + 29 samples latency.
Consequently, the total latency is 609 samples, which is approx 14 millisecond when Fs = 44,100 Hz.

In case you want latency to drop below 10 millisecond, you need to set the 1st crossover frequency to a higher frequency, say 60 Hz instead of 42 Hz.

The Lipshitz-Vanderkooy band-splitter I am suggesting is consuming less CPU% than a 4th-order Linkwitz-Riley band-splitter that's incapable of delivering a phase-linear summed output. In case you want to insert a phase correction before a Linkwitz-Riley band-splitter, you will require a quite long FIR filter that's consuming a lot of CPU%, and anyway, for such long FIR filter to reasonably flatten the phase response between 50 Hz to 16 kHz, such long FIR filter will introduce at least 20 millisecond of latency.

Clearly, the Lipshitz-Vanderkooy band-splitter I've designed, is the best you can find (because it is transient perfect by nature), it is the most efficient (because of not requiring a phase correction), and it is exhibiting the shortest latency in the context of phase-linear band-splitters.

In case you dig into Stanley P. Lipshitz & John Vanderkooy "A family of linear-phase crossover networks of high slope derived by time delay", presented at the 69th AES Convention 1981 May 12-15 Los Angeles, you will discover that lowpass filtering by a double 2nd-order Butterworth, is not what Stanley P. Lipshitz & John Vanderkooy advocated for. Like everybody, they were in search of the maximal highpass monotonic slope that was attainable with a subtractive approach. They managed to find the 3rd, 4th, 5th etc. Butterworth lowpass filtering solution, that are all leading to a pseudo 3rd-order highpass slope, qualified by P. Lipshitz & John Vanderkooy as "high slope derived from time delay".

Unfortunately P. Lipshitz & John Vanderkooy dropped (or did not find) the "slightly oversized delay, double 2nd-order Butterworth" solution that I am applying here, that's leading to a pseudo 4th-order highpass slope. It should be named SOCDS-DB2. Slightly Over Compensated Delay Subtractive - Double Butterwoth 2nd-order.

John Kreskovsky paper dating back from 2002 got largely under-valuated. Possibly because few people had access to Digital Signal Processing. I am talking about John Kreskovsky paper entitled “A New High Slope, Linear Phase Crossover Using the Subtractive Delayed Approach”, Dec. 2002. If I remember, John Kreskovsky was the first to popularize the SOCDS-DB2 approach.

The slightly over-compensated delay subtracting scheme that's applied on a double 2nd-order Butterworth lowpass filter is probably the wisest choice, best balanced choice. And, as cherry on the pie, it is requiring approx. the same computational power than the ubiquitous 4th-order Linkwitz-Riley.
Unfortunately, below -35 dB, the SOCDS-DB2 attenuation curves appear to be non-monotonic. A Linkwitz-Riley crossover is slightly better on such aspect (because it is perfectly monotonic, but nobody expects perfection).
Unfortunately, in the transition band, the lowpass and highpass are not perfectly synchronous. A Linkwitz-Riley crossover is slightly better on such aspect (because it is perfectly phase-synchronous, but nobody expects perfection).
John Kreskovsky was not 100% clear about this. It didn't helped the SOCDS-DB2 approach to become understood, and mainstream. Meanwhile, the SOCDS-DB2 approach is transient-perfect, which means that a square-wave in, gets out as square-wave. And there, the Linkwitz-Riley crossover is disastrous. We are not talking about the Linkwitz-Riley being "slightly better". The Linkwitz-Riley crossover is a plain disaster on such aspect, contrary to the SOCDS-DB2 that's perfect on such aspect.

Please let me know if the SOCDS-DB2 band-splitter I've designed, helps improving the subjective quality of multi-band dynamics processors (expanders, compressors, limiters). And speakers crossovers also.

Have a nice day
steph_tsf
 
Posts: 251
Joined: Sun Aug 15, 2010 10:26 pm

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

Postby steph_tsf » Mon Mar 16, 2020 8:59 pm

This is just to tell that I managed to finalize a kind of "Band splitter with ideal phase" and some "minimum" unavoidable latency. Costing almost the same CPU% than a 4th-order Linkwitz-Riley band splitter that's a disaster speaking of global phase. See my previous post.
steph_tsf
 
Posts: 251
Joined: Sun Aug 15, 2010 10:26 pm

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

Postby martinvicanek » Tue Mar 17, 2020 7:18 am

That's actually very clever! Although the bands are not quite linear phase when analyzed separately, their sum certainly is! And indeed, the design is quite CPU efficient. (Of course you can still optimize the actual implementation.) Moreover, latency is very low, given the low first crossover frequency. Well done, Steph!

One suggestion: I think you can improve the behavior in the lower dB range if you tune the crossover frequencies for integer delays so they perfectly match with the filters' group delays.
User avatar
martinvicanek
 
Posts: 1081
Joined: Sat Jun 22, 2013 8:28 pm

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

Postby steph_tsf » Tue Mar 17, 2020 10:03 am

martinvicanek wrote:One suggestion: I think you can improve the behavior in the lower dB range if you tune the crossover frequencies for integer delays so they perfectly match with the filters' group delays.
It depends what you mean by "improving", Martin. On one hand, speaking of a double 2nd-order Butterwoth lowpass, In case you adjust Fc for the low frequency group delay to tend to the fixed integer delay, you'll get a pseudo 1st-order or 2nd-order highpass slope in the transition band, not even the Lipshitz-Vanderkooy pseudo 3rd-order that's only attainable with a 3rd, 4th, 5th-order single Butterworth lowpass. On the other hand, speaking of a double 2nd-order Butterwoth lowpass, in case you increase Fc for the low frequency group delay to become significantly smaller than the fixed integer delay, you may achieve some weird, very steep highpass slope in the transition band, but doing so you will a) exacerbate the non-monotonic shape of the highpass amplitude curve (you will incur a rebound at -20 dB instead of -35 dB), and b) you will deteriorate the band-to-band phase synchronicity in the transition band. Trust me, Martin. The -35 dB non-monotonic highpass rebound is kind of clue, that the optimum balance is actually reached. The lowpass and highpass pseudo-slopes appear to be 4th-order in the transition band, and the band-to-band phase synchronicity remains very good in the transition band. You better promise no better. In case you promise better, people will complain about you and about the crossover structure, not delivering the promise. Journalists and Golden Ear experts will observe the non-monotonic highpass behavior, they will observe the slight phase non-synchronicity, they will graph the amplitude curves on a 100 dB scale, and consequently tell will tell the uneducated public, that a 4th-order Linkwitz-Riley structure should still be preferred. They will say that the ear is not phase-sensitive. They will not say that for most applications, a global linear phase and transient-perfect behavior, with minimal latency and minimal CPU% requirement, is preferred, by far, whatever the -35 dB highpass rebound, whatever the 35 degree phase mismatch in the transition band. Journalists and Golden Ear experts will try escaping the discussion, telling as conclusion that in case you are fool enough to pursue a global linear phase and transient-perfect behavior goal, you shall rely on some mythical FIR filter, frequency domain filtering, or time machine, that's currently under development, of course very expensive.

Have a nice day
steph_tsf
 
Posts: 251
Joined: Sun Aug 15, 2010 10:26 pm

Next

Return to DSP

Who is online

Users browsing this forum: No registered users and 8 guests