(
SynthDef(\pensoundexample,{arg freq=440, amp=0.1;
Out.ar(0,amp*Line.kr(1,0,1,doneAction:2)*LPF.ar(LFSaw.ar(Line.kr(4,0.5,1,freq)),Line.kr(5000,1000,0.2)))
}).send(s)
)
(
var w, run = true, temp;
var points, counter;
var n = 13;
w = SCWindow("av within SC", Rect(100, 50, 400, 400));
//w.view.background = Color.white;
w.onClose = { run = false; };
w.front;
w.drawHook = {
n= rrand(3,13);
points= Array.fill(n,{Point(rrand(10,390),rrand(10,390))});
Pen.use {
Pen.width = 10.0;
n.do {|i|
Pen.beginPath;
Color(rrand(0.0,1.0),0.1,0.1).set;
Pen.moveTo(points[i]);
Pen.lineTo(points.wrapAt(i+1));
Synth(\pensoundexample,[\freq, (points[i].x)+100, \amp, 1/n]);
Pen.stroke;
};
};
};
{ while { run } {
w.refresh;
0.5.wait; } }.fork(AppClock)
)