Kyma Forum
  Kyma Sound Exchange
  1-Pole Filters Explained

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

next newest topic | next oldest topic
Author Topic:   1-Pole Filters Explained
David McClain
Member
posted 24 September 2001 04:10         Edit/Delete Message   Reply w/Quote
The soundfile I just uploaded called "1poleFilters.kym" contains a bunch of example Sounds for 1-pole filters.

1-Pole Filters are pretty simple filters, but they are also useful musically in many situations. Unlike the Kyma Low-pass and High-pass filters, these have roll-offs of 6 dB/octave.

But more than that they turn out to be pretty special filters in their own right...

By fortuitous mathematical properties, these filters, unlike just about every other kind of IIR filter, have the property that the corresponding High-pass is simply equal to the original signal minus the Low-pass with the same cutoff frequency. Put another way, a low-pass mixed equally with a high-pass of the same cutoff frequency equals the original signal exactly. But there's even more... (in a moment!)

First of all the transfer function of a lowpass 1-pole filter is given as

H(z) = (1-b)/2 * (1 - 1/z)/(1 - b/z)

where b is a real number and z is the complex variable over the unit circle in the Z-plane. The single pole is located on the real axis at b, and -1 <= b <= 1. This filter is normalized to unity gain at DC, and it has zero gain at halfSampleRate.

The way we compute the 1-pole LPF in Kyma is as follows:

First write out the recurrence relation for this digital filter, recognizing that 1/z represents a delay of 1 sample. Hence,

y[n] = (1-b)/2*(x[n] + x[n-1]) + b*y[n-1]

So in Kyma, we form the average of the current input sample and the one just prior using a mixer with gain 0.5 and a 1-sample delay. The mixer output is then fed to a delay with feedback whose input scaling is (1-b) and whose feedback scaling is b.

To compute b just use the formula:

b = (1 - Sin[2 Pi fc / fs])/Cos[2 Pi fc / fs]

where fs = system sample rate, fc = filter cutoff frequency (-3 dB point).

To get a high-pass filter of this same variety, you have two options: either subtract the LPF signal from the original signal, or else write a new filter equation and implement that. They give identical results either way. But if you want to do the HPF by subtraction you must realize that the output of the feedback delay element in Kyma is actually the LPF output delayed by 1 sample. So you must also delay the input by 1 sample before subtracting to get a HPF.

Alternatively, the transfer function for a 1-pole HPF is:

H(z) = (a - 1)/2*(1 + 1/z)/(1 + a/z)

where this filter has unity gain at halfSampleRate, and zero gain at DC. The pole lies on the real axis at a, and a is simply the negative of b from above for the same cutoff frequency. In other words,

a = (Sin[2 Pi fc / fs] - 1)/Cos[2 Pi fc / fs]

[... in other words, for the same cutoff frequency, the HPF and the LPF have a real pole at the same position on the real axis. The HPF has one zero at +1 (DC) and the LPF has one zero at -1 (halfSampleRate). The sum of the HPF and the LPF is unity -- try it and see... Most other IIR filters have complicated phase cancellation that prevents this simple condition.]

The recurrence relation for the HPF is

y[n] = (a-1)/2*(x[n] - x[n-1]) - a*y[n-1]

So in Kyma, we mix the incoming signal with a negated delayed sample and then feed to a 1-sample delay with feedback. The input scaling of that delay line is (a-1) and the feedback scaling is -a.

Okay, now here is the really neat part about these little filters....

Suppose you wanted to create a broad bandpass filter by cascading a lowpass with the high cutoff frequency and a highpass with the low cutoff frequency. You can certainly do that and it works just fine, but the midband gain will probably not be unity gain. But you can always fix it up with some gain.

But the neat thing is that to a very close approximation (typically 0.1% or less) you can achieve the same result by simply subtracting two LPF's!!!

So what? Well if you wanted to create a filterbank, say 6 filters spanning octaves 250Hz - 500 Hz, 500 Hz - 1 KHz, 1-2 KHz, 2-4 KHz, 4-8 KHz, 8-16 KHz, then doing this in stereo with cascaded filter blocks (LPF cascaded with HPF) requires almost a dozen or more DSP's in Capybara.

But if you do this same thing by means of subtraction of adjacent band LPF's then it only requires about 4 DSP's! Quite a big savings and I doubt anyone has such a Golden Ear that they could ever tell the difference.

As a matter of fact, to get the equivalent performance to within 0.2%, including output gain across the passband, you need to scale the LPF difference by some factor:

Band LPF Diff Scale Error
250-500 2.00 0.03%
500-1K 2.00 0.1%
1K-2K 1.99 0.07%
2K-4K 1.97 0.2%
4K-8K 1.87 0.2%
8K-16K 1.50 0.0

But now look... the sum of successive LPF differences equals the final LPF, right? See, (LPF2 - LPF1) + (LPF3 - LPF2) + (LPF4 - LPF3) == LFP4. So without any scaling at all, a filter bank made of successive filter differences sums to the original signal. Hence to achieve the same result with cascaded LPF/HPF filters, you need to attenuate the output of the individual BPF's by just those factors shown in the table above.

But with such close correspondence between cascaded LPF/HPF and LPF differences, why ever bother doing the cascade? It takes more DSP power and requires attenuation to perform properly. The LPF differences are simpler to use and require less DSP horsepower.

Now the downside... these octave band filters are not really octave band in the usual sense. For BPF filters the bandwidth is generally stated as the frequency span between the -3 dB points on either side of the band center. Even though our LPF's and HPF's were designed according to -3 dB cutoff frequencies, the combinations used to get BPF behavior end up having much broader character. For example, the 500Hz - 1KHz filter actually has a bandwidth spanning from about 280 Hz to 1.8 KHz at the -3 dB levels.

Oh well...

- DM

[This message has been edited by David McClain (edited 24 September 2001).]

IP: Logged

David McClain
Member
posted 24 September 2001 23:57         Edit/Delete Message   Reply w/Quote
In fact, one can show that for bandpass filters defined by cutoff frequencies of fc and 2*fc (octave width), then the difference of two LPF's is identical in form to cascaded LPF and HPF. They differ only by a scale factor given by:

cascBPF/diffBFP = 2 Cos[Pi fc/fs]^2

where fs = sample rate.

Hence, in the limit of fc = 0 they differ exactly by a factor of 2, and when fc = fs/6 (e.g., 8 KHz lower band edge, 8-16 KHz BPF, for fs = 48 KHz) they differ by a factor of exactly 1.5.

- DM

IP: Logged

David McClain
Member
posted 26 September 2001 00:12         Edit/Delete Message   Reply w/Quote
Ah well...

I don't know why, but for the past year I was laboring under the impression that all Kyma LPF and HPF had to be even order.

I just tried them on my spectrum analyzer and in fact you can use odd orders too. In fact an order=1 filter is identical to those described above.

- DM

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