p= ProxySpace.push(s.boot)
p.makeTempoClock(2)
c= p.clock

//silly music2
~pop= {|freq= 200, amp= 0.1, t_trig= 0| EnvGen.kr(Env.perc(0.01, 0.3), t_trig)*XFade2.ar(SinOsc.ar(freq*[1, 1.01], 0, amp).mean, Pulse.ar(freq*[1, 1.01], 0.5, amp).mean, SinOsc.kr(~tempo.kr/4))}
~pop.play
~pop.set(\t_trig, 1)
~pop.set(\freq, 1000)
~pop.set(\t_trig, 1)

Tdef(\pop).quant_(4).play(c)
(Tdef(\pop, {inf.do{|i| ~pop.set(\freq, i.div(4)%8*50+200, \t_trig, 1); 0.5.wait}}))

~pop2= {|freq= 200, amp= 0.1, t_trig= 0| EnvGen.kr(Env.perc(0.01, 0.3), t_trig)*XFade2.ar(SinOsc.ar(freq*[1, 1.01], 0, amp).mean, Pulse.ar(freq*[1, 1.01], 0.5, amp).mean, SinOsc.kr(~tempo.kr/4))}

(Tdef(\pop2, {inf.do{|i| ~pop2.set(\freq, i.div(2)%8*50+100, \t_trig, 1); [0.5, 1.75, 0.25].wrapAt(i).wait}}))
Tdef(\pop2).quant_(4).play(c)
~pop2.play

~pop3= {|freq= 200, amp= 0.1, t_trig= 0| EnvGen.kr(Env.perc(0.01, 0.3), t_trig)*XFade2.ar(SinOsc.ar(freq*[1, 1.01], 0, amp).mean, Pulse.ar(freq*[1, 1.01], 0.5, amp).mean, SinOsc.kr(~tempo.kr/4))}

(Tdef(\pop3, {inf.do{|i| ~pop3.set(\freq, i.div(16)%8*50+800, \t_trig, 1); [0.75, 0.25].wrapAt(i).wait}}))
Tdef(\pop3).quant_(4).play(c)
~pop3.play

~pop.stop
~pop2.stop
~out.ar(2)
~out.play
~out= ~pop+~pop2
~pop3.stop
~out= ~pop+~pop2+~pop3

(Tdef(\pop3, {inf.do{|i| ~pop3.set(\freq, i.div(6)%6*100+800, \t_trig, 1); [0.75, 0.25].wrapAt(i).wait}}))

(Tdef(\pop3, {inf.do{|i| ~pop3.set(\freq, i.div(6)%3*200+700, \t_trig, 1); [0.75, 0.25].wrapAt(i).wait}}))
(Tdef(\pop3, {inf.do{|i| ~pop3.set(\freq, i.div(6)%3*200+600, \t_trig, 1); [0.75, 0.25].wrapAt(i).wait}}))

~pad= {|freq= 100, amp= 0.1| Pan2.ar(RLPF.ar(LFSaw.ar(freq*[1, 2.01, 3.02, 4.03], 0, amp).mean, freq*2, 0.3), SinOsc.kr(~tempo.kr, 0, 0.8))}

~pad.fadeTime_(8)
~pad.play
~pad.set(\freq, 50)
~pad.set(\freq, 100)
~pad.set(\freq, 60)
~pad.set(\freq, 100)
Tdef(\pad).quant_(4).play(c)
(Tdef(\pad, {
	var f, d;
	f= Pseq([100, 50, 100, 60, 100], inf).asStream;
	d= Pseq([7.5, 4.5, 4, 2, 2], inf).asStream;
	inf.do{|i| ~pad.set(\freq, f.next); d.next.wait};
}))

(Tdef(\pad, {
	var f, d;
	f= Pseq([100, 50, 100, 60, 60, 75], inf).asStream;
	d= Pseq([7.5, 4.5, 4, 4, 2, 2], inf).asStream;
	inf.do{|i| ~pad.set(\freq, f.next); d.next.wait};
}))

~pad= {|freq= 100, amp= 0.1| Pan2.ar(RLPF.ar(LFSaw.ar(freq*[1, 2.01, 3.02, 4.03], 0, amp).mean, freq*SinOsc.kr(~tempo/2, 0, 1, 3), 0.3), SinOsc.kr(~tempo.kr/2, 0, 0.8))}

~pop3= {|freq= 200, amp= 0.1, t_trig= 0| EnvGen.kr(Env.perc(0.01, 0.3), t_trig)*BPF.ar(XFade2.ar(SinOsc.ar(freq*[1, 1.01], 0, amp).mean, LFSaw.ar(freq*[1, 1.01], 0.5, amp).mean, SinOsc.kr(~tempo.kr/4)), 900)}

~pop2= {|freq= 200, amp= 0.1, t_trig= 0| EnvGen.kr(Env.perc(0.01, 0.3), t_trig)*LPF.ar(XFade2.ar(LFSaw.ar(freq*[1, 1.01], 0, amp).mean, Pulse.ar(freq*[1, 1.01], LFTri.kr(~tempo.kr, 0, 0.15, 0.5), amp).mean, SinOsc.kr(~tempo.kr/4)), 900)}

~pop= {|freq= 200, amp= 0.1, t_trig= 0| EnvGen.kr(Env.perc(0.01, 0.3), t_trig)*BPF.ar(XFade2.ar(LFTri.ar(freq*[1, 1.01], 0, amp).mean, Pulse.ar(freq*[1, 1.01], 0.5, amp).mean, SinOsc.kr(~tempo.kr/4)), 300, 20)}

Tdef(\pop).stop
(Tdef(\pop, {
	inf.do{|i|
		if(i%2==0, {
			~pop.set(\freq, i.div(4)%8*50+200, \t_trig, 1);
		}, {
			~pop.set(\freq, i.div(8)%16*100+400, \t_trig, 1);
		});
		0.25.wait
	}
}))
Tdef(\pop).play(c)

~pad2= {|freq= 100, amp= 0.1, lag= 1| Pan2.ar(RLPF.ar(LFPulse.ar(Lag.kr(freq, lag)*[1, 2.01, 3.02, 4.03], 0, amp).mean, freq*2, 0.3), SinOsc.kr(~tempo.kr, 0.5, 0.4))}
~pad2.play

Tdef(\pop2).stop
(Tdef(\pop2, {
	inf.do{|i|
		if(i%4==0, {
			~pop2.set(\freq, i.div(2)%8*50+100, \t_trig, 1);
		}, {
			~pop2.set(\freq, i.div(4)%16*100+200, \t_trig, 1);
		});
		([0.5, 1.75, 0.25]/2).wrapAt(i).wait
	}
}))
Tdef(\pop2).play(c)

Tdef(\pad2).quant_(4).play(c)
(Tdef(\pad2, {
	var f, d;
	f= Pseq([100, 50, 100, 60, 100], inf).asStream;
	d= Pseq([7.5, 4.5, 4, 2, 2]*2, inf).asStream;
	inf.do{|i| ~pad2.set(\freq, f.next); d.next.wait};
}))

(Tdef(\pad2, {
	var f, d, l;
	f= Pseq([100, 50, 100, 60], inf).asStream;
	d= Pseq([7.5, 4.5, 4, 4]*3, inf).asStream;
	l= Pseq([0, 2, 0, 2], inf).asStream;
	inf.do{|i| ~pad2.set(\lag, l.next, \freq, f.next); d.next.wait};
}))

(Tdef(\pop3, {
	inf.do{|i|
		if(i%2==0, {
			~pop3.set(\freq, i.div(6)%3*200+600, \t_trig, 1);
		}, {
			~pop3.set(\freq, i.div(12)%6*400+1200, \t_trig, 1);
		});
		([0.75, 0.25]/2).wrapAt(i).wait
	}
}))

(Tdef(\pop3, {
	inf.do{|i|
		if(i%3==0, {
			~pop3.set(\freq, i.div(6)%3*200+600, \t_trig, 1);
		}, {
			~pop3.set(\freq, i.div(3)%3*100+300, \t_trig, 1);
		});
		[0.75, 0.25].wrapAt(i).wait
	}
}))

(Tdef(\pop, {
	inf.do{|i|
		if(i%2==0, {
			~pop.set(\freq, i.div(4)%8*50+200, \t_trig, 1);
		}, {
			if(i%4==0, {
					~pop.set(\freq, i.div(4)%12*125+300, \t_trig, 1);
					0.125.wait;
				}, {
					~pop.set(\freq, i.div(8)%16*100+400, \t_trig, 1);
				});
		});
		0.25.wait
	}
}))

~tempo= {Line.kr(2, 2.5, 20)}	//not working?

~pop.fadeTime_(4)
~pop[2]= \filter -> {|in| in+CombN.ar(BPF.ar(in), 2.5.reciprocal, 2.5.reciprocal, 1)}

~pop2.fadeTime_(4)
~pop2[2]= \filter -> {|in| in+CombN.ar(BPF.ar(in), 2.5.reciprocal, 2.5.reciprocal, 1)}

~pop3.fadeTime_(4)
~pop3[2]= \filter -> {|in| in+CombN.ar(BPF.ar(in), 2.5.reciprocal, 2.5.reciprocal, 1)}

~pop[2]= \filter -> {|in| in+CombN.ar(RLPF.ar(in, 1000), 2.5.reciprocal, 2.5.reciprocal, 1)}
~pop2[2]= \filter -> {|in| in+CombN.ar(RLPF.ar(in, 2000), 2.5.reciprocal, 2.5.reciprocal, 1.2)}
~pop3[2]= \filter -> {|in| in+CombN.ar(RLPF.ar(in, 4000), 2.5.reciprocal, 2.5.reciprocal, 1.4)}

~pad2= {|freq= 100, amp= 0.1, lag= 1| Pan2.ar(RLPF.ar(Pulse.ar(Lag.kr(freq, lag)*[1, 2.01, 3.02, 4.03], SinOsc.kr(~tempo.kr*SinOsc.kr(0.1, 0, 3, 4), 0, 0.22, 0.5), amp).mean, freq*2, 0.3), SinOsc.kr(~tempo.kr, 0.5, 0.4))}
~pad2.set(\amp, 0.2)
~pad2.set(\amp, 0.4)

~pop2= {|freq= 200, amp= 0.1, t_trig= 0| EnvGen.kr(Env.perc(0.01, 0.3), t_trig)*LPF.ar(XFade2.ar(LFSaw.ar(freq*[1, 1.01], 0, amp).mean, Pulse.ar(freq*[1, 2.01], LFNoise2.ar(1000, 0.5, 0.5), amp).mean, SinOsc.kr(~tempo.kr/2)), 1900)}
~pop2[2]= \filter -> {|in| in+CombN.ar(RLPF.ar(in, 2000), 2.5.reciprocal, 2.5.reciprocal, 1.2)}

~pop= {|freq= 200, amp= 0.1, t_trig= 0| EnvGen.kr(Env.perc(0.01, 0.3), t_trig)*BPF.ar(XFade2.ar(LFTri.ar(freq*[1, 1.01], 0, amp).mean, Pulse.ar(freq*[1, 1.01], LFNoise2.ar(500, 0.5, 0.5), amp).mean, SinOsc.kr(~tempo.kr/3)), 300, 20)}
~pop[2]= \filter -> {|in| in+CombN.ar(RLPF.ar(in, 1000), 2.5.reciprocal, 2.5.reciprocal, 1)}

~pop3= {|freq= 200, amp= 0.1, t_trig= 0| EnvGen.kr(Env.perc(0.01, 0.3), t_trig)*BPF.ar(XFade2.ar(SinOsc.ar(freq*[1, 1.01], 0, amp).mean*SinOsc.ar(200, 0, 4), LFSaw.ar(freq*[1, 1.01], 0.5, amp).mean*SinOsc.ar(300, 0, 4), SinOsc.kr(~tempo.kr/4)), 900)}
~pop3[2]= \filter -> {|in| in+CombN.ar(RLPF.ar(in, 4000), 2.5.reciprocal, 2.5.reciprocal, 1.4)}
~pop3= {|freq= 200, amp= 0.1, t_trig= 0| EnvGen.kr(Env.perc(0.01, 0.3), t_trig)*BPF.ar(XFade2.ar(SinOsc.ar(freq*[1, 1.01], 0, amp).mean*SinOsc.ar(SinOsc.kr(~tempo.kr, 0, 100, 300), 0, 3), LFSaw.ar(freq*[1, 1.01], 0.5, amp).mean*SinOsc.ar(SinOsc.kr(~tempo.kr, pi/2, 100, 400), 0, 4), SinOsc.kr(~tempo.kr/4)), 900)}
~pop3[2]= \filter -> {|in| in+CombN.ar(RLPF.ar(in, 4000), 2.5.reciprocal, 2.5.reciprocal, 1.4)}

~pad2= {|freq= 100, amp= 0.1, lag= 1| Pan2.ar(RLPF.ar(Pulse.ar(Lag.kr(freq, lag)*[1, 2.01, 3.02, 4.03], SinOsc.kr(~tempo.kr*SinOsc.kr(0.1, 0, 3, 4), 0, 0.22, 0.5), amp).mean*LFSaw.kr(~tempo.kr), freq*2, 0.3), SinOsc.kr(~tempo.kr, 0.5, 0.4))}

~pad= {|freq= 100, amp= 0.1| Pan2.ar(RLPF.ar(LFSaw.ar(freq*[1, 2.01, 3.02, 4.03], 0, amp).mean, freq*SinOsc.kr(~tempo/2, 0, 1, 3), 0.3)*LFSaw.kr(~tempo.kr, 0.25), SinOsc.kr(~tempo.kr/2, 0, 0.8))}

~pad2.release(20)
Tdef(\pop).stop
~pad.release(20)

Tdef(\pop3).stop
~pop2.release(20)

Tdef(\pop2).stop
Tdef(\pad).isPlaying
Tdef(\pad).stop
Tdef(\pad2).stop
p.clear
p.pop