# filter with arbitrary and variable rolloff

Started by May 15, 2006
```Martin Eisenberg <martin.eisenberg@udo.edu> writes:
>
> But I've thought of a viable scheme in the meantime: Starting from
> the observation that the magnitude of (z+1)^n has asymptotic slope
> -6*n dB/oct for integral n, I noticed that the same holds if we let n
> be nonintegral and develop into a power series in z to get an
> implementable system. Cascaded with a low-frequency correction filter
> this gives nice preliminary results. I'll follow up here once I have
> it all worked out.

Hi Martin,

So you start from an equation with rational exponent and want
to derive an approximation with a power series to end up with an
expression that contains just integral exponents.  Is that correct?
What kind of power series?  Like a taylor series?
I am curious to see how you do that.

gr.
Anton

```
```Anton wrote:

> So you start from an equation with rational exponent and want
> to derive an approximation with a power series to end up with an
> expression that contains just integral exponents.  Is that
> correct? What kind of power series?  Like a taylor series?
> I am curious to see how you do that.

That could be asking any of several things. As I said, I do it with
Maple but the Taylor series is easy to find by hand. However, it
turns out that a lowpass with early rolloff needs poles which would
necessitate factoring into second-order sections on the fly in an
application. Next, we want unit DC gain so the highpass zero can't be
right at z = 1. So the series about z = 0 becomes

(z-q)^n
= sum_k z^k (n)_k (-q)^(n-k) / k!
= (-q)^n sum_k (-z)^k (n)_k / (q^k k!),

where q is close to 1, we take n to be a nonnegative real, and (n)_k
is a falling factorial. Truncating the series gives an FIR with slope
of 6*n dB/oct potentially over several octaves and flatter response
at extreme frequencies -- more extreme the higher the order.
Normalizing for unit response at DC, or indeed any other frequency,
makes the complex factor (-q)^n go away.

I've found that the sum converges quickest for n in [1,2]; we can get
the desired overall rolloff from cascaded IIRs. It remains to get the
filter to have a reasonably sharp knee and to see how all this fits
in a dynamic setting.

Martin

--
Research is what I'm doing when I don't know what I'm doing.
--Wernher von Braun
```
```Anton, what kind of slope control stream did you have in mind
regarding its source/shape and time scale of change?

Martin

--
Quidquid latine scriptum sit, altum viditur.
```
```Martin Eisenberg <martin.eisenberg@udo.edu> writes:
> Anton, what kind of slope control stream did you have in mind
> regarding its source/shape and time scale of change?

Hi Martin,

A rather slow rate. If audio runs at 44100, I guess between 500-1000
is absolutely sufficient for my purpose.  I could live with much
less, but I want to make a plugin for SuperCollider (and maybe for
puredata..) and in that case the control rate is 44100/64 = 689.

I would really like to help and I have some time for it.
If you can share any working efford (matlab, C or
just further explanation in english), I would like to try to find a
way to make it work in a realtime situation.  If I manage to
make a SuperCollider plugin or something like that, of course
all credits for the real work go to you.

I know that you basically allready explained how it works in
your previous post, but I don't really get it.
You say that you can get a FIR from the truncated power series
that you found, and later you said the desired overall rolloff can
be achieved by cascading IIRs. If I understand you correctly here
you want to use the FIR for slopes between 6-12 db and use cascaded
IIRs if a steeper slope is required.
Would that work to use an IIR _highpass_ with 6db slope and the
FIR as lowpass with 9db slope to achieve 3db?
Otherwise I wonder how to cover the range between 0-6 db.

thanks a lot,
Anton
```
```Hi everybody,

I have a kind of working version.
I reread the thread and tried to play around with r b-j's
suggestion to shift real zeros between real poles.
I have an order 6 filter using that approach, which can
achieve variable rolloff from 0-6db per octave.
It is not perfect, as I just placed the poles by hand, so
I am sure it would be possible to make this better.
(Maybe some optimization/error minimization method?)
Anyway if somebody is interested I can mail the code
(octave or C).  I have to clean the code and add the possiblities
to achieve higher slopes by cascading additional 1st order
filters.  When I have done that I will put it in the internet
anyway.

Martin, I am very interested to see your approach, because as
I said what I have is far from perfect, but still nice
to have it working.

Thanks to all of you for the great suggestions,
Anton
```
```Hello again!

Anton wrote:

> I reread the thread and tried to play around with r b-j's
> suggestion to shift real zeros between real poles.
> I have an order 6 filter using that approach, which can
> achieve variable rolloff from 0-6db per octave.

That might just have been a better use of your time than anything I
could have delegated (not much anyway) because at the core of my
method are an order-50 FIR and two biquads. The FIR could probably be
shortened threefold without losing much accuracy -- the limit here is
my ability to fit a function to q in (z-q)^n for fixed corner
frequency as n varies, which gets easier the longer the truncated
series.

I didn't want to respond before demonstrating to myself that the
method really works, including sweeping; in the meantime I've hacked
up a simple VST plugin without regard to efficiency that takes 3% or
4% CPU, as displayed by FruityLoops on an Athlon 800, between sweeps.
The plugin lets you try out different sweep lengths, and 150 to 200
samples give clean quick transitions. (With an eye to your previous
reply, note that this switch time is a different quantity from the
control rate.)

> It is not perfect, as I just placed the poles by hand, so
> I am sure it would be possible to make this better.

Well, the series approach has its own imperfections. One is its
seeming rigidity: there are three empirical functions involved that
I'm not sure could be derived automatically for other design
parameters than I used. Another is the computational cost at least of
my present implementation. If that doesn't deter you I'll put the
code online as soon as it's properly commented.

> Anyway if somebody is interested I can mail the code (octave or C).

Yes, please throw it my way!

From your earlier post:

> You say that you can get a FIR from the truncated power series
> that you found, and later you said the desired overall rolloff can
> be achieved by cascading IIRs. If I understand you correctly here
> you want to use the FIR for slopes between 6-12 db and use cascaded
> IIRs if a steeper slope is required.
> Would that work to use an IIR _highpass_ with 6db slope and the
> FIR as lowpass with 9db slope to achieve 3db?

Almost -- the FIR is highpass and a fixed lowpass biquad gives the
range 0 to -6 dB/oct. On top of that there's the chain of -6 dB/oct
stages and another biquad to sharpen the FIR knee (that should really
take the chain into account but doesn't at the moment).

Martin

--
Yes, I'm reinventing the wheel. Others' have sharp ridges.
```