Fast Modulation of Filter Parameters

DSP, Plugin and Host development discussion.
Post Reply New Topic
RELATED
PRODUCTS

Post

EDIT: Fixed a problem in equation 12 and 14
EDIT 2: Currently turning this into a bit more of an elaborate guide for any one interested in the subject.
EDIT 3: Fixed incorrect code in prewarp. It should be tan() not tan()/2
EDIT 4: Added a new section for a "Pole-Zero to TPT converter". A sub section for a generalized CPS. And a complementary section for showing an elaborate proof of BIBO stability of the CPS system. Acknowledgments are also in place.

http://www.solostuff.net/wp-content/upl ... v1.1.1.pdf

Regards,
Ammar


Hi Everyone. I've hesitated a bit before posting this, but finally here it is.

This is a rather brief paper that documents my humble personal research into the topic titled. It mainly serves as an informal record for me (because I forget too quickly what I've done). But I've written it in a readable (and hopefully friendly) fashion so that others in the same boat may (or may not) find it useful. Although, I do present what I think is a new working approach. It's still largely in progress and incomplete.
Last edited by S0lo on Sat May 18, 2019 8:16 pm, edited 9 times in total.
www.solostuff.net
Advice is heavy. So don’t send it like a mountain.

Post

Thanks for posting. Its an interesting read, (just had time for a quick once over. I will probably have to re-read the derivation of the monster structure). I had considered using two complex one pole stages, but that's as far as I took it. I had wondered if modulation of such a structure could result in complex output? Probably if it did it would just be noise that could be safely ignored, I dunno?

Anyway the method I use for this kind of thing is to do inverse BLT of the digital filter to obtain the "analog" coefficients which can then just be plugged into a TPT structure. At some point if I get the chance I might compare methods.

Post

Interesting read, I almost understood some parts of it ;)
David Guda gudaaudio.com

Post

Reading that at the moment, thanks for sharing !

Just one first remark. Again someone mistooks the term "zero delay feedback filter" for something else. That term means only one thing: you have an analog prototype of any given filter, which displays very clearly an instantaneous feedback loop somewhere, and you've found a way to discretize it which solved the feedback loop without the need to put a z^-1 to make everything explicit and simple but less accurate. That's all. That doesn't imply anything related to the time-variant behaviour which is something usually related to the famous TPT structure.

By the way:
  • you can have filters simulated with the TPT structure which have a bad behaviour when you modulate one of their parameters depending on the signal path
  • you can have filters not simulated with the TPT structure which don't have any change artefact when you modulate any of their parameters
  • you can have nonlinear filters simulated with the TPT structure which are not ZDF filters at all

Post

I have very little to add really, except I was going to say basically the same as what Ivan_C says.

The transient problems when changing coefficients are generally caused by the state being relative to the coefficients. Essentially, if you have a structure such that given a random initial state vector you can predict the initial level of the decaying envelope of the output without knowing the (pole) coefficients (eg. frequency just scales the state evolution in time and Q just controls the damping), then it will be stable under modulation.

Most of the popular continuous-time filters are like this and trapezoidal integration of such filters won't cause any additional problems.... but for example normalized digital lattices (and normalization is really the key here, because it means the internal gains doesn't get scaled by the coefficients) don't really have any huge issues either.

Post

matt42 wrote: Sun Apr 21, 2019 5:49 am Thanks for posting. Its an interesting read, (just had time for a quick once over. I will probably have to re-read the derivation of the monster structure). I had considered using two complex one pole stages, but that's as far as I took it. I had wondered if modulation of such a structure could result in complex output? Probably if it did it would just be noise that could be safely ignored, I dunno?
The code part of the monster thing had a typo allover (used out instead of lp). It's fixed now.

If all conjugate pairs are present. They should cancel each other imaginary parts. Any noise in the imaginary part would be a numerical error. It should be very low. As you said it can be ignored.
matt42 wrote: Sun Apr 21, 2019 5:49 amAnyway the method I use for this kind of thing is to do inverse BLT of the digital filter to obtain the "analog" coefficients which can then just be plugged into a TPT structure. At some point if I get the chance I might compare methods.
hmm, I've never thought of doing that. Interesting!!. The question is, after BLT would it stay to be the same filter you designed? Or would the positioning of poles and zero change?. I'm guessing it would change, but it probably doesn't matter much in many cases like typical LP and HP as long as it works.
www.solostuff.net
Advice is heavy. So don’t send it like a mountain.

Post

