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

//no idea what to do
(SynthDef(\tinysnd, {|out= 0, amp= 0.1, dur= 0.1, pan= 0|
	var e, z;
	e= EnvGen.kr(Env.perc(0.01, dur), doneAction:2);
	z= PMOsc.ar(Rand(0, 9999), Rand(0, 9999), Rand(0, 2*pi), Rand(0, 2*pi), amp);
	Out.ar(out, Pan2.ar(e*z, pan));
}).store)

Pdef(\tiny).quant_(4).play(c)
Pdef(\tiny, Pbind(\instrument, \tinysnd))
Pdef(\tiny, Pbind(\instrument, \tinysnd, \dur, Prand([Pn(1, 16), Pseq([0.125, 0.25, 0.125], 4)], inf)))
~out.ar(2)
~out.play
~out= {var in; in= In.ar(10, 2); in+CombN.ar(BPF.ar(in), 1, 0.5, 2, 2)}
Pdef(\tiny, Pbind(\instrument, \tinysnd, \dur, Prand([Pn(1, 16), Pseq([0.125, 0.25, 0.125], 4)], inf), \pan, Pseq([0.5, 0, -0.5, 0], inf), \out, 10))

(SynthDef(\tinysnd, {|out= 0, freq= 400, amp= 0.1, dur= 0.1, pan= 0|
	var e, z;
	e= EnvGen.kr(Env.perc(0.01, dur), doneAction:2);
	z= PMOsc.ar(freq, Rand(0, 9999), Rand(0, 2*pi), Rand(0, 2*pi), amp);
	Out.ar(out, Pan2.ar(e*z, pan));
}).store)

