Kyma Forum
  Tips & Techniques
  Phase Matching Bandpass Filters

Post New Topic  Post A Reply
profile | register | preferences | faq | search

next newest topic | next oldest topic
Author Topic:   Phase Matching Bandpass Filters
David McClain
Member
posted 23 April 2002 01:54         Edit/Delete Message   Reply w/Quote
I was playing around tonight with trying to make an N-band equalizer with higher order Butterworth filters (order = 4). It is well known that adding adjacent bandpass filters (made by cascaded low-pass and high-pass filters) suffers severe phase cancellation at the band edges.

So I sat about pondering how to compensate this phase cancellation. One idea is to use some kind of all-pass filter. Another is to insert simple delays in series with each bandpass filter before summing them.

I found experimentally that I could produce a 5 band EQ with pretty uniform (+/- 1 dB) using bandpass filters tuned as follows:

1) 100-200 Hz + 66 samples delay @ 48 KHz sample rate
2) 200-400 Hz + 29 samples delay
3) 400-800 Hz + 12 samples delay
4) 800-1.6K Hz + 4 samples delay
5) 1.6K-3.2K Hz + 0 samples delay

I have never seen this technique discussed, but perhaps some of you know about it. I wonder just how conventional 1/3rd octave graphic EQ's work? These must be high order filters in order to represent the individual passbands without appreciable leakage into adjacent bands. Hence phase cancellation at band edges would be expected to be quite severe without some kind of phase compensation networks. Does anybody know more about this?

- DM

I refined the experiment to produce a stereo 6-band 1.6-octave wide set of bandpass filters spanning 20Hz - 20KHz, and then applied some EQ by adjusting their relative gains. The filters are all cascaded 4th order Kyma lowpass and highpass filters (Butterworth 4th order). The bandpasses are:

1. 20 Hz - 63 Hz + 0.71 ms delay
2. 63 Hz - 200 Hz + 0.5 ms delay
3. 200 Hz - 630 Hz + 0.3 ms delay
4. 630 Hz - 2 KHz + 0.08 ms delay
5. 2 KHz - 6.3 KHz + 0.04 ms delay
6. 6.3 KHz - 20 KHz + 0 delay

This produces pretty good phase matching across the entire spectrum, +/- 1 dB approx. Overall, the resulting phase ramp shows a fairly linear decline with increasing log-frequency at a rate of about 250 degrees/octave. That means we have an exponential decline of phase with frequency, so this is not a constant delay as you would find with an FIR filter bank. Hence this kind of filterbank is dispersive in time as a function of frequency -- the phase shift is frequency dependent in a nonlinear manner.

Initial listening impressions are that it performs almost as well as the Kyma FIR filterbank, but not quite... I guess the phase degradation produced by this filterbank causes a loss of signal coherency so that the sound is ever so slightly muddied. The FIR filterbank sounds just slightly more crisp than the IIR bank I built here.

I have to wonder about conventional 1/3 octave GEQ's, therefore. It would seem that these would have to be dispersive as well and hence take some of the edge off of one's sound.

- DM

Hmmm.... I just ran some computations in both Mathematica and in my SigLab with a simulation of this same filterbank. Both of these tools fail to show the extreme phase cancellation effects I observe with the Kyma filters on the spectrum analyzer. At most they show a ripple of about 3.5 dB p-p. And the predictions of these tools is that the best performance is had with no delays for phase matching. How can this be?

Yet, both of these tools predict the same behavior for individual Butterworth filters that I see experimentally with Kyma. So I'm pretty sure my Butterworth models are accurate. Are we seeing the effects of finite resolution arithmetic in the DSP's? My math models are using floating point single or double precision.

puzzled...

- DM

[This message has been edited by David McClain (edited 23 April 2002).]

IP: Logged

pete
Member
posted 23 April 2002 04:46         Edit/Delete Message   Reply w/Quote
Hi David
I don’t know if this is related but with most vocoders (not Kyma I think) the Bands are summed such that every other band is inverted. i.e. Bands 1,3,5,7,9 summed and inverted and added to bands 2,4,6,8 etc. This means that the phase of the output bears no relation to the input but it doesn’t seem to matter.

IP: Logged

David McClain
Member
posted 23 April 2002 04:49         Edit/Delete Message   Reply w/Quote
Hi Pete,

Why do you think they would do that kind of alternating inversions? Is it intended to help with this phase cancellation at the band edges?

- DM

[Boy! Now I'm really confused here... I just reran my experiment on the spectrum analyzer and it shows with zero delays exactly what my math model predict -- no phase cancellation and a hump at 6.3 KHz about 2 dB higher than the rest when all gains are set to 0 dB attenuation.

When I ran the experiments before, there was some serious phase cancellation effects. I wonder if it is time to reboot my Capy?]

[This message has been edited by David McClain (edited 23 April 2002).]

IP: Logged

David McClain
Member
posted 23 April 2002 15:46         Edit/Delete Message   Reply w/Quote
I tried the alternating inversions Pete described. That can help a little tiny bit -- turning serious phase cancellations into phase peaks. But it still isn't correct. I was able to obtain the phase cancellations to a very serious degree using any filter orders other than 1 and 4.

I did find that stagger tuning the 4-pole filters helps a great deal in smoothing the filter ripples across the passband. Using LPF frequencies at 0.9 x the nominal, and the next band HPF using 1.1 x the nominal (in other words, spreading the cutoffs between successive bandpass filters) helps.