S0lo wrote: Sun Apr 21, 2019 8:00 pm
matt42 wrote: Sun Apr 21, 2019 5:49 amAnyway the method I use for this kind of thing is to do inverse BLT of the digital filter to obtain the "analog" coefficients which can then just be plugged into a TPT structure. At some point if I get the chance I might compare methods.
hmm, I've never thought of doing that. Interesting!!. The question is, after BLT would it stay to be the same filter you designed? Or would the positioning of poles and zero change?. I'm guessing it would change, but it probably doesn't matter much in many cases like typical LP and HP as long as it works.
If you just do inverse BLT followed by TPT (which from the transfer function point of view is just BLT) using the same warping coefficient both ways, then there will be no change of poles or zeroes, as BLT is simply a rotation of the Riemann sphere.

That said, there's no real need to bother with this, since you can also just solve the coefficients for your TPT filter directly from the direct form coefficients. Note that either way, going through direct form coefficients does lose some numerical precision, so you probably want to use doubles for such things.

Post

Ivan_C wrote: Sun Apr 21, 2019 1:09 pm Reading that at the moment, thanks for sharing !

Just one first remark. Again someone mistooks the term "zero delay feedback filter" for something else. That term means only one thing: you have an analog prototype of any given filter, which displays very clearly an instantaneous feedback loop somewhere, and you've found a way to discretize it which solved the feedback loop without the need to put a z^-1 to make everything explicit and simple but less accurate. That's all. That doesn't imply anything related to the time-variant behaviour which is something usually related to the famous TPT structure.
hmm, not sure I got you right. But I'm also not sure your got me right. Because what you said is pretty much how I understand ZDF.
Ivan_C wrote: Sun Apr 21, 2019 1:09 pm By the way:
  • you can have filters simulated with the TPT structure which have a bad behaviour when you modulate one of their parameters depending on the signal path
If you meant by "bad behaviour" that they explode/blow (i.e causing a numerical over flow). Then Yes, I didn't know that. Thanks. I'll research it further. Otherwise, if the structure doesn't overflow then I'd consider it valid as long as it produces some usable sound. Then the validity of the structure becomes more of a taste thing I guess.
Ivan_C wrote: Sun Apr 21, 2019 1:09 pm[*]you can have filters not simulated with the TPT structure which don't have any change artifact when you modulate any of their parameters
Thanks. It is pretty much my point in the paper. But I was more importantly referring to the instability (i.e overflow).
Ivan_C wrote: Sun Apr 21, 2019 1:09 pm[*]you can have nonlinear filters simulated with the TPT structure which are not ZDF filters at all
[/list]
Your right. I guess thats were I went wrong. I kept repeating ZDF and TPT together as if they were the same thing. I should have clarified my point further. It's just that ZDF became commonly as an A.K.A for TPT.
www.solostuff.net
Advice is heavy. So don’t send it like a mountain.

Post

mystran wrote: Sun Apr 21, 2019 8:13 pmIf you just do inverse BLT followed by TPT (which from the transfer function point of view is just BLT) using the same warping coefficient both ways, then there will be no change of poles or zeroes, as BLT is simply a rotation of the Riemann sphere.

That said, there's no real need to bother with this, since you can also just solve the coefficients for your TPT filter directly from the direct form coefficients. Note that either way, going through direct form coefficients does lose some numerical precision, so you probably want to use doubles for such things.
Hi mystran, just wondering how would you solve this directly from the direct form coefficients? IBLT does this in just a few operations (for a second order filter). Perhaps I've misunderstood you.
S0lo wrote: Sun Apr 21, 2019 8:00 pmhmm, I've never thought of doing that. Interesting!!. The question is, after BLT would it stay to be the same filter you designed? Or would the positioning of poles and zero change?. I'm guessing it would change, but it probably doesn't matter much in many cases like typical LP and HP as long as it works.
As mystran pointed out it will be the same. Otherwise IBLT wouldn't really be the inverse of the BLT (there is a one to one mapping between z and s domain in I/BLT). We're just finding the analog filter that would yield our digital filter via BLT.

Also, probably obvious, it's nice to set the transform, so that the integrator gain is 1 and save a few multiplications.

Post

mystran wrote: Sun Apr 21, 2019 8:13 pm If you just do inverse BLT followed by TPT (which from the transfer function point of view is just BLT) using the same warping coefficient both ways, then there will be no change of poles or zeroes, as BLT is simply a rotation of the Riemann sphere.
I'm doing it now for the transfer function mentioned in page 10 eq 34. Will try to post tomorrow. too late here. But briefly speaking. I'm getting a no solution out of symbolic solver. Probably something wrong I've done.
www.solostuff.net
Advice is heavy. So don’t send it like a mountain.

