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

//--swing
(~bass= {|freq= 60, t_trig= 0, amp= 0.1|
	var e;
	e= EnvGen.ar(Env.perc, t_trig);
	Pan2.ar(SinOsc.ar(freq, 0, amp)*e, 0);
})
~bass.play
~bass.set(\t_trig, 1)
Tdef(\bass).quant_(4).play(c)
(Tdef(\bass, {
	var dur= Pseq([0.65, 0.35], inf).asStream;
	inf.do{|i|
		~bass.set(\t_trig, 1);
		dur.next.wait;
	}
}))

(Tdef(\bass, {
	var dur, fre;
	dur= Pseq([Pseq([0.65, 0.35], 5), 1, 1, 1], inf).asStream;
	fre= Pseq([Pn(60, 10), 40, 50, 60], inf).asStream;
	inf.do{|i|
		~bass.set(\t_trig, 1, \freq, fre.next);
		dur.next.wait;
	}
}))

(Tdef(\bass, {
	var dur, fre;
	dur= Pseq([Pseq([0.65, 0.35], 5), 1, 1, 0.65, 0.35], inf).asStream;
	fre= Pseq([Pn(60, 10), 40, 50, 55, 40], inf).asStream;
	inf.do{|i|
		~bass.set(\t_trig, 1, \freq, fre.next);
		dur.next.wait;
	}
}))

