1
$\begingroup$

I am modeling an analog filter with digital software and have reduced the model to a 4th order FIR filter in discrete space with transfer function

$$ H(z) = \frac{b_0 + b_1 z^{-1} + b_2 z^{-2} + b_3 z^{-3} + b_4 z^{-4}}{1 + a_1 z^{-1} + a_2 z^{-2} + a_3 z^{-3} + a_4 z^{-4}} $$

It happens to be unstable, but I have noticed that most analog "musical" LP filters distort non-linearly when in this realm of high resonance rather than blow up to infinity (of course). Is it possible to simulate this by adding a nonlinear element to the IIR block diagram?

Clipping with $y[n] = \operatorname{clip}(x[n] + \ldots)$ creates a periodic [-1, -1, 1, 1, ...] in the output signal, so is there another way I can prevent numerical blowup?

$\endgroup$
  • 1
    $\begingroup$ I doubt that this unstable filter will be useful in practice. I would go back one step and try to understand why the filter is unstable. If it is supposed to model a (stable) analog filter, it should also be stable. If you added more information about the analog filter and about the way you came up with the digital version, we would be able to help a bit better. $\endgroup$ – Matt L. Oct 27 '16 at 12:31
  • $\begingroup$ Perhaps what I'm doing is unusual. I'm trying to model filter feedback in transistor and diode filters used in synthesizers (e.g. the Moog ladder). You can control the cutoff frequency and resonance (negative feedback) with knobs, which in turn set the analog transfer coefficients, and it is possible to reach a state which I believe is unstable, since the output distorts on the analog device. I'm not exactly trying to model this nonlinearity precisely, but I'd like to know where it would show up in the block diagram of the digital filter to prevent blowups. $\endgroup$ – Vortico Oct 27 '16 at 12:51
  • $\begingroup$ Due to your comment, I decided to look back at my derivation of the analog -> digital part and noticed that I normalized the gain of the digital filter so that $\lim_{s\to 0} H(s) = 1$. This pushes the resonance peak above 0dB, which causes blowups. I think you're right, because in the real analog filter, the peak is fixed at around 0dB, and the low shelf is actually attenuated as I turn up the resonance knob rather than fixed. $\endgroup$ – Vortico Oct 27 '16 at 12:57
  • 2
    $\begingroup$ The Moog ladder (and other ladder filters) relies strongly on internal nonlinearities for the sound it produces. Especially in case of high resonance, the nonlinearity in the feedback path guarantees stability and allows the filter to drive into self-oscillation. It does not make much sense to use linear analog stability analysis on this kind of filter. $\endgroup$ – Jazzmaniac Oct 27 '16 at 13:37
  • $\begingroup$ @Vortico, modeling the Moog filter is not trivial. Do you rely on any resources for the model? If so, can you point to any references? If you attempt to model the filter entirely on your own, It's possible that your approach is not suitable. $\endgroup$ – Jazzmaniac Oct 27 '16 at 13:39
3
$\begingroup$

You won't be able to avoid the instability with a linear model. With your current discrete model, the filter will blow up at a certain resonance setting. Using a better filter topology or higher precision will allow you to go a bit farther, but it will blow up.

Preventing that would require a saturating nonlinearity in the feedback path. That path is hidden in your implementation. To access it, you need to go back to the 4-section model without feedback and add the nonlinearity when you add the feedback path. But then you won't be able to simplify the filter to a fourth order linear filter.

Your options are then to delay the feedback path with its nonlinearity by one sample and feed it back into the 4-section model input. That will create significant deviations from the intended filter behaviour for high frequencies and high resonances. You can compensate for that somewhat, but it is tedious to get right. See Antti Huovilainen's paper for an approach like that.

The other option is to solve the implicit feedback equation using an iterative method for every single sample. That is doable, but requires significantly more computational effort and some experience with numerical methods to guarantee convergence and stability.

If you go that latter route, you might as well go with a proper nonlinear filter model, because that will need very similar methods to solve.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.