# Optimizing Two Parallel IIR Filter Sweeps

Got an audio related question here; So I have two IIR low pass filters that work in parallel to do a filter sweep. Basically:

filtered_sample = filterSweepA(xn) + filterSweepB(xn);

End result: it sounds beautiful! However, now I want to optimize it. I was thinking about combining the two IIR filters into one so I'd only have to call filterSweep only once but I'm pretty sure you can't do that because of the recursive properties...

I think I understand that FIR filters would be the way to go but I've searched the internets and I've seen nothing about FIR filter sweeps.

• Is this possible/just difficult to do?
• If this can be implemented how would I be doing this?

I don't really know how to figure out FIR filter coefficients so I guess that would be the place to start...

FYI I am controlling the start, stop filter frequency cutoffs and the sweep time (usually around 1.5 seconds).

• what do you mean by a "filter sweep"? i know what a filter is and i know what a frequency-swept sinusoid is. do you mean a time-variant filter with resonant frequency sweeping? Oct 11, 2016 at 2:17
• Sorry! Filter Sweep means sweeping the cutoff frequency and resonance
– yun
Oct 11, 2016 at 2:33

Two (linear, time invariant) filters in parallel, $H_1(z)$ and $H_2(z)$, are equivalent to a single filter $H(z) = H_1(z) + H_2(z)$ (i.e. the sum of both transfer functions).

You don't give any information on how those filters are represented. Normally, they are represented in terms of the recursive ($a_k$) and non-recursive ($b_k$) coefficients (see Wikipedia for reference).

Now, if you are going to add both transfer functions, then you need to find the common denominator (which is the product of two polynomials, one from each filter), and more cumbersome yet is to find the new numerator polynomial coefficients.

If you are doing this automatically (since you adjust your filters periodically), I suggest you keep your algorithm as is.

Executing an IIR filter is not very CPU intensive since the order of the filters is normally not greater than 10 or so.

Note: if the filters were FIR, then you simply add the filter coefficients (there are no recursive coefficients (and no division of polynomials) to worry about). But FIR filters are normally much more CPU intensive than comparable IIR.

• It is as you said, I'm using two linear and time-invariant filters in parallel. I've been running the algorithm as a sum of both filter functions. I did not know FIR filters were more CPU intensive than IIR filters so maybe I'll have to just keep what I have. thanks!
– yun
Oct 11, 2016 at 11:58

okay, after reading down to the bottom line, i think i can conclude that you do mean a time-variant linear filter with resonant (you said "cutoff") frequency swept from a starting frequency to a terminal frequency in some specified time.

first thing, look up lattice filter design.

the bottom structure is IIR Lattice (the top is FIR lattice, not what you are looking for). if you choose N=2 (then just connect where the "..." are) and KN = K2. you will find that K1 solely controls the resonant frequency. K2 is affected by the resonant frequency, but you could leave it constant and sweep the resonant frequency by just changing K1.