Pdef(\tiny, Pbind(\instrument, \tinysnd, \dur, Prand([Pn(1, 16), Pseq([0.125, 0.25, 0.125], 4)], inf), \degree, Pseq(#[10, 0, 7, 0, 3], inf), \pan, Pseq([0.5, 0, -0.5, 0], inf), \out, 10))

(SynthDef(\tinysnd, {|out= 0, freq= 400, amp= 0.1, dur= 0.1, pan= 0, lag= 0.1|
	var e, z;
	e= EnvGen.kr(Env.perc(0.01, dur), doneAction:2);
	z= PMOsc.ar(Lag.kr(freq, lag), Rand(0, 9999), Rand(0, 2*pi), Rand(0, 2*pi), amp);
	Out.ar(out, Pan2.ar(e*z, pan));
}).store)

Pdef(\tiny, Pbind(\instrument, \tinysnd, \dur, Prand([Pn(1, 16), Pseq([0.125, 0.25, 0.125], 4)], inf), \degree, Pseq(#[10, 0, 7, 0, 3], inf), \pan, Pseq([0.5, 0, -0.5, 0], inf), \lag, Prand([0.5, 0], inf), \out, 10))

(SynthDef(\tinysnd, {|out= 0, freq= 400, amp= 0.1, dur= 0.1, pan= 0, lag= 0.1|
	var e, z;
	e= EnvGen.kr(Env.perc(0.01, dur), doneAction:2);
	z= PMOsc.ar(Lag.kr(freq, lag), freq+Rand(freq/2, freq), Rand(0, 2*pi), Rand(0, 2*pi), amp);
	Out.ar(out, Pan2.ar(e*z, pan));
}).store)

Pdef(\tiny2).quant_(4).play(c)
Pdef(\tiny2, Pbind(\instrument, \tinysnd, \dur, Pseq([1/3, 2/3], inf), \octave, 4, \degree, Pseq(#[10, 0, 7, 0, 3], inf), \pan, Pseq([0.5, 0, -0.5, 0], inf), \lag, 0.1, \out, 10))

Pdef(\tiny2, Pbind(\instrument, \tinysnd, \dur, Pseq([1/3, 2/3]*2, inf), \octave, 7, \degree, Pseq(#[10, 0, 7, 0, 3], inf), \pan, Pseq([0.5, 0, -0.5, 0], inf), \lag, 0.4, \out, 0))

(SynthDef(\tinysnd, {|out= 0, freq= 400, amp= 0.1, dur= 0.1, pan= 0, lag= 0.1|
	var e, z;
	e= EnvGen.kr(Env.perc(0.01, dur, Rand(-5, 5)), doneAction:2);
	z= PMOsc.ar(Lag.kr(freq, lag), Rand(0, 9999).round(freq/2), SinOsc.ar(LinRand(0, 10), 0, pi, pi), Rand(0, 2*pi), amp);
	Out.ar(out, Pan2.ar(e*z, pan));
}).store)

Pdef(\tiny3).quant_(4).play(c)
Pdef(\tiny3, Pbind(\instrument, \tinysnd, \dur, Pseq([4, 8], inf), \octave, 2, \degree, Pseq(#[10, 0, 7, 0, 3], inf), \pan, Pseq([0.5, 0, -0.5, 0], inf), \lag, 1, \out, 0))

Pdef(\tiny3, Pbind(\instrument, \tinysnd, \dur, Pseq([4, 8], inf), \octave, 2, \degree, Pseq(#[10, 0, 7, 0, 3], inf), \pan, 0, \amp, 0.2, \lag, 1, \out, 0))

(SynthDef(\tinysnd, {|out= 0, freq= 400, amp= 0.1, dur= 0.1, pan= 0, lag= 0.1|
	var e, z;
	e= EnvGen.kr(Env.perc(0.01, dur, Rand(-5, 5)), doneAction:2);
	z= PMOsc.ar(Lag.kr(freq, lag), Rand(0, 9999).round(freq/2), SinOsc.ar(LinRand(0, 10).round(~tempo.kr), 0, pi, pi), SinOsc.ar(LinRand(0, 10).round(~tempo.kr), 0, pi, pi), amp);
	Out.ar(out, Pan2.ar(e*z, pan));
}).store)

~out= {var in; in= In.ar(10, 2); in+CombL.ar(BPF.ar(in, SinOsc.ar(~tempo.kr/4, 0, 100, 940), 0.5), 1, ~tempo.kr, 2, 2)}

~out= {var in; in= In.ar(10, 2); in+CombL.ar(BPF.ar(in*SinOsc.ar(300), SinOsc.ar(~tempo.kr/4, 0, 100, 940), 0.5), 1, ~tempo.kr, 2, 2)}

Pdef(\grain).quant_(4).play(c)
Pdef(\grain, Pbind(\instrument, \tinysnd, \dur, Pseq([Pn(0.1, 20), 10], inf), \octave, 4, \degree, Pseq(#[10, 0, 7, 0, 3], inf), \pan, Pseq([-0.9, 0.9], inf), \lag, 0, \out, 0))
Pdef(\grain, Pbind(\instrument, \tinysnd, \dur, Pseq([Pn(0.05, 20), 10], inf), \octave, 5, \degree, Pseq(#[10, 0, 7, 0, 3], inf), \pan, Pseq([-0.9, 0.9], inf), \lag, 0, \out, 0))
Pdef(\grain, Pbind(\instrument, \tinysnd, \dur, Pseq([Pn(0.025, 20), 10], inf), \octave, 6, \degree, Pseq(#[10, 0, 7, 0, 3], inf), \pan, Pseq([-0.9, 0.9], inf), \lag, 0, \out, 0))
Pdef(\grain, Pbind(\instrument, \tinysnd, \dur, Pseq([Pn(0.0125, 20), 10], inf), \octave, 7, \degree, Pseq(#[10, 0, 7, 0, 3], inf), \pan, Pseq([-0.9, 0.9], inf), \lag, 0, \out, 0))
Pdef(\grain, Pbind(\instrument, \tinysnd, \dur, Pseq([Pn(0.0125/2, 20), 10], inf), \octave, 8, \degree, Pseq(#[10, 0, 7, 0, 3], inf), \pan, Pseq([-0.9, 0.9], inf), \lag, 0, \out, 0))
Pdef(\grain, Pbind(\instrument, \tinysnd, \dur, Pseq([Pn(0.0125/2, 40), 10], inf), \octave, Pseq([3, 7, 8], inf), \degree, Pseq(#[10, 0, 7, 0, 3], inf), \pan, Pseq([-0.9, 0.9], inf), \lag, 0, \out, 10))

Pdef(\tick).quant_(4).play(c)
Pdef(\tick, Pbind(\instrument, \tinysnd, \dur, 1, \degree, 0, \lag, 0, \out, 0))
Pdef(\tick, Pbind(\instrument, \tinysnd, \dur, Pseq(#[1, 1, 1, 0.5, 0.5], inf), \degree, Pseq(#[0, 0, 0, -4, 2], inf), \lag, Pseq([0, 0, 0, 1, 1], inf), \out, 10))

~out2= {|freq= 400| In.ar(12, 2)*SinOsc.ar(freq*#[1, 1.01])};
~out2.play

Pdef(\tick, Pbind(\instrument, \tinysnd, \dur, Pseq(#[1, 1, 1, 0.5, 0.5], inf), \degree, Pseq(#[0, 0, 0, -4, 2], inf), \lag, Pseq([0, 0, 0, 1, 1], inf), \out, Prand([10, 12], inf)))

Tdef(\efx).quant_(4).play(c)
Tdef(\efx, {inf.do{|i| ~out2.set(\freq, i%4*100+400); 4.wait}})

Pdef(\grain, Pbind(\instrument, \tinysnd, \dur, Pseq([Pn(0.0125/2, 40), 10], inf), \octave, Pseq([3, 7, 8], inf), \degree, Pseq(#[10, 0, 7, 0, 3], inf), \pan, Pseq([-0.9, 0.9], inf), \lag, 0, \out, Pwrand([10, 12], [0.9, 0.1], inf)))

(SynthDef(\tinysnd, {|out= 0, freq= 400, amp= 0.1, dur= 0.1, pan= 0, lag= 0.1|
	var e, z;
	e= EnvGen.kr(Env.perc(0.01, dur, Rand(-5, 5)), doneAction:2);
	z= PMOsc.ar(Lag.kr(freq, lag), Rand(0, 9999).round(freq/2), SinOsc.ar(LinRand(0, 50).round(~tempo.kr), 0, pi, pi), SinOsc.ar(LinRand(0, 50).round(~tempo.kr), 0, pi, pi), amp);
	Out.ar(out, Pan2.ar(e*z, pan));
}).store)

(SynthDef(\tinysnd, {|out= 0, freq= 400, amp= 0.1, dur= 0.1, pan= 0, lag= 0.1|
	var e, z;
	e= EnvGen.kr(Env.perc(0.001, dur, Rand(-5, 5)), doneAction:2);
	z= PMOsc.ar(Lag.kr(freq, lag), Rand(0, 5000).round(freq), SinOsc.ar(LinRand(0, 50).round(~tempo.kr), 0, pi, pi), SinOsc.ar(LinRand(0, 50).round(~tempo.kr), 0, pi, pi), amp);
	Out.ar(out, Pan2.ar(e*z, pan));
}).store)

(SynthDef(\tinysnd, {|out= 0, freq= 400, amp= 0.1, dur= 0.1, pan= 0, lag= 0.1|
	var e, z;
	e= EnvGen.kr(Env.perc(0.001, dur, Rand(-5, 5)), doneAction:2);
	z= PMOsc.ar(Lag.kr(freq, lag)*SinOsc.ar(IRand(0, 2), 0, 0.1, 1), Rand(0, 5000).round(freq/4), SinOsc.ar(LinRand(0, 50).round(~tempo.kr), 0, pi, pi), SinOsc.ar(LinRand(0, 50).round(~tempo.kr), 0, pi, pi), amp);
	Out.ar(out, Pan2.ar(e*z, pan));
}).store)

~out= {|freq= 400| var in; in= In.ar(10, 2); in+CombL.ar(BPF.ar(in*SinOsc.ar(freq), SinOsc.ar(~tempo.kr/4, 0, 100, 940), 0.5), 1, ~tempo.kr, 2, 2)}
Tdef(\efx, {inf.do{|i| ~out.set(\freq, i%6*100+400); ~out2.set(\freq, i%4*100+400); 4.wait}})

~out3= {|freq= 800, round= 0.01| BPF.ar(In.ar(14, 2).round(round), freq)}
~out3.play

Pdef(\grain, Pbind(\instrument, \tinysnd, \dur, Pseq([Pn(0.0125/2, 40), 10], inf), \octave, Pseq([3, 7, 8], inf), \degree, Pseq(#[10, 0, 7, 0, 3], inf), \pan, Pseq([-0.9, 0.9], inf), \lag, 0, \out, Pwrand([10, 12, 14], [0.8, 0.1, 0.1], inf)))

Pdef(\tick, Pbind(\instrument, \tinysnd, \dur, Pseq(#[1, 1, 1, 0.5, 0.5], inf), \degree, Pseq(#[0, 0, 0, -4, 2], inf), \lag, Pseq([0, 0, 0, 1, 1], inf), \out, Prand([10, 12, 14], inf)))

Tdef(\efx, {inf.do{|i| ~out.set(\freq, i%6*100+400); ~out2.set(\freq, i%4*100+400); ~out3.set(\freq, i%2*100+400, \round, 0.1.rand); 4.wait}})

Pdef(\tiny2, Pbind(\instrument, \tinysnd, \dur, Pseq([1/3, 2/3]*2, inf), \octave, 7, \degree, Pseq(#[10, 0, 7, 0, 3], inf), \pan, Pseq([0.5, 0, -0.5, 0], inf), \lag, 0.4, \out, Pseq([0, 14], inf)))

Tdef(\efx, {inf.do{|i| ~out.set(\freq, i%6*100+400); ~out2.set(\freq, i%4*100+400); ~out3.set(\freq, i%2*1000+1000, \round, 0.4.rand); 4.wait}})

(~mel= {|freq= 1000, amp= 0.1, lag= 0.1, t_trig= 0|
	EnvGen.kr(Env.perc, t_trig)*Pan2.ar(BPF.ar(Mix(LFSaw.ar(Lag.kr(freq, lag)*#[1, 2.01], 0, amp*#[1, 0.5])), freq*3))
})

~mel.play	
~mel.set(\t_trig, 1)
~mel.set(\t_trig, 1, \freq, 1400)
Tdef(\mel).quant_(4).play(c)
(Tdef(\mel, {
	var f;
	f= Pseq([1400, 1100, 1300, 1500], inf).asStream;
	inf.do{|i|
		~mel.set(\t_trig, 1, \freq, f.next);
		1.wait;
	}
}))

(Tdef(\mel, {
	var f, d;
	f= Pseq([1400, 1100, 1300, 1500], inf).asStream;
	d= Pseq([0.5, 0.5, 1, 1, 4, 1, 1, 1, 4], inf).asStream;
	inf.do{|i|
		~mel.set(\t_trig, 1, \freq, f.next);
		d.next.wait;
	}
}))

(Tdef(\mel, {
	var f, d;
	f= Pseq(#[1400, 1100, 1300, 1500]/2, inf).asStream;
	d= Pseq(#[0.5, 0.5, 1, 1, 4, 1, 1, 1, 4], inf).asStream;
	inf.do{|i|
		~mel.set(\t_trig, 1, \freq, f.next);
		d.next.wait;
	}
}))

(Tdef(\mel, {
	var f, d;
	f= Pseq(#[1400, 1100, 1300, 1500]/10, inf).asStream;
	d= Pseq(#[0.5, 0.5, 1, 1, 4, 1, 1, 1, 4], inf).asStream;
	inf.do{|i|
		~mel.set(\t_trig, 1, \freq, f.next, \amp, 0.4, \lag, 0.05.rrand(0.15));
		d.next.wait;
	}
}))

(Tdef(\mel, {
	var f, d;
	f= Pseq(#[1400, 1100, 1300, 1500]/10, inf).asStream;
	d= Pseq(#[0.5, 0.5, 1, 1, 4, 1, 1, 1, 4], inf).asStream;
	inf.do{|i|
		var dur;
		dur= d.next;
		~mel.set(\t_trig, 1, \freq, f.next, \amp, 0.4, \lag, 0.05.rrand(0.15));
		dur.wait;
	}
}))

(~mel= {|freq= 1000, amp= 0.1, lag= 0.1, t_trig= 0, dur= 1|
	var e;
	e= EnvGen.kr(Env.perc(0.001, dur), t_trig);
	e*Pan2.ar(BPF.ar(Mix(LFSaw.ar(Lag.kr(freq, lag)*#[1, 2.01, 3.03], 0, amp*#[2, 1, 0.5])), freq*3*e+300, 0.2))
})

(Tdef(\mel, {
	var f, d;
	f= Pseq(#[1400, 1100, 1300, 1500]/20, inf).asStream;
	d= Pseq(#[0.5, 0.5, 1, 1, 4, 1, 1, 1, 4], inf).asStream;
	inf.do{|i|
		var dur;
		dur= d.next;
		~mel.set(\t_trig, 1, \freq, f.next, \amp, 0.4, \lag, 0.05.rrand(0.15), \dur, dur.min(2));
		dur.wait;
	}
}))

(~mel= {|freq= 1000, amp= 0.1, lag= 0.1, t_trig= 0, dur= 1|
	var e;
	e= EnvGen.kr(Env.perc(0.001, dur), t_trig);
	e*Pan2.ar(RLPF.ar(Mix(PinkNoise.ar(e*0.1)+LFSaw.ar(Lag.kr(freq, lag)*#[1, 2.01, 3.03], 0, amp*#[1, 0.5, 0.25])), freq*3*e+200, 0.2))
})

(Tdef(\mel, {
	var f, d;
	f= Pseq((#[1400, 1000, 1300, 1400]/30).stutter, inf).asStream;
	d= Pseq(#[0.25, 0.25]++[0.5, 0.25, 0.25, 4, 1, 1].scramble, inf).asStream;
	inf.do{|i|
		var dur;
		dur= d.next;
		~mel.set(\t_trig, 1, \freq, f.next, \amp, 0.4, \lag, 0.05.rrand(0.5), \dur, dur.min(2));
		dur.wait;
	}
}))

~bd= {|t_trig= 0, amp= 0.1| EnvGen.kr(Env.perc(0.001, 0.1), t_trig)*Pan2.ar(Mix(SinOsc.ar([60, 80], 0, amp)))}
~bd.play
~bd.set(\t_trig, 1, \amp, 1)
Tdef(\bd).quant_(4).play(c)
Tdef(\bd, {inf.do{|i| ~bd.set(\t_trig, 1, \amp, 0.7.rrand(0.9)); 1.wait}})
(Tdef(\bd, {
	var d;
	d= Pseq([1, 1, 1, 1, Prand([1, Pn(0.5, 2), Pseq([0.25, 0.5, 0.25], 1)], 1)], inf).asStream;
	inf.do{|i| ~bd.set(\t_trig, 1, \amp, 0.7.rrand(0.9)); d.next.wait}
}))

(Tdef(\mel, {
	var g, f, d;
	f= {Pseq((#[1400, 1000, 1300, 1400]/30).stutter, inf)};
	g= Prand([f.value, f.value, f.value], inf).asStream;
	d= Pseq(#[0.25, 0.25]++[0.5, 0.25, 0.25, 4, 1, 1].scramble, inf).asStream;
	inf.do{|i|
		var dur;
		dur= d.next;
		~mel.set(\t_trig, 1, \freq, g.next, \amp, 0.4, \lag, 0.05.rrand(0.5), \dur, dur.min(2));
		dur.wait;
	}
}))

Tdef(\efx, {inf.do{|i| ~out.set(\freq, i%2*1000+400); ~out2.set(\freq, i%4*1000+800); ~out3.set(\freq, i%4*1000+100, \round, 0.8.rand); 4.wait}})

Pdef(\tiny2, Pbind(\instrument, \tinysnd, \dur, Pseq([1/3, 2/3], inf), \octave, 7, \degree, Pseq(#[10, 0, 7, 0, 3], inf), \pan, Pseq([0.5, 0, -0.5, 0], inf), \lag, 0.4, \out, 14))

Pdef(\tick, Pbind(\instrument, \tinysnd, \dur, Pseq(#[1, 1, 1, 0.5, 0.5], inf), \degree, Pseq(#[0, 0, 0, -4, 2], inf), \lag, Pseq([0, 0, 0, 1, 1], inf), \out, 14))

Pdef(\grain, Pbind(\instrument, \tinysnd, \dur, Pseq([Pn(0.0125, 40), 10], inf), \octave, Pseq([3, 7, 8], inf), \degree, Pseq(#[10, 0, 7, 0, 3], inf), \pan, Pseq([-0.9, 0.9], inf), \lag, 1, \out, 0))

Pdef(\tiny3, Pbind(\instrument, \tinysnd, \dur, Pseq([4, 8], inf), \octave, 8, \degree, Pseq(#[10, 0, 7, 0, 3], inf), \pan, 0, \amp, 0.1, \lag, 10, \out, 14))

Pdef(\tiny2, Pbind(\instrument, \tinysnd, \dur, Pseq([1/3, 2/3]*0.5, inf), \octave, 7, \degree, Pseq(#[10, 0, 7, 0, 3], inf), \pan, Pseq([0.5, 0, -0.5, 0], inf), \lag, 3, \out, 14))

c.tempo_(c.tempo*1.1)
c.tempo

//drastic change
(SynthDef(\tinysnd, {|out= 0, freq= 400, amp= 0.1, dur= 0.1, pan= 0, lag= 0.1|
	var e, z;
	e= EnvGen.kr(Env.perc(0.001, dur, Rand(-5, 5)), doneAction:2);
	z= SinOsc.ar(freq, 0, amp);
	Out.ar(out, Pan2.ar(e*z, pan));
}).store)

//back
(SynthDef(\tinysnd, {|out= 0, freq= 400, amp= 0.1, dur= 0.1, pan= 0, lag= 0.1|
	var e, z;
	e= EnvGen.kr(Env.perc(0.001, dur, Rand(-5, 5)), doneAction:2);
	z= PMOsc.ar(Lag.kr(freq, lag)*SinOsc.ar(IRand(0, 2), 0, 0.1, 1), Rand(0, 5000).round(freq/4), SinOsc.ar(LinRand(0, 50).round(~tempo.kr), 0, pi, pi), SinOsc.ar(LinRand(0, 50).round(~tempo.kr), 0, pi, pi), amp);
	Out.ar(out, Pan2.ar(e*z, pan));
}).store)

(SynthDef(\tinysnd, {|out= 0, freq= 400, amp= 0.1, dur= 0.1, pan= 0, lag= 0.1|
	var e, z;
	e= EnvGen.kr(Env.perc(0.001, dur, Rand(-5, 5)), doneAction:2);
	z= SinOsc.ar(Lag.kr(freq, lag), 0, amp*SinOsc.kr(~tempo.kr).abs);
	Out.ar(out, Pan2.ar(e*z, pan));
}).store)

(Tdef(\mel, {
	var g, f, d;
	f= {Pseq((#[1400, 1000, 1300, 1400]/30).stutter, inf)};
	g= Prand([f.value, f.value, f.value], inf).asStream;
	d= Pseq(#[0.25, 0.25]++[0.5, 0.25, 0.25, 4, 1, 1].scramble, inf).asStream;
	inf.do{|i|
		var dur;
		dur= d.next;
		~mel.set(\t_trig, [1, 0].choose, \freq, g.next, \amp, 0.4, \lag, 0.05.rrand(0.5), \dur, dur.min(2));
		dur.wait;
	}
}))

Tdef(\mel).stop
Tdef(\bd).stop

~out2.release(20)
~out3.release(20)
~out.release(20)

(SynthDef(\tinysnd, {|out= 0, freq= 400, amp= 0.1, dur= 0.1, pan= 0, lag= 0.1|
	var e, z;
	e= EnvGen.kr(Env.perc(0.001, dur, Rand(-5, 5)), doneAction:2);
	z= SinOsc.ar(Lag.kr(freq, lag), 0, amp*SinOsc.kr(~tempo.kr/2).abs);
	z= z+CombN.ar(z);
	Out.ar(out, Pan2.ar(e*z, pan));
}).store)

(SynthDef(\tinysnd, {|out= 0, freq= 400, amp= 0.1, dur= 0.1, pan= 0, lag= 0.1|
	var e, z;
	e= EnvGen.kr(Env.perc(0.001, dur, Rand(-5, 5)), doneAction:2);
	z= SinOsc.ar(Lag.kr(freq/2, lag), 0, amp*SinOsc.kr(~tempo.kr/2).abs);
	z= z+CombN.ar(z);
	Out.ar(out, Pan2.ar(e*z, pan));
}).store)

Tdef(\grain).stop
Tdef(\tinysnd).stop
Tdef(\tick).stop
Tdef(\efx).stop
~mel.release
~bd.release
p.clear
p.pop