On 08/22, Julius Smith wrote:
>
> Hey, thanks for posting.  I made a faust2octave test program
> (attached).  Everything looks good to me, assuming I guessed all the
> names right.

Great, thanks.

do you think it can live in filters.lib? If yes, then I think
"svf = environment" makes sense, so that you can use it like

        process = fi.svf.lp(f,q);

See the code below. Note that this version differs a little bit, it uses
the second version described in that paper (see "algorithm using v1 to
compute v2").

iow

        v2 = ic2eq + g*v1;                      (2)

instead of

        v2 = ic2eq + a2*ic1eq + a3*v3;          (1)

I think it makes more sense for faust because it is simpler, and because
quite possibly faust will turn (2) into (1) after aterm/mterm normalization
anyway.

I even verified that "all pass" generates the same code with this change.

Oleg.

-------------------------------------------------------------------------------
svf = environment {
        svf(T,F,Q,G) = tick ~ (_,_) : !,!,_,_,_ : si.dot(3, mix)
        with {
                a1 = 1/(1 + g*(g + k));
                a2 = g*a1;

                tick(ic1eq, ic2eq, v0) =
                        2*v1 - ic1eq,
                        2*v2 - ic2eq,
                        v0, v1, v2
                with {
                        v1 = a1*ic1eq + a2*(v0 - ic2eq);
                        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);
};


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Faudiostream-users mailing list
Faudiostream-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/faudiostream-users

Reply via email to