s.boot

p=ProxySpace.push(s)
p.pop
~out
~out.play

(
SynthDef(\piu, {|freq, dur, amp,pan|
			  var sig, env;
			  sig=(Saw.ar(Line.kr(freq*8,freq,dur),amp)+SinOsc.ar(Line.kr(freq*8,freq,dur),pi/2,amp/2))*LFTri.ar(1/0.09);
			  sig=Pan2.ar(sig,pan);
			  env=EnvGen.kr(Env([0,1,1,0],[0,dur,0]),doneAction:2);
			  Out.ar(0,sig*env);
			  }).send(s)
)

(
SynthDef(\pia, {|freq, dur, amp|
			  var sig, env;
			  sig=Saw.ar([freq, freq*1.05],amp/2)+SinOsc.ar(freq);
			  env=EnvGen.kr(Env([0,1,1,0],[0,dur,0]),doneAction:2);
			  Out.ar(0,sig*env);
			  }).send(s)
)

Synth(\pia, [\freq, 200, \amp,1, \dur, 2])

~arrayPiu3=[0,1,4]; ~arrayPiu4=[2,6];
~arrayPiu3=[0,1,4]; ~arrayPiu4=[2,6,7];
~arrayPiu3=(0..7); ~arrayPiu4=(0..7)
~arrayPiu3=Array.rand(4,0,7); ~arrayPiu4=Array.rand(4,0,7);

(
Tdef(\pow, {var arrayPiu=Array.rand(8,0,7), arrayPiu2=Array.rand(8,0,7);
			inf.do{|i|
				   //if(arrayPiu.find([i%16])!=nil,{Synth(\piu, [\freq, ((i%2)+1)*1120, \amp,0.2375, \dur,0.02, \pan, [-1,1].choose])});
				   //if(arrayPiu2.find([i%8])!=nil,{Synth(\piu, [\freq, ((i%2)+1)*1150, \amp,0.2375, \dur,0.02, \pan, [-1,1].choose])});
				   if(~arrayPiu3.find([i%8])!=nil,{Synth(\piu, [\freq, ((i%4)+1)*60, \amp,0.575, \dur,0.035, \pan, [-1,1].choose])});
				   if(~arrayPiu4.find([i%8])!=nil,{Synth(\piu, [\freq, ((i%2)+1)*150, \amp,0.575, \dur,0.035, \pan, [-1,1].choose])});

				   (0.09*[1].choose).wait;
				   }
		})
)		

Tdef(\pow).play
Tdef(\pow).stop
(
(
Tdef(\poi, {var arrayPia=Pseq((Array.rand(8,0,16).scramble++Array.series(rrand(6,10),6.rand)).midiratio,100000).asStream, arrayPia2=Array.rand(8,0,7),
			  arrayPiaDos=Pseq((Array.rand(8,0,16).scramble++Array.fill(rrand(6,10),6.rand)).midiratio,100000).asStream, arrayPia2Dos=Array.rand(8,0,7)+8;
			inf.do{|i|
				   if(arrayPia2.find([i%8])!=nil,{Synth(\pia, [\freq, 60*arrayPia.next, \amp,0.675, \dur, 0.1])});
				   if(arrayPia2Dos.find([i%32])!=nil,{Synth(\pia, [\freq, 50*arrayPiaDos.next, \amp,0.675, \dur, 0.1])});
				   0.09.wait;
				   }
		})
);
(
Tdef(\poia, {var arrayPia=Pseq((Array.rand(4,0,6).scramble++Array.fill(rrand(20,10),6.rand)).midiratio,100000).asStream, arrayPia2=Array.rand(8,0,7),
			  arrayPiaDos=Pseq((Array.rand(4,0,6).scramble++Array.fill(rrand(20,10),6.rand)).midiratio,100000).asStream, arrayPia2Dos=Array.rand(8,0,7)+8;
			inf.do{|i|
				   if(arrayPia2.find([i%16])!=nil,{Synth(\pia, [\freq, 170*arrayPia.next, \amp,0.12357, \dur, 0.05])});
				   if(arrayPia2Dos.find([i%32])!=nil,{Synth(\pia, [\freq, 220*arrayPiaDos.next, \amp,0.12357, \dur, 0.05])});
				   0.09.wait;
				   }
		})
);
)			
Tdef(\poi).play;
Tdef(\poia).play;

Tdef(\poi).stop;	
Tdef(\poia).stop