This can already be done with Fb1 from miSCellaneous_lib quark, following an idea of Nathaniel Virgo. Not being a filter expert but out of interest I checked the TPT example from Robin Schmidt here:
It needs a lot of ugens but only 3 % CPU on my 5-year-old iMac.
This code supposes miSCellaneous installed, sample rate 44100 and blocksize 64 (can be adapted).
(
// following example by Robin Schmidt
// https://www.kvraudio.com/forum/viewtopic.php?p=4932644
~inBus = Bus.audio(s, 1);
SynthDef(\tpt_test, { |outBus = 0, inBus, damp = 0.5, cutoff = 10000, filterType = 0, amp = 1|
var fs = 44100, wd, t, wa, g, in, sig, r = damp, fc = cutoff;
in = In.ar(inBus, 1);
wd = 2*pi*fc;
t = 1/fs;
wa = 2/t * tan(wd*t/2);
g = wa*t/2;
sig = Fb1({ |in, out|
var yH, yB, yL, s1, s2;
// we need previous s1 and s2 (out[1]), from this first and second component
s1 = out[1][0];
s2 = out[1][1];
yH = in - (2*r*s1) - (g*s1) - s2 / (1 + (2*r*g) + (g*g));
yB = g*yH + s1;
s1 = g*yB;
yL = g*yB + s2;
s2 = g*yB + yL;
// pass s1 and s2 for next sample plus filtered signal
[s1, s2, yH, yB, yL]
}, in, outSize: 5, leakDC: false);
Out.ar(outBus, Select.ar(filterType, sig[(2..4)]) * amp);
}, metadata: (
specs: (
inBus: ~inBus.index,
damp: [0.01, 0.99, \lin, 0, 0.5],
cutoff: [100, 15000, \exp, 0, 2000],
filterType: [0, 2, \lin, 1, 0],
amp: [0, 1, \lin, 0, 0.5]
)
)
).add
)
// start filter first with green button
\tpt_test.sVarGui.gui
// start source
{ Out.ar(~inBus, WhiteNoise.ar(0.1)) }.play
// check spectrum
s.freqscope
Daniel