( p = Prout({ var z,a,b,c, discriminant; loop({ z=Complex(rrand(0.1,1.0)*([1,-1].choose),rrand(0.1,1.0)*([1,-1].choose)); [rrand(5,15),rrand(10,50),exprand(1,50).round(1.0).asInteger].wchoose([0.8,0.1,0.1]).do({ //z goes to w where z^2+zw+w^2=3, know z, solve quadratic a=1; b=z; c=z*z-3; discriminant= b*b - 4*c; //used as temp variable, complex root taking lowest angle a = Polar(discriminant.magnitude.sqrt,(discriminant.theta)/2); //two roots, + or - here, choose + arbitrarily z = 0.5*(z.neg + (a.asComplex)); if(z.magnitude<10,{ [(z.real.abs*2).asInteger,0.25*((z.imag.abs).min(1.0))].yield; }); }); }); }); b = Pbind(\instrument, \synth2, \scale, [0,2,3,5,7,9,11,13,14,16,17,19,20,23,24], \dur,0.125,[\degree, \amp], p); Ptpar([ 0.0, Pbindf(b, \octave, 4,\stretch, 3.0), 4.0, b, 8.0, Pbindf(b, \octave, 3,\stretch, 5.0), 12.0, Pbindf(b, \octave, 5,\stretch, 7.0)]).play(TempoClock(1)); ) ( SynthDef(\synth2,{ arg freq,mod=0.5,amp=0.1; var sound1; sound1=Pulse.ar(freq,0.5-(0.1*amp),amp)*Line.kr(1,0,ExpRand(0.25,1.5),doneAction:2); Out.ar(0,Pan2.ar(LPF.ar(sound1,Rand(100,500)+(5800*amp)))) }).store; )