Delay line filter with fixed dampening time?

DSP, Plugin and Host development discussion.
RELATED
PRODUCTS

Post

JCJR wrote: Wed Oct 02, 2019 7:23 pm You could do the same with the simple lowpass filter, but you would need to figure out how to find the filter cutoff frequency that would give you that required amount of cut at whatever high frequency target frequency you pick. And find the dampCoeff value which would tune your filter to that value.
BLT low-pass version (DC gain = 1, Nyquist gain = 0):

Code: Select all

// one pole damper - BLT version
struct Damper
{
    double  b, a, z;

    // assume normalized fc = f / fs
    void setup(double fc, double g)
    {
        // BLT one-pole lowpass is
        //  b * (1 + z^-1) / (1 - a*z^-1)
        //
        // magnitude response comes out as:
        //        sqrt(sin(w)^2+(cos(w)+1)^2)
        // b * ---------------------------------
        //     sqrt(a^2*sin(w)^2+(a*cos(w)+1)^2)
        //
        // normalizing for DC gain = 1 gives:
        //  b = abs(a+1)/2
        //
        // then setting a specific gain g at w we get:
        //  ((a+1)*sqrt(2*cos(w)+2))
        // -------------------------- = g
        // (2*sqrt(2*a*cos(w)+a^2+1))
        //
        // Wolfram alpha gives:
        //
        // a = (1 + cos(w) -2 * g^2 * cos(w)
        //      +/- 2 * sqrt(g^2 * sin^2(w) - g^4 * sin^2(w)))
        //   / (2 g^2 - cos(w) - 1)
        //
        // obviously only one of these is stable
        double w = 2*M_PI*fc;
        double cw = cos(w);
        double sw = sin(w);
        double g2 = g*g;

        a = (1 + cw - 2*g2*cw - 2*sqrt(g2 * (1 - g2) * sw*sw)) / (2 * g2 - cw - 1);
        b = (a + 1) / 2;
    }

    void reset()
    {
        z = 0;
    }

    double process(double x)
    {
        // TDF2 BLT
        double y = b*x + z; 
               z = b*x - a*y;
        return y;
    }
};
In case it doesn't work as desired, see the comments for potential mistakes in the formula.

Post

While OP didn't mention reverbs, I'd like to make an observation that frequency warping of BLT low-pass dampers can actually be quite nice in reverbs, since it allows the attenuation to increase with growing slope at frequencies approaching Nyquist. Since quite often in reverbs one would like the damping to increase very fast in the 15kHz+ region, even a simple 1st order LP can do this quite fine if the algorithm is running at a low sampling rate (eg. 44.1kHz).

Unfortunately, when trying to run the same algorithm at higher sampling rates, it can actually sound worse (ie. far too bright) as the beneficial effect of frequency warping is lost. This in turn leads a very curious situation, where in some cases it might actually be beneficial to undersample reverbs (ie. always run the algorithm at 44.1kHz or even slightly lower, even if the host sampling rate is significantly higher).

Post

mystran, I did not test your one pole damper but am impressed! Admirable to have such nimble math ability!

You make a good point about possible advantage of low samplerate frequency warping to help make "natural sounding" reverb hf damping curve.

My ear is not easily pleased with reverb. I like reverb in mixes, claiming no "exalted good taste" in judging reverb quality. Perhaps it is even "exalted bad taste". Only that my ear is displeased one way or the other with most reverbs. I usually like generic algorithmic smooth reverb and tend to hear undesirables in most reverbs.

As a general rule, on instruments or vocals rather low-density reverb barely denser than a busy multitap delay line. Like a low-regeneration setting on an old Ursa Major Space Station .

On percussion&drums usually such high density/dispersion that it sounds almost like decaying white noise tails. Anything less-dense on drums sounds too "rattly".

Same with HF and LF damping, a challenge to tweak satisfactory. Neither too bright nor too dark. Neither too deep nor too shallow. Basically requires a better set of ears but I have to please the ears I'm stuck with. :)

Post

It’s late here, and I found a bug in my update parameter code which doesn’t help right now :oops:
Some karplus-strong filtering info I found seems to mirror what mystran was saying.... And it worked great, thanks!

Post Reply

Return to “DSP and Plugin Development”