Do you know guy can find some filters?

I’m looking for filters to use in a a project that could be updated realtime. Im just looking for the basics and some of the crazier ones like ladder butterworth?

You can probably pluck/hack these apart for what you need:

Oh awesome thanks man!

Those should work I’ve seen the Vinnie filters but not the dim’s which seem right up my alley!

Any chance you know where to find a way to display a filter from it’s biquad coefficients?

I don’t recall entirely off-hand, but it’s possible that Daniel’s already covered this in his repo: GitHub - ffAudio/PluginGuiMagic: Examples for foleys_gui_magic - the styleable plugin gui

1 Like

Ive looked at that before when I first started but didn’t understand it too much. I may be confused but I thought it used the Juce class to plot a filter response.

I was looking for something bi-quad → response.
There was one project on git hub a few years back but it wasn’t too accurate.

I’m just curious if I’m going about this in the wrong way.

I found this…

Math :

           a0 + a1 z + a2 z^2 + ... + an z^n
H(z) = -----------------------------------------
           b0 + b1 z + b2 z^2 + ... + bn z^n

H(w) = H(z) where z = e^jw = cos(w) + jsin(w)

       Frequency (Hz)
w = ------------------- x 2pi (Radians)
      Sample Rate (Hz)

Code :

#include <complex>
using cmpx = std::complex<float>;

cmpx calc_freq_response (float frequency,
                         float sample_rate,
                         size_t order,
                         const float* a,
                         const float* b) 
    float w = 2.0 * pi * frequency / sample_rate;
    cmpx z (cos(w), sin(w));

    cmpx num (0.0, 0.0);
    cmpx den (0.0, 0.0);
    cmpx zn (1.0, 0.0);

    for (auto n = 0; n < order; n++) 
        num += a[n] * zn;
        den += b[n] * zn;
        zn *= z;

    return num / den;

Magnitude is std::abs(H), phase is std::arg(H).

cpp reference on std::complex: std::complex -

The only “gotcha” is the sign of the denominator coefficients. Depending on your source they may need to be flipped.