sunday drawings

2006 i fiddled with some simple drawing routines in sc. ( now i've added matching (?) sound synthesis and some slight modifications to the drawing code. there are 7 parameters that are used to both generate the picture and the sound. normally the parameters are randomised but it is possible to copy&paste a good sounding/looking set of parameters into the code to get the same drawing back.

below is the new code + embedded vimeos.

s.latency= 0.05;
        var width= 640, height= 480, w, u, drawFunc, clearFunc;
        var fadeAtk= 1400, fadeSus= 700, fadeRel= 350;
        var a, b, c, d, e, f, g, i= 0, theta= 0;
        var syn= SynthDef(\sunday, {|amp= 0, a= 1, b= 1, c= 1, d= 1, e= 1, f= 1, g= 1|
                var z0= Mix([a, b]), a+b, e, amp));
                var z1=,, c.abs, f, 2pi), amp);
                var z2=,, d.abs, g, 2pi), amp);
      ,, 0, 0.3), -0.3, 0.3), 0.3, 0.3));
        w= Window("sunday drawings2", Rect(128, 64, width, height), false);
        drawFunc= {
                var x, y;
                if(i==0, {
                                \a, a, \b, b, \c, c, \d, d, \e, e, \f, f, \g, g
                        ].pairsDo{|m, n| (""++m++"="+n++";").postln};
                if(i<fadeAtk, {
                        theta= theta+(d*e*f);
                        x= sin(theta*a%a/b*c*2pi);
                        y= sin(theta*b%b/a*d*2pi);
                        Pen.strokeColor= Color.grey(1, 0.5);
                        Pen.translate(width*0.5, height*0.5);
                        Pen.scale(f, g);
                                0, {Pen.strokeOval(Rect.aboutPoint(Point(x*100, y*100), a, b))},
                                1, {Pen.strokeRect(Rect.aboutPoint(Point(x*100, y*100), a, b))},
                                2, {Pen.line(Point(x*100, y*100), Point(a*c*100, b*d*100)); Pen.stroke}
                        syn.set(\amp, i/fadeAtk, \a, a, \b, b, \c, c, \d, d, \e, e, \f, f, \g, g);
                if(i>(fadeAtk+fadeSus), {
                        theta= 0;
                        Pen.fillColor= Color.grey(0, 5/fadeRel);
                        Pen.fillRect(Rect(0, 0, width, height));
                        syn.set(\amp, i.linexp(fadeAtk+fadeSus, fadeAtk+fadeSus+fadeRel, 1, 0.0001));
                if(i==(fadeAtk+fadeSus+fadeRel), {
                        i= 0;
                }, {
                        i= i+1;
        clearFunc= {
                //--replace with preset from here
                a= 200.rand+1;
                b= 200.rand+1;
                c= 3.0.rand2;
                d= 3.0.rand2;
                e= 3.0.rand;
                f= 0.1.rrand(1.5)*#[1, -1].choose;
                g= 0.1.rrand(1.5)*#[1, -1].choose;
                //--to here
        u= UserView(w, Rect(0, 0, width, height))
        u.animate= true;
        CmdPeriod.doOnce({if(w.isClosed.not, {w.close})});
        w.onClose= {};