So Oleg a PR would be welcome ! Thanks.
Stéphane > Le 1 sept. 2020 à 22:59, Julius Smith <j...@ccrma.stanford.edu> a écrit : > > Since it's different, and arguably the best choice under particular > conditions, I would support adding the family to filters.lib, perhaps using > prefix/suffix "svfs", where svf means "state-variable filter" and "s" means > "s-plane controlled", like the "ns" after "tf2" means "normalized-ladder, > s-plane controlled". Please don't forget the reference in the comments! > > Cheers, > Julius > > On Mon, Aug 31, 2020 at 8:31 AM Oleg Nesterov <o...@redhat.com> wrote: > Stephane, > > I wrote this email right after our short discussion on slack.com but > somehow I forgot to send it. > > So I don't really know how to compare this filter with the existing > filters forms in filters.lib, but please see the simple, stupid and > "non-scientific" test below. > > Note! all 3 band-pass filters bp(fi.tf2s, F,Q), bp(fi.tf2snp,F,Q) and > svf.bp(F,Q) have the same impulse responce for any F/Q. > > However they differ if F or/and Q is modulated, this is what this test > tries to demonstrate, note that the 3rd output has a much more flat > envelope. See http://people.redhat.com/onestero/svf/output.png > > Oleg. > > ------------------------------------------------------------------------------- > import("stdfaust.lib"); > > F = 1000 + 200*os.oscrs(50); > Q = 2; > > process = os.oscrs(F) > <: bp(fi.tf2s, F,Q), bp(fi.tf2snp,F,Q), svf.bp(F,Q) > // separate the outputs to make the difference more clear > : par(i, 3, -(5*i)); > > bp(t2s, F,Q) = t2s(b2,b1,b0,a1,a0,wc) > with { > wc = 2*ma.PI*F; > a1 = 1/Q; > a0 = 1; > b2 = 0; > b1 = 1; > b0 = 0; > }; > > svf = environment { > svf(T,F,Q,G) = tick ~ (_,_) : !,!,si.dot(3, mix) > with { > tick(ic1eq, ic2eq, v0) = > 2*v1 - ic1eq, > 2*v2 - ic2eq, > v0, v1, v2 > with { > v1 = ic1eq + g *(v0-ic2eq) : /(1 + g*(g+k)); > v2 = ic2eq + g * v1; > }; > > A = pow(10.0, G / 40.0); > > g = tan(F * ma.PI / ma.SR) : case { > (7) => /(sqrt(A)); > (8) => *(sqrt(A)); > (t) => _; > } (T); > > k = case { > (6) => 1/(Q*A); > (t) => 1/Q; > } (T); > > mix = case { > (0) => 0, 0, 1; > (1) => 0, 1, 0; > (2) => 1, -k, -1; > (3) => 1, -k, 0; > (4) => 1, -k, -2; > (5) => 1, -2*k, 0; > (6) => 1, k*(A*A-1), 0; > (7) => 1, k*(A-1), A*A-1; > (8) => A*A, k*(1-A)*A, 1-A*A; > } (T); > }; > > lp(f,q) = svf(0, f,q,0); > bp(f,q) = svf(1, f,q,0); > hp(f,q) = svf(2, f,q,0); > notch(f,q) = svf(3, f,q,0); > peak(f,q) = svf(4, f,q,0); > ap(f,q) = svf(5, f,q,0); > bell(f,q,g) = svf(6, f,q,g); > ls(f,q,g) = svf(7, f,q,g); > hs(f,q,g) = svf(8, f,q,g); > }; > > > > _______________________________________________ > Faudiostream-users mailing list > Faudiostream-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/faudiostream-users > > > -- > Julius O. Smith III <j...@ccrma.stanford.edu> > Professor of Music and, by courtesy, Electrical Engineering > CCRMA, Stanford University > http://ccrma.stanford.edu/~jos/ _______________________________________________ Faudiostream-users mailing list Faudiostream-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/faudiostream-users