Is there any rule of thumb for choosing MUSIC FILTER algorithm?

I mean, I know FIR, IIR, etc. But I am not sure which exact algorithm I should use.

Anyone knows, say which filter algorithm SuperCollider RLPF is using?

Thanks in advance.

interesting! are there any UGen implementations of the Trapezoidal SVF out there that anyone knows of?

1 Like

I’m making a tiny application with a GUI and using the filters as I see on textbooks like the Cookbook. It is clear this is just trying to have a working program, using the simplest solutions.

something likle

lowPassFilter :: Float -> Float -> IIRParams
lowPassFilter freq q =
    IIRParams
        { b0
        , b1 = 1 - cos w0
        , b2 = b0
        , a0 = 1 + α
        , a1 = -2 * cos w0
        , a2 = 1 - α
        }
  where
    b0 = (1 - cos w0) / 2
    w0 = calcW0 freq
    α = calcAQ w0 q

But, now tell me, is it true all good information about filters is dispersed everywhere in papers? Is there a place where we get all the information, but also get music insights like you usually share here? Show us the way!

1 Like

@nathan maybe that’s still one of the most " basic" filters, but what are the materials you would try? Even the Faust code is kind of messy, or just normal?

That’s the " Constant Peak-Gain Resonator"

This is a pretty thorough overview of many filter architectures. Not for musical insights though…

Luckily, there’s code for all of it:

1 Like
% Function Match example usage: Match(0.75)
function Match(wc)
    wc = wc * pi; % Convert cutoff frequency using pi

    figure(1); % Open a figure window
    hold on; % Hold on to plot multiple graphs

    % Bilinear transform calculations
    Gc = sqrt(1/2);
    alpha = tan(wc/2) / sqrt(1/(Gc*Gc) - 1);
    b = [alpha, alpha];
    a = [1+alpha, alpha-1];
    [h1, w] = freqz(b, a, 2048); % Frequency response

    % Gain adjustments
    g1 = 2 / sqrt(4 + (2*pi/wc)^2);
    gm = max(sqrt(0.5), sqrt(g1));

    % Analog-matched transform calculations
    Ws = tan(wc * sqrt(1 - gm^2) / (2 * gm)) * sqrt((gm^2 - g1^2) * (1 - gm^2)) / (1 - gm^2);
    b0 = Ws + g1;
    b1 = Ws - g1;
    a0 = Ws + 1;
    a1 = Ws - 1;
    b = [b0/a0, b1/a0];
    a = [1, a1/a0];
    [h2, w] = freqz(b, a, 2048); % Frequency response

    % Analog prototype filter
    num = 1; 
    den = [1/wc, 1]; 
    h3 = freqs(num, den, w); % Frequency response

    % Plotting
    plot(w/pi, abs(h1).*abs(h1), 'r', ...
         w/pi, abs(h2).*abs(h2), 'b', ...
         w/pi, abs(h3).*abs(h3), 'g'); % Plot frequency responses

    % Adding labels and legend
    xlabel('Normalized frequency (x\pi rad/sample)');
    ylabel('Square magnitude');
    legend('Bilinear transform', 'Analog-matched transform', 'Analog prototype');
end
1 Like