Hacker News new | ask | show | jobs
by CamperBob2 2 days ago
That gives you the time constant for the 63% step response, but that's not quite the same thing as the 3-dB cutoff, due to frequency warping. I do this to get an alpha value for cutoff_Hz at a given sampling interval dt_s:

    double omega_c = TWO_PI * cutoff_Hz * dt_s;     
    double b = 4.0 - (2.0 * cos(omega_c));
    
    return 1.0 - ((b - sqrt(b*b - 4.0)) * 0.5);
Probably won't matter most of the time, though, when you're just trying to make some noise go away.