But it suddenly occured to me that the real way to remove any phase matching discrepancies is to split each bandpass IIR filter into two segments. Bandpass the input signal in the first section, buffer up the results, time reverse the buffered results, pass them through an identical second filter, buffer the results, pass along the time reversed (now temporally restored order) buffer to the summing junction. This completely flattens any filter phase response. Using overlap-add with windowing, as in the rest of the Kyma FFT Sounds, will remove artifacts in time that appear at buffer block boundaries.

While this sounds like a lot of work to equal the phase performance of an FIR filter using IIR filtering, it can pay off handsomely at very low frequencies. At these low frequencies an FIR filter would have to be many thousands of taps in length in order to provide decent filtering. An IIR filter can handle this situation with ease, using no more filter poles than needed for a given rolloff rate. Splitting a 4th order filter into two 2-order sections is easy.

The drawback here is that a 4-pole Butterworth is NOT composed of two identical 2-pole sections. In fact a 4-pole Butterworth is 2 cascaded 2-pole sections with stagger tuning so that the cutoff frequency shows a -3 dB amplitude response. You can't split a 4-pole Butterworth filter into two identical sections. [...at least not with real-valued arithmetic...]

So the end result is that you have to expand the cutoff somewhat between both identical Butterworth N/2-order filters so that they will very nearly provide -3 dB response at the chosen cutoff frequency.

- DM

[To save complexity, the outputs of the time reversed and 2nd-filtered streams can be added directly and the final sum buffered up and time reversed, to restore temporal order...]

[NOTE: there will still be phase discontinuities between adjacent bands. If the rolloff is sufficiently fast, we can ignore interactions between widely separated bands and focus on the adjacent band discontinuities. Since the 2-pass IIR filtering produces a constant phase shift, we can accommodate these discontinuities with a simple 1-pole all-pass filter to provide constant phase shift to each filterbank stream. The result *should* be quite close to what can be achieved with FIR filtering.... maybe I should try this before promoting the idea any further...]

[This message has been edited by David McClain (edited 23 April 2002).]

IP: Logged

pete
Member
posted 25 April 2002 16:24         Edit/Delete Message   Reply w/Quote
Hi David
I don’t know if your interested but this link takes you to a page that has circuit diags for the ETI Vocoder. You may notice that each filer band is made up of two second order slightly detuned filters that are then mixed alternately in opposite phases. I might be wrong, but it sounds similar to what you are describing here.
http://omega.tellus.vallentuna.se/anders/vocoder.html

Then click on the ETIVocoder link to get the tifs.

Pete

IP: Logged

David McClain
Member
posted 25 April 2002 19:34         Edit/Delete Message   Reply w/Quote
Thanks, Pete! I'm downloading now and I'll study it after dinner this evening. A vocoder would have similar requirements to what I'm after here.

I did some more thinking about my time reversal solution from the other night... This will indeed work, but like any convolution there will be edge effects. And since IIR stands for "infinite impulse response" the amount of guard buffer space needed on both ends of each buffer will depend on the particular filter in use, your numerical precision, and the sample rate in use.

Mathematically, this is almost equivalent to multiplying a filter by its complex conjugate. That operation leaves the amplitude affected by the square of one filter's amplitude response, and the phases completely cancel out. But since we can't perform this operation in real time, there will be an overall phase shift to the final results, and that phase shift should be equal to the total phase shift through one of the filters, from DC to Nyquist. That's okay -- it simply means we have an arbitrary phase offset which is not perceptible to the ears.

I still haven't programmed this on Kyma just yet...

- DM

IP: Logged

David McClain
Member
posted 28 April 2002 07:34         Edit/Delete Message   Reply w/Quote
I've got it!!

I just figured out how a conventional 31-band graphic equalizer works! They don't play games trying to overcome phase mismatch between parallel high-order BPF's at all! Instead, I'm wlling to bet that they use a serial connection of peaking equalizer filters.

These are all very simple little 2-pole filters, and you can tune the Q's at will. But they are generally restricted to no more than about 15 dB of peak/notch, which corresponds nicely with the typical capabilities of graphic equalizers.

Essentially, I am willing to bet that these units are implemented just like the typical "para-graphic" equalizers found in many audio plug-ins. I did a quick test here with my SigLab and I found that the phase mismatch problem is not very troublesome with these filters. You can tune any one filter to any particular frequency and Q with modest (+/- 15 dB) peak/notch and they coexist quite well together.

I will program up a paragraphic equalizer for Kyma today and make it available. Kyma ought to be able to perform this, followed by multiband compression, reverb, stereo spreading, and harmonic generation. We should have a really nice "mastering" unit in Kyma -- one that operates quite readily in real-time, and with quite good numerical precision.

Now I have to give some thought about how to make Kyma perform decent dithering...

- DM

[This message has been edited by David McClain (edited 28 April 2002).]

IP: Logged

All times are CT (US)

next newest topic | next oldest topic

Administrative Options: Close Topic | Archive/Move | Delete Topic
Post New Topic  Post A Reply

Contact Us | Symbolic Sound Home

This forum is provided solely for the support and edification of the customers of Symbolic Sound Corporation.


Ultimate Bulletin Board 5.45c