(~pno= {|t_trig= 0, freq= 400, amp= 0.1|
	var e= EnvGen.ar(Env.perc(0.05, 1), t_trig);
	SinOsc.ar(freq*#[1, 1.01], 0, amp)*e
})
~pno.play
~pno.set(\t_trig, 1)
(~pno= {|t_trig= 0, freq= 400, amp= 0.05, dur= 1|
	var e= EnvGen.ar(Env.perc(0.001, dur, 1, 0), t_trig);
	Pan2.ar(Mix(SinOsc.ar(freq*#[1, 1.01, 2.02, 3.03], 0, amp)))*e
})

~pno.set(\t_trig, 1)
~pno.set(\t_trig, 1, \freq, 200)
Tdef(\pno).quant_(4).play(c)
(Tdef(\pno, {
	var dur, fre;
	dur= Pseq([4.65, 6, 5.35], inf).asStream;
	inf.do{|i|
		~pno.set(\t_trig, 1, \freq, 200);
		dur.next.wait;
	}
}))
[4.65, 6, 5.35].sum
(Tdef(\pno, {
	var dur, fre;
	dur= Pseq([4.65, 6, 5.35], inf).asStream;
	fre= Pseq([200, 250, 600], inf).asStream;
	inf.do{|i|
		var d;
		d= dur.next;
		~pno.set(\t_trig, 1, \freq, fre.next, \dur, d, \amp, 0.01);
		d.wait;
	}
}))

(~pno= {|t_trig= 0, freq= 400, amp= 0.05, dur= 1|
	var e= EnvGen.ar(Env.perc(0.001, dur, 1, -4), t_trig);
	Pan2.ar(Mix(LPF.ar(Saw.ar(freq*#[1, 1.01, 2.02, 3.03], amp))))*e
})
(~pno2= {|t_trig= 0, freq= 400, amp= 0.05, dur= 1|
	var e= EnvGen.ar(Env.perc(0.001, dur, 1, -4), t_trig);
	Pan2.ar(Mix(LPF.ar(Saw.ar(freq*#[1, 1.01, 2.02, 3.03], amp))))*e
})
~pno2.play
(Tdef(\pno, {
	var dur, fre;
	dur= Pseq([4.65, 6, 5.35], inf).asStream;
	fre= Pseq([[0, 5], [3, 5], [2, 5]], inf).asStream;
	inf.do{|i|
		var d, f;
		d= dur.next;
		f= (fre.next+60).midicps;
		~pno.set(\t_trig, 1, \freq, f[0], \dur, d, \amp, 0.01);
		~pno2.set(\t_trig, 1, \freq, f[1], \dur, d, \amp, 0.01);
		d.wait;
	}
}))

(~pno3= {|t_trig= 0, freq= 400, amp= 0.05, dur= 1|
	var e= EnvGen.ar(Env.perc(0.001, dur, 1, -4), t_trig);
	Pan2.ar(Mix(LPF.ar(Saw.ar(freq*#[1, 1.01, 2.02, 3.03], amp))))*e
})
~pno3.play

(Tdef(\pno, {
	var dur, fre;
	dur= Pseq([4.65, 4, 4.35, 3], inf).asStream;
	fre= Pseq([[0, 5, 7], [3, 5, 7], [2, 5, 9], [1, 5, 9]], inf).asStream;
	inf.do{|i|
		var d, f;
		d= dur.next;
		f= (fre.next+60).midicps;
		~pno.set(\t_trig, 1, \freq, f[0], \dur, d, \amp, 0.01);
		~pno2.set(\t_trig, 1, \freq, f[1], \dur, d, \amp, 0.01);
		~pno3.set(\t_trig, 1, \freq, f[2], \dur, d, \amp, 0.01);
		d.wait;
	}
}))
Tdef(\pno).quant
[4.65, 4, 4.35, 3].sum

(~plastsax= {|t_trig= 0, amp= 0.1, freq= 400, dur= 1|
	var e= EnvGen.ar(Env.perc(0.1, dur), t_trig);
	Pan2.ar(BPF.ar(Mix(Saw.ar(freq*[1, 2, 3, 4], amp)))*e);
})
~plastsax.play
~plastsax.set(\t_trig, 1)
~plastsax.set(\t_trig, 1, \amp, 0.01)
(~plastsax= {|t_trig= 0, amp= 0.1, freq= 400, dur= 1|
	var e= EnvGen.ar(Env.perc(0.2, dur), t_trig);
	Pan2.ar(BPF.ar(Mix(Saw.ar(freq*([1]++([2, 3, 4]*(e*0.1+1))), amp)))*e);
})

Tdef(\sax).quant_(4).play(c)
(Tdef(\sax, {
	var dur, fre;
	dur= Pseq([Pseq([0.65, 0.35], 8), 1, 2, 4, 8], inf).asStream;
	fre= Pseq([0, 10, 3, 5, 6, 6], inf).asStream;
	inf.do{|i|
		var d, f;
		d= dur.next;
		f= (fre.next+72).midicps;
		~plastsax.set(\t_trig, 1, \freq, f, \dur, d, \amp, 0.01);
		d.wait;
	}
}))

(~plastsax= {|t_trig= 0, amp= 0.1, freq= 400, dur= 1|
	var e= EnvGen.ar(Env.perc(0.2, dur), t_trig);
	Pan2.ar(LPF.ar(Mix(LFTri.ar(freq*([1]++([2, 3, 4]*(e*0.04+1))), 0, amp)), 900)*e);
})

(~plastsax= {|t_trig= 0, amp= 0.1, freq= 400, dur= 1|
	var e, e2;
	e= EnvGen.ar(Env.perc(0.2, dur), t_trig);
	e2= EnvGen.ar(Env.perc(0, 0.15), t_trig);
	Pan2.ar(LPF.ar(SinOsc.ar(freq*3, SinOsc.ar(150*e, 0, pi*2), amp*e2)+SinOsc.ar(freq*2, 0, amp*e2)+Mix(LFTri.ar(freq*([1]++([3, 5, 7]*(e*0.02+1))), 0, amp)), 900)*e);
})

(Tdef(\sax, {
	var dur, fre, tra;
	dur= Pseq([Pseq([0.65, 0.35], 8), 1, 2, 4, 9], inf).asStream;
	fre= Pseq([0, 10, 3, 5, 6, 6], inf).asStream;
	tra= Pseq([Pn(-90, 20), Pn(-4, 20), Pn(0, 20)], inf).asStream;
	inf.do{|i|
		var d, f, t;
		d= dur.next;
		t= tra.next;
		f= (fre.next+60+t).midicps;
		~plastsax.set(\t_trig, 1, \freq, f, \dur, d, \amp, 0.01);
		d.wait;
	}
}))

~perc.play
(~perc= {|t_trig= 0, amp= 0.1|
	var e;
	e= EnvGen.ar(Env.perc(0.01, 0.2), t_trig);
	Pan2.ar(Mix(SinOsc.ar([900, 909], SinOsc.ar(50), amp*e)))
})
~perc.set(\t_trig, 1)
~perc.set(\amp, 0.02)
~perc.set(\t_trig, 1)

(Tdef(\perc, {
	var dur;
	dur= Pseq([Pseq([1/3], 9), 1], inf).asStream;
	inf.do{|i|
		var d;
		d= dur.next;
		~perc.set(\t_trig, 1, \amp, 0.02.rand);
		d.wait;
	}
}))
Tdef(\perc).quant_(4).play(c)

(Tdef(\perc, {
	var dur;
	dur= Pseq([Pseq([1/3], 9), 1], inf).asStream;
	inf.do{|i|
		var d;
		d= dur.next;
		~perc.set(\t_trig, 1, \amp, 0.01.rand);
		d.wait;
	}
}))

(~efx= {
	var in;
	in= In.ar(0, 2);
	CombL.ar(in, 1, ~tempo.kr/2, 1, 0.9, in);
})
~efx.play
(~efx= {
	var in;
	in= In.ar(0, 2);
	CombL.ar(in, 1, ~tempo.kr/3, 1, 0.7);
})

//awful.  how to fix?

(Tdef(\sax, {
	var dur, fre, tra;
	dur= Pseq([Pseq([0.65, 0.35]*4, 8), 1, 2, 4, 9], inf).asStream;
	fre= Pseq([0, 6, 0, 5, 6, 6], inf).asStream;
	tra= Pseq([Pn(0, 8), Pn(-4, 8), Pn(0, 8)], inf).asStream;
	inf.do{|i|
		var d, f, t;
		d= dur.next;
		t= tra.next;
		f= (fre.next+60+t).midicps;
		~plastsax.set(\t_trig, 1, \freq, f, \dur, d, \amp, 0.01);
		d.wait;
	}
}))

(~plastsax= {|t_trig= 0, amp= 0.1, freq= 400, dur= 1|
	var e, e2;
	e= EnvGen.ar(Env.perc(0.2, dur), t_trig);
	e2= EnvGen.ar(Env.perc(0, 0.5), t_trig);
	Pan2.ar(RLPF.ar(SinOsc.ar(freq*3, SinOsc.ar(900*e, 0, pi*2), amp*e2)+SinOsc.ar(freq*2, 0, amp*e2)+Mix(LFTri.ar(Lag.kr(freq, 1)*([1]++([3, 5, 7]*(e*0.02+1))), 0, amp*[1, 0.8, 0.6, 0.4])), LFNoise0.kr(~tempo.kr/2, 200, 800))*e);
})

(Tdef(\sax, {
	var dur, fre, tra;
	dur= Pseq([Pseq([0.65, 0.35]*4, 4), 1, 2, 4, 9], inf).asStream;
	fre= Pseq([0, 6, 0, 5, 6, 6], inf).asStream;
	tra= Pseq([Pn(0, 8), Pn(-4, 8), Pn(0, 8)], inf).asStream;
	inf.do{|i|
		var d, f, t;
		d= dur.next;
		t= tra.next;
		f= (fre.next+60+t).midicps;
		~plastsax.set(\t_trig, 1, \freq, f, \dur, d, \amp, 0.01);
		d.wait;
	}
}))

(Tdef(\perc, {
	var dur;
	dur= Pseq([Pseq([1/3], 9), Prand([1, 1, Pn(0.25, 4), Pn(1/6, 6)], 1)], inf).asStream;
	inf.do{|i|
		var d;
		d= dur.next;
		~perc.set(\t_trig, 1, \amp, 0.01.rand);
		d.wait;
	}
}))
(~perc= {|t_trig= 0, amp= 0.1|
	var e;
	e= EnvGen.ar(Env.perc(0.01, 0.2), t_trig);
	Pan2.ar(Mix(SinOsc.ar([900, 909]+LFNoise0.kr(~tempo.kr/2, 0, 100, 900).round(100), SinOsc.ar(50), amp*e)), SinOsc.ar(~tempo.kr/3, 0, 0.4))
})

(Tdef(\pno, {
	var dur, fre;
	dur= Pseq([4.65, 4, 4.35, 3], inf).asStream;
	fre= Prand([Pseq([[0, 5, 7], [3, 5, 7], [2, 5, 9], [1, 5, 9]], 1), Pseq([[0, 7, 10]], 2)], inf).asStream;
	inf.do{|i|
		var d, f;
		d= dur.next;
		f= (fre.next+60).midicps;
		~pno.set(\t_trig, 1, \freq, f[0], \dur, d, \amp, 0.015);
		~pno2.set(\t_trig, 1, \freq, f[1], \dur, d, \amp, 0.013);
		~pno3.set(\t_trig, 1, \freq, f[2], \dur, d, \amp, 0.011);
		d.wait;
	}
}))

Tdef(\bass).stop
(~perc= {|t_trig= 0, amp= 0.1|
	var e;
	e= EnvGen.ar(Env.perc(0.01, 0.1), t_trig);
	Pan2.ar(Mix(SinOsc.ar([900, 909]+SinOsc.kr(~tempo.kr/2, 0, 100).round(100), SinOsc.ar(50), amp*e)), SinOsc.ar(~tempo.kr/3, 0, 0.4))
})
(~perc= {|t_trig= 0, amp= 0.1|
	var e;
	e= EnvGen.ar(Env.perc(0.01, 0.1), t_trig);
	Pan2.ar(Mix(SinOsc.ar([900, 909]+SinOsc.kr(~tempo.kr/4, 0, 120).round(100), SinOsc.ar(50, 0, pi*SinOsc.kr(~tempo/3, 0, 0.5, 0.5)), amp*e)), SinOsc.ar(~tempo.kr/3, 0, 0.4))
})
Tdef(\sax).stop

Tdef(\bass).play(c)
(~bass= {|freq= 60, t_trig= 0, amp= 0.1|
	var e;
	e= EnvGen.ar(Env.perc, t_trig);
	Pan2.ar(SinOsc.ar(freq, SinOsc.ar(~tempo.kr, 0, pi*2), amp)*e, 0);
})
(~bass= {|freq= 60, t_trig= 0, amp= 0.1|
	var e;
	e= EnvGen.ar(Env.perc, t_trig);
	Pan2.ar(SinOsc.ar(freq+(1-e*10), SinOsc.ar(~tempo.kr, 0, pi*2), amp)*e, 0);
})

(~bass= {|freq= 60, t_trig= 0, amp= 0.1|
	var e;
	e= EnvGen.ar(Env.perc, t_trig);
	Pan2.ar(SinOsc.ar(freq+(1-e*30), SinOsc.ar(~tempo.kr, e*pi, pi*2), amp)*e, 0);
})
(~bass= {|freq= 60, t_trig= 0, amp= 0.1|
	var e;
	e= EnvGen.ar(Env.perc, t_trig);
	Pan2.ar(SinOsc.ar(freq+(1-e*SinOsc.kr(~tempo.kr/3, 0, 20, 40)), SinOsc.ar(~tempo.kr, e*pi, pi*2), amp)*e, 0);
})

(~pno3= {|t_trig= 0, freq= 400, amp= 0.05, dur= 1|
	var e= EnvGen.ar(Env.perc(0.001, dur, 1, -4), t_trig);
	Pan2.ar(Mix(LPF.ar(SinOsc.ar(freq*#[1, 1.01, 2.02, 3.03], 0, amp))))*e
})

//much better

Tdef(\sax).play
(~plastsax= {|t_trig= 0, amp= 0.1, freq= 400, dur= 1|
	var e, e2;
	e= EnvGen.ar(Env.perc(0.02, dur), t_trig);
	e2= EnvGen.ar(Env.sine(0.5), t_trig);
	Pan2.ar(RLPF.ar(SinOsc.ar(freq*3, SinOsc.ar(900*e, 0, pi), amp*e2)+SinOsc.ar(freq*2, 0, amp*e2)+Mix(LFTri.ar(Lag.kr(freq, 1)*([1]++([3, 5, 7]*(e*0.02+1))), 0, amp*[1, 0.8, 0.6, 0.4])), LFNoise0.kr(~tempo.kr/2, 100, 1000))*e);
})

(~plastsax= {|t_trig= 0, amp= 0.1, freq= 400, dur= 1|
	var e, e2;
	e= EnvGen.ar(Env.perc(0.02, dur), t_trig);
	e2= EnvGen.ar(Env.sine(0.5), t_trig);
	Pan2.ar(RLPF.ar(SinOsc.ar(freq*3, SinOsc.ar(1-e*freq, 0, pi), amp*e2)+SinOsc.ar(freq*4, 0, amp*e2)+Mix(LFTri.ar(Lag.kr(freq, 1)*([1]++([3, 5, 7]*(e*0.02+1))), 0, amp*[1, 0.8, 0.6, 0.4])), LFNoise0.kr(~tempo.kr/2, 100, 1000))*e);
})

(~plastsax= {|t_trig= 0, amp= 0.1, freq= 400, dur= 1|
	var e, e2;
	e= EnvGen.ar(Env.perc(0.02, dur), t_trig);
	e2= EnvGen.ar(Env.sine(0.5), t_trig);
	Pan2.ar(RLPF.ar(SinOsc.ar(freq*3, SinOsc.ar(1-e*freq, 0, pi), amp*e2)+SinOsc.ar(freq*4, 0, amp*e2)+Mix(LFTri.ar(Lag.kr(freq, 10).round(90)*([1]++([4, 5, 1.5]*(e*0.02+1))), 0, amp*[1, 0.8, 0.6, 0.4])), LFNoise0.kr(~tempo.kr/2, 100, 1000))*e);
})
(~plastsax= {|t_trig= 0, amp= 0.1, freq= 400, dur= 1|
	var e, e2;
	e= EnvGen.ar(Env.perc(0.02, dur), t_trig);
	e2= EnvGen.ar(Env.sine(0.5), t_trig);
	Pan2.ar(RLPF.ar(SinOsc.ar(freq*2, SinOsc.ar(1-e*freq, 0, pi), amp*e2)+SinOsc.ar(freq*3, 0, amp*e2)+Mix(LFPar.ar(Lag.kr(freq/2, 10).round(90)*([1]++([4, 5, 1.5]*(e*0.02+1))), 0, amp*[1, 0.8, 0.6, 0.4])), LFNoise0.kr(~tempo.kr/2, 100, 1000))*e);
})

~bass.release(20)

(~plastsax= {|t_trig= 0, amp= 0.1, freq= 400, dur= 1|
	var e, e2;
	e= EnvGen.ar(Env.sine(dur), t_trig);
	e2= EnvGen.ar(Env.sine(0.5), t_trig);
	Pan2.ar(RLPF.ar(SinOsc.ar(freq*2, SinOsc.ar(1-e*freq, 0, pi), amp*e2)+SinOsc.ar(freq*3, 0, amp*e2)+Mix(LFPar.ar(Lag.kr(freq/2, 10).round(90)*([1]++([4, 5, 1.5]*(e*0.02+1))), 0, amp*[1, 0.8, 0.6, 0.4])), LFNoise0.kr(~tempo.kr/2, 100, 1000))*e);
})

~pno.release(20)

(~efx= {
	var in;
	in= In.ar(0, 2);
	CombL.ar(in, 1, ~tempo.kr/2, 1, 1);
})

~perc.release(20)

Tdef(\pno).stop
Tdef(\bass).stop
~pno2.release(6)
~pno3.release(6)

~plastsax.release(20)
Tdef(\sax).stop
p.clear
p.pop