s.boot

p=ProxySpace.push(s)

~out
~out.play

~ondita={|freq=100, amp=0.4, t_trig=0, dur=0.1|(SinOsc.ar(freq,0,amp)+Saw.ar(freq,amp*0.15))*EnvGen.kr(Env([0,1,1,0],[0,dur,0]),t_trig)}
~ondita2={|freq=100, amp=0.45, t_trig=0, dur=0.1|(SinOsc.ar(Lag.kr(freq,0.1),0,amp)+Saw.ar(freq,amp))}//*EnvGen.kr(Env.perc(0.01,dur),t_trig)}

~bombo={|freq=100, amp=1, t_trig=0, dur=0.1|Mix(SinOsc.ar(EnvGen.kr(Env([0,freq,60],[0,0.1]),t_trig),pi/2,amp))*EnvGen.kr(Env.perc(0.01,dur),t_trig)}
~bombo2={|freq=100, amp=1, t_trig=0, dur=0.1|Mix(SinOsc.ar(EnvGen.kr(Env([0,freq*1.1,60],[0,0.1]),t_trig),pi/2,amp))*EnvGen.kr(Env.perc(0.01,dur),t_trig)}

~tarola={|freq=100, amp=1, t_trig=0, dur=0.1|Mix(SinOsc.ar(EnvGen.kr(Env([0,freq,240],[0,0.1]),t_trig),pi/2,amp)+WhiteNoise.ar(0.5*amp))*EnvGen.kr(Env.perc(0.01,dur),t_trig)}

~out=~ondita
~out=~ondita+~ondita2
~out=~ondita+~ondita2+~bombo+~bombo2
~out=~ondita+~ondita2+~bombo+~bombo2+~tarola
~out=~bombo
~out=0

~aOndita=[0,2,4,5].midiratio
(
var trans= 2,
	ampTarolasDay2=0,
	ampBombosDay=0,
	amponditasDay2=0,
	amponditasDay=1;
(
Tdef(\onditasDay, {var aOndita=([0,2,3,5]+trans).scramble.midiratio, wait;
				inf.do{|i|
						wait=(0.09*[4,8,2].choose);
					   ~ondita.set(\freq, (aOndita[i%aOndita.size])*70*[2,1].choose, \t_trig, 1, \amp, 0.5*amponditasDay*[0,1].wchoose([0.4,0.6]), \dur, wait);
					   wait.wait;
					   }
			})
);
(
Tdef(\onditasDay2, {var aOndita=([0,2,3,5]+trans).scramble.midiratio;
				inf.do{|i|
					   ~ondita2.set(\freq, (aOndita[i%aOndita.size])*70*[4,8].choose, \t_trig, 1, \amp, [0.045,0].wchoose([0.7,0.3])*amponditasDay2);
					   (0.09*[1,2,4,8].choose).wait;
					   }
			})
);
(
Tdef(\bombosDay, {var aOndita=[0,2,3,5].scramble.midiratio, aBombo=[[1,3,6,4,2],[4,4,4,4],[1,3,6,4,2,4,4,4,4]].choose;
				inf.do{|i|
					   ~bombo.set(\freq, 140, \t_trig, 1, \dur, 0.43, \amp, 1*ampBombosDay);
					   ~bombo2.set(\freq, 170, \t_trig, 1, \dur, 0.43, \amp, 1*ampBombosDay);
					   (0.09*aBombo[i%aBombo.size]).wait;
					   }
			})
);
(
Tdef(\tarolasDay, {var aOndita=[0,2,3,5].scramble.midiratio, aTarola=[[1,1,4,4,4,4,4,4,2],[4,4,4,4,2,2,2,2,1,1].scramble].choose;
				inf.do{|i|
					   ~tarola.set(\freq, 300, \t_trig, 1, \dur, 0.1, \amp, 0.5*ampTarolasDay2);
					   (0.09*aTarola[i%aTarola.size]).wait;
					   }
			})
)
)

Tdef(\onditasDay).play;
Tdef(\onditasDay2).play;
Tdef(\bombosDay).play;
Tdef(\tarolasDay).play;

Tdef(\onditasDay).stop;
Tdef(\onditasDay2).stop;
Tdef(\tarolasDay).stop;