Post

matt42 wrote: Sun Apr 21, 2019 9:38 pm Hi mystran, just wondering how would you solve this directly from the direct form coefficients? IBLT does this in just a few operations (for a second order filter). Perhaps I've misunderstood you.
You can take the z-domain transfer function of the desired topology with variables for the coefficients, write one equation for each power of z^-1 equating it to the matching direct form coefficients (which can be symbolic constants, so you can convert the solution into general code) and tell your CAS to solve the system.

For something like the ZDF-SVF, what you get (especially after some factoring of the solution) is basically equivalent to IBLT (since the SVF coefficients are really just s-plane coefficients to begin with), but the same general method works with any digital filter, whether it's TPT-derived or something else, as long as the target topology is something that can actually implement the desired transfer function.

Post

S0lo wrote: Sun Apr 21, 2019 8:42 pm Your right. I guess thats were I went wrong. I kept repeating ZDF and TPT together as if they were the same thing. I should have clarified my point further. It's just that ZDF became commonly as an A.K.A for TPT.
From the practical point of view, they are the exact same thing.

You see.. first there was ZDF, which was about solving the implicit feedback loops that you get when you try to implement analog topologies using trapezoidal integration. Then some people objected to the term being too general and started using the TPT term when the goal is to implement analog topologies using trapezoidal integration.

Meanwhile, the rest of the world just calls it trapezoidal integration. Since in audio use, we usually have some frequency we want to tune accurately, we usually throw in BLT pre-warping too (which sort of warrants using an acronym, just so you don't need to type "trapezoidal integration with BLT pre-warp" every time), but really other than that it's just plain old trapezoidal integration.

Post

mystran wrote: Sun Apr 21, 2019 8:13 pmIf you just do inverse BLT followed by TPT (which from the transfer function point of view is just BLT) using the same warping coefficient both ways, then there will be no change of poles or zeroes, as BLT is simply a rotation of the Riemann sphere.
So may be some one can tell me what I'm doing wrong here:

http://www.solostuff.net/wp-content/upl ... e-BLTt.pdf

I have more to say about this. But I'm going to shut my mouth, since people are apparently using this successfully.
www.solostuff.net
Advice is heavy. So don’t send it like a mountain.

Post

Hi Solo,

I only had time for a quick look. A couple of things:

Once you arrive at H(s) that's it. I'm not sure why you are trying to equalise with the SVF transfer function?

Regarding pre-warping - in this case there is no need. So long as you use the same T parameter for IBLT and BLT then the transforms will be 1 for 1 mappings of each other. Choose a value of T that will be convenient.
Last edited by matt42 on Mon Apr 22, 2019 3:40 pm, edited 1 time in total.

Post

This is what I use for SVF:

Code: Select all

        // convert a direct-form filter into SVF form for implementation
        void setDF(double a1, double a2,
            double b0, double b1, double b2)
        {

            f = sqrt((1 + a1 + a2) / (1 - a1 + a2));
            r = - 2 * (a2 - 1) / sqrt(a2*a2 + 2*a2 - a1*a1 + 1);

            // undo normalization
            double a0 = (f*(f+r)+1);
            g = 1 / a0;

            double r2f = 0.5 / f;

            h = (b0 - b1 + b2) * 0.25 * a0;
            b = (b0 - b2) * r2f * a0;
            l = (b0 + b1 + b2) * (r2f * r2f) * a0;
        }
f is tuning, r is damping, g is precomputed reciprocal denominator, h,b,l are the output gains for hp,bp,lp respectively:

Code: Select all

    struct SVFChannel
    {
        double z1, z2;

        SVFChannel() { reset(); }
        void reset() { z1 = z2 = 0; }

        // step the system, return all outputs
        void stepSystem(const SVFCoeff & c, double in,
            double & hp, double & bp, double & lp)
        {
            hp = (in - (c.f + c.r)*z1 - z2) * c.g;
            bp = z1 + c.f*hp;
            lp = z2 + c.f*bp;

            z1 = 2*bp - z1;
            z2 = 2*lp - z2;
        }

        // step the system and perform output weighting
        double step(const SVFCoeff & c, double in)
        {
            double hp, bp, lp;
            stepSystem(c, in, hp, bp, lp);
            return c.h * hp + c.b * bp + c.l * lp;
        }
    };

Post Reply

Return to “DSP and Plugin Development”