p= ProxySpace.push(s.boot)
p.makeTempoClock(114/60)
c= p.clock

//silly music4
~out.ar(2)
~out.play

~bd= {|freq= 50, amp= 0.2, t_trig= 1, dur= 0.1, scale= 100|
	var e;
	e= EnvGen.ar(Env.perc(0.01, dur), t_trig);
	Mix(SinOsc.ar(freq*#[1, 1.01, 1.02]+(e*scale), t_trig, e*amp*#[1, 0.6, 0.3]))
}

~out= ~bd
~bd.set(\t_trig, 1)
~bd.set(\t_trig, 1, \scale, 300)
~bd.set(\t_trig, 1, \scale, 3000)
~bd.set(\t_trig, 1, \scale, 10)

~d2= {|freq= 50, amp= 0.2, t_trig= 1, dur= 0.1, scale= 100|
	var e;
	e= EnvGen.ar(Env.perc(0.01, dur), t_trig);
	Mix(SinOsc.ar(freq*#[1, 2.01, 4.02]+(e*scale), t_trig, e*amp*#[1, 0.5, 0.25]))
}
~out= ~bd+~d2
~d2.set(\t_trig, 1)
~d2.set(\t_trig, 1, \scale, 200, \dur, 0.25)

~d3= {|freq= 50, amp= 0.2, t_trig= 1, dur= 0.1, scale= 100|
	var e;
	e= EnvGen.ar(Env.perc(0.01, dur), t_trig);
	Mix(SinOsc.ar(freq*#[1, 5.01, 10.02]+(e*scale), t_trig, e*amp*#[1, 0.3, 0.1]))
}
~out= ~bd+~d2+~d3
~d3.set(\t_trig, 1)
~d3.set(\t_trig, 1, \scale, 100, \dur, 0.5)

Tdef(\kit).quant_(4).play(c)
(Tdef(\kit, {
	inf.do{|i|
		if(i%4==0, {
			~bd.set(\t_trig, 1, \scale, 10)
		});
		if(i%4==1, {
			~d2.set(\t_trig, 1, \scale, 200, \dur, 0.25)
		});
		if(i%4==3, {
			~d3.set(\t_trig, 1, \scale, 100, \dur, 0.5)
		});
		1.wait;
	}
}))

(Tdef(\kit, {
	inf.do{|i|
		if(i%8==0, {
			~bd.set(\t_trig, 1, \scale, 20)
		});
		if(i%8==1, {
			~d2.set(\t_trig, 1, \scale, 400, \dur, 0.2)
		});
		if(i%8==3, {
			~d3.set(\t_trig, 1, \scale, 200, \dur, 0.3)
		});
		0.25.wait;
	}
}))

(Tdef(\kit, {
	inf.do{|i|
		if(i%8==0, {
			~bd.set(\t_trig, 1, \scale, 20)
		});
		if(i%8==1, {
			~d2.set(\t_trig, 1, \scale, 400, \dur, 0.2)
		});
		if(i%8==3||(i%3==0), {
			~d3.set(\t_trig, 1, \scale, 200+(i%32*10), \dur, 0.3)
		});
		0.25.wait;
	}
}))

(Tdef(\kit, {
	inf.do{|i|
		if(i%8==0, {
			~bd.set(\t_trig, 1, \scale, 20)
		});
		if(i%8==1||(i%16==2), {
			~d2.set(\t_trig, 1, \scale, 400-(i%2*50), \dur, [0.2, 0.5].wrapAt(i))
		});
		if(i%8==3||(i%3==0), {
			~d3.set(\t_trig, 1, \scale, 200+(i%32*10), \dur, 0.3)
		});
		0.25.wait;
	}
}))

(Tdef(\kit, {
	inf.do{|i|
		if(i%4==0||(i%32==4), {
			~bd.set(\t_trig, 1, \scale, [20, 20, 130].wrapAt(i), \dur, [0.1, 0.1, 0.05].wrapAt(i))
		});
		if(i%8==1||(i%16==2), {
			~d2.set(\t_trig, 1, \scale, 400-(i%2*50), \dur, [0.2, 0.5].wrapAt(i))
		});
		if(i%8==3||(i%3==0), {
			~d3.set(\t_trig, 1, \scale, 200+(i%32*10), \dur, 0.4-(i%32/32*0.1))
		});
		0.25.wait;
	}
}))

(Tdef(\kit, {
	inf.do{|i|
		if(i%4==0||(i%32==4), {
			~bd.set(\t_trig, 1, \scale, [20, 20, 130].wrapAt(i), \dur, [0.1, 0.1, 0.05].wrapAt(i))
		});
		if(i%8==4||(i%16==(i%3)), {
			~d2.set(\t_trig, 1, \scale, 800-(i%4*200), \dur, [0.2, 0.5].wrapAt(i))
		});
		if(i%8==3||(i%3==0), {
			~d3.set(\t_trig, 1, \scale, 200+(i%32*10), \dur, 0.4-(i%32/32*0.1))
		});
		0.25.wait;
	}
}))

(~d2= {|freq= 50, amp= 0.2, t_trig= 1, dur= 0.1, scale= 100|
	var e;
	e= EnvGen.ar(Env.perc(0.01, dur), t_trig);
	Mix(SinOsc.ar(freq*#[1, 2.02, 4.04, 8.08]+(e*scale), LFSaw.ar(20, 0, pi, pi/2), e*amp*#[1, 0.5, 0.25, 0.125]))
})

(~d3= {|freq= 50, amp= 0.2, t_trig= 1, dur= 0.1, scale= 100|
	var e;
	e= EnvGen.ar(Env.perc(0.01, dur), t_trig);
	Mix(SinOsc.ar(freq*#[1, 5.01, 10.02]+(e*scale), LFSaw.ar(20, 0, pi, pi/2), e*amp*#[1, 0.3, 0.1]))
})

(Tdef(\kit, {
	inf.do{|i|
		if(i%4==0||(i%32==4), {
			~bd.set(\t_trig, 1, \scale, [20, 20, 130].wrapAt(i), \dur, [0.1, 0.1, 0.05].wrapAt(i))
		});
		if(i%8==4||(i%16==(i%3)), {
			~d2.set(\t_trig, 1, \scale, 800-(i%4*200), \dur, [0.2, 0.5].wrapAt(i))
		});
		if(i%8==2||(i%3==0), {
			~d3.set(\t_trig, 1, \scale, 400+(i%32*10), \dur, 0.1)
		});
		0.25.wait;
	}
}))

(~d3= {|freq= 50, amp= 0.2, t_trig= 1, dur= 0.1, scale= 100|
	var e;
	e= EnvGen.ar(Env.perc(0.01, dur), t_trig);
	Mix(RLPF.ar(WhiteNoise.ar(e), freq, 0.2)+SinOsc.ar(freq*#[1, 5.01, 10.02]+(e*scale), LFSaw.ar(20, 0, pi, pi/2), e*amp*#[1, 0.3, 0.1]))
})

(~d2= {|freq= 50, amp= 0.2, t_trig= 1, dur= 0.1, scale= 100|
	var e;
	e= EnvGen.ar(Env.perc(0.01, dur), t_trig);
	Mix(RLPF.ar(WhiteNoise.ar(e*0.4), freq, 0.05)+SinOsc.ar(freq*#[1, 2.02, 4.04, 8.08]+(e*scale), LFSaw.ar(20, 0, pi, pi/2), e*amp*#[1, 0.5, 0.25, 0.125]))
})

(Tdef(\kit, {
	inf.do{|i|
		if(i%4==0||(i%32==4), {
			~bd.set(\t_trig, 1, \scale, [20, 20, 130].wrapAt(i), \dur, [0.1, 0.1, 0.05].wrapAt(i))
		});
		if(i%8==3||(i%16==(i%2)), {
			~d2.set(\t_trig, 1, \scale, 800-(i%2*200), \dur, [0.2, 0.3].wrapAt(i))
		});
		if(i%8==2||(i%3==0), {
			~d3.set(\t_trig, 1, \scale, 400+(i%32*10), \dur, 0.1)
		});
		0.25.wait;
	}
}))

(~crk= {|freq= 50, amp= 0.1, t_trig= 1, dur= 0.1, scale= 100|
	var e;
	e= EnvGen.ar(Env.perc(0.001, dur), t_trig);
	BPF.ar(ClipNoise.ar(amp*e), freq+(e*scale), 0.1);
})

~out= ~bd+~d2+~d3+~crk
~crk.set(\t_trig, 1)
~crk.set(\t_trig, 1, \scale, 1000, \amp, 1)
~crk.set(\t_trig, 1, \scale, 3000, \amp, 1)

(Tdef(\kit, {
	inf.do{|i|
		if(i%4==0||(i%32==4), {
			~bd.set(\t_trig, 1, \scale, [20, 20, 130].wrapAt(i), \dur, [0.1, 0.1, 0.05].wrapAt(i))
		});
		if(i%8==3||(i%16==(i%2)), {
			~d2.set(\t_trig, 1, \scale, 800-(i%2*200), \dur, [0.2, 0.3].wrapAt(i))
		});
		if(i%8==2||(i%3==0), {
			~d3.set(\t_trig, 1, \scale, 400+(i%32*10), \dur, 0.1)
		});
		if(i%2==1||(i%8==0), {
			~crk.set(\t_trig, 1, \scale, i%32*100+100, \dur, 0.1, \amp, 0.5)
		});
		0.25.wait;
	}
}))

(Tdef(\kit, {
	inf.do{|i|
		if(i%4==0||(i%32==4), {
			~bd.set(\t_trig, 1, \scale, [20, 20, 130].wrapAt(i), \dur, [0.1, 0.1, 0.05].wrapAt(i))
		});
		if(i%8==3||(i%16==(i%2)), {
			~d2.set(\t_trig, 1, \scale, 800-(i%2*200), \dur, [0.2, 0.3].wrapAt(i))
		});
		if(i%8==2||(i%3==0), {
			~d3.set(\t_trig, 1, \scale, 400+(i%32*10), \dur, 0.1)
		});
		if(i%2==1||(i%8==0), {
			~crk.set(\t_trig, 1, \scale, i.div(3)%32*100+100, \dur, 0.1, \amp, 0.3.rrand(0.4))
		});
		0.25.wait;
	}
}))

(Tdef(\kit, {
	inf.do{|i|
		if(i%4==0, {
			~bd.set(\t_trig, 1, \scale, 60, \dur, 0.3)
		});
		if(i%8==3||(i%16==(i%2)), {
			~d2.set(\t_trig, 1, \scale, 1000-(i%2*200), \dur, [0.2, 0.3].wrapAt(i))
		});
		if(i%8==2||(i%3==0), {
			~d3.set(\t_trig, 1, \scale, 400+(i%32*10), \dur, 0.1)
		});
		if(i%2==1||(i%8==0), {
			~crk.set(\t_trig, 1, \scale, i.div(3)%32*100+100, \dur, 0.1, \amp, 0.3.rrand(0.4))
		});
		0.25.wait;
	}
}))

(Tdef(\kit, {
	inf.do{|i|
		if(i%4==0, {
			~bd.set(\t_trig, 1, \scale, 60, \dur, 0.3)
		});
		if(i%8==3||(i%16==(i%2)), {
			~d2.set(\t_trig, 1, \scale, [1000, 1400].wrapAt(i.div(32))-(i%2*200), \dur, [0.2, 0.3].wrapAt(i))
		});
		if(i%8==2||(i%3==0), {
			~d3.set(\t_trig, 1, \scale, 400+(i%32*20), \dur, 0.1)
		});
		if(i%2==1||(i%8==0)||(i.div(16)%2==0), {
			~crk.set(\t_trig, 1, \scale, i.div(3)%32*100+100, \dur, 0.1, \amp, 0.3.rrand(0.4))
		});
		0.25.wait;
	}
}))

(~fet= {|t_trig= 0, amp= 0.1, freq= 80, dur= 0.5|
	var e;
	e= EnvGen.ar(Env.perc(0.001, dur), t_trig);
	Pan2.ar(LPF.ar(Mix(LFSaw.ar(freq*#[1, 2.02, 3.03], 0, amp*#[1, 0.5, 0.25])), freq*3), SinOsc.kr(~tempo.kr, 0, 0.5), e)
})
~out= ~bd+~d2+~d3+~crk+~fet
~fet.set(\t_trig, 1)
(~fet= {|t_trig= 0, amp= 0.5, freq= 80, dur= 0.5|
	var e;
	e= EnvGen.ar(Env.perc(0.001, dur), t_trig);
	Pan2.ar(LPF.ar(Mix(LFSaw.ar(freq*#[1, 2.02, 3.03, 4.04], 0, amp*#[1, 0.5, 0.25, 0.125])), freq*3), SinOsc.kr(~tempo.kr, 0, 0.2), e)
})
~fet.set(\t_trig, 1, \freq, 60, \dur, 2)
(~fet= {|t_trig= 0, amp= 0.5, freq= 80, dur= 0.5|
	var e;
	e= EnvGen.ar(Env.perc(0.001, dur), t_trig);
	Pan2.ar(LPF.ar(Mix(LFSaw.ar(freq*#[1, 2.02, 3.03, 4.04], 0, amp*#[1, 0.5, 0.25, 0.125]*10).clip(-0.9, 0.9)), freq*2), SinOsc.kr(~tempo.kr, 0, 0.2), e)
})
~fet.set(\t_trig, 1, \freq, 60, \dur, 2)
Tdef(\bass).quant_(4).play(c)
(Tdef(\bass, {
	inf.do{|i|
		~fet.set(\t_trig, 1, \freq, 40, \dur, 1);
		2.25.wait;
		~fet.set(\t_trig, 1, \freq, 35, \dur, 0.3);
		1.75.wait;
	}
}))

(~fet= {|t_trig= 0, amp= 0.5, freq= 80, dur= 0.5, lag= 0|
	var e;
	e= EnvGen.ar(Env.perc(0.001, dur), t_trig);
	Pan2.ar(LPF.ar(Mix(LFSaw.ar(Lag.kr(freq, lag)*#[1, 2.02, 3.03], 0, amp*#[1, 0.5, 0.25]*20).clip(-0.9, 0.9)), freq*2), SinOsc.kr(~tempo.kr, 0, 0.2), e)
})

(Tdef(\bass, {
	inf.do{|i|
		~fet.set(\t_trig, 1, \lag, 0, \freq, 40, \dur, 1);
		2.25.wait;
		~fet.set(\t_trig, 1, \lag, 0, \freq, 35, \dur, 0.3);
		(1.5-0.125).wait;
		~fet.set(\t_trig, 1, \lag, 0.4, \freq, 60, \dur, 0.15);
		0.125.wait;
		~fet.set(\t_trig, 1, \lag, 0.2, \freq, 80, \dur, 0.15);
		0.25.wait;
	}
}))

(Tdef(\bass, {
	inf.do{|i|
		~fet.set(\t_trig, 1, \lag, 0, \freq, 40, \dur, 1);
		2.25.wait;
		~fet.set(\t_trig, 1, \lag, 0, \freq, 35, \dur, 0.3);
		(1.5-0.125).wait;
		~fet.set(\t_trig, 1, \lag, 0.4, \freq, 60, \dur, 0.15);
		0.125.wait;
		~fet.set(\t_trig, 1, \lag, 0.9, \freq, [80, 100].foldAt(i.div(3)), \dur, 0.25);
		0.25.wait;
	}
}))

(Tdef(\kit, {
	inf.do{|i|
		if(i%4==0, {
			~bd.set(\t_trig, 1, \scale, [60, 70].wchoose([0.9, 0.1]), \dur, 0.3)
		});
		if(i%8==3||(i%16==(i%2)), {
			~d2.set(\t_trig, 1, \scale, [500, 1400].wrapAt(i.div(32))-(i%2*200), \dur, [0.2, 0.1].wrapAt(i))
		});
		if(i%8==2||(i%3==0), {
			~d3.set(\t_trig, 1, \scale, 400+(i%32*20), \dur, 0.1)
		});
		if(i%2==3||(i%8==0)||(i.div(8)%2==0), {
			~crk.set(\t_trig, 1, \scale, i.div(4)%32*100+100, \dur, 0.1, \amp, 0.3.rrand(0.4))
		});
		0.25.wait;
	}
}))

(Tdef(\bass, {
	inf.do{|i|
		~fet.set(\t_trig, 1, \lag, 0, \freq, [40, 40, 80].wrapAt(i), \dur, [1, 1, 0.2].wrapAt(i));
		2.25.wait;
		~fet.set(\t_trig, 1, \lag, 0, \freq, 35, \dur, 0.3);
		(1.5-0.25).wait;
		~fet.set(\t_trig, 1, \lag, 0.4, \freq, 60, \dur, 0.15);
		0.25.wait;
		~fet.set(\t_trig, 1, \lag, 0.9, \freq, [80, 100].foldAt(i.div(3)), \dur, 0.25);
		0.25.wait;
	}
}))

~pno= {|freq= 400, amp= 0.1| CombN.ar(Mix(SinOsc.ar(freq+#[0, 100, 200], 0, LFNoise0.kr(~tempo.kr*2).max(0)*amp)), 2, c.tempo/3)}
~out= ~bd+~d2+~d3+~crk+~fet+~pno
~pno.set(\freq, 300, \amp, 0.05)
~pno.set(\freq, 200, \amp, 0.05)
~pno= {|freq= 400, amp= 0.1| CombN.ar(Mix(SinOsc.ar(freq+#[0, 100, 200], 0, LFNoise0.kr(~tempo.kr*2).max(0)*amp)), 2, c.tempo/3, 3)}
~pno.quant_(4)
(~pno= {|freq= 400, amp= 0.1|
	var z;
	z= Mix(SinOsc.ar(freq+#[0, 100, 200], 0, LFNoise0.kr(~tempo.kr*2).max(0)*amp));
	z+CombN.ar(z, 2, c.tempo/3, 3)
})
(~pno= {|freq= 400, amp= 0.1|
	var z;
	z= Mix(SinOsc.ar(freq+#[0, 100, 200], 0, LFNoise0.kr(~tempo.kr*2).max(0)*10).clip(-0.9, 0.9))*amp;
	z+CombN.ar(z, 2, c.tempo/3, 3)
})

(~pno= {|freq= 400, amp= 0.1|
	var z;
	z= BPF.ar(Mix(SinOsc.ar(freq+#[0, 100, 200], 0, LFNoise0.kr(~tempo.kr*2).max(0)*3).clip(-0.9, 0.9))*amp);
	z+CombN.ar(z, 2, c.tempo/3, 3, 2)
})

~pno.set(\freq, 300)
~pno.set(\freq, 200)
~pno.set(\freq, 100)
~pno.release(10)
~fet.release(10)

Tdef(\t, {10.do{c.tempo= c.tempo*0.9; 8.wait}; \done.postln}).play

~out[2]= \filter -> {|in| Limiter.ar(in+CombN.ar(BPF.ar(in, 1000), 2, 2, 2, 2))}
~out[3]= \filter -> {|in| Limiter.ar(in+CombN.ar(BPF.ar(in, 2000), 3, 3, 3, 3))}
~out[4]= \filter -> {|in| Limiter.ar(in+CombN.ar(BPF.ar(in, 3000), 4, 4, 4, 4))}
~out[5]= \filter -> {|in| Limiter.ar(in+CombN.ar(BPF.ar(in, 4000), 5, 5, 5, 5))}

Tdef(\kit).stop
Tdef(\kit).play
Tdef(\kit).stop
Tdef(\kit).play
Tdef(\kit).stop

p.clear
p.pop