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

//minimalism
(SynthDef(\mini, {|out= 0, freq= 400, amp= 0.1|
	var e, z;
	e= EnvGen.kr(Env.perc, doneAction: 2);
	z= SinOsc.ar(freq*[1, 1.01], 0, amp);
	Out.ar(out, z*e);
}).store;
)

Pdef(\mini1).play(c, quant:2)

Pdef(\mini1, Pbind(\instrument, \mini))
Pdef(\mini2).play(c, quant:2)
Pdef(\mini2, Pbind(\instrument, \mini, \dur, 2/3, \degree, Pseq([0, 5, 3, 4], inf)))

Pdef(\mini3).play(c, quant:2)
Pdef(\mini3, Pbind(\instrument, \mini, \dur, 4, \degree, Pseq([0, 5, 3, 4], inf), \octave, 4))

Pdef(\mini4).play(c, quant:2)
Pdef(\mini4, Pbind(\instrument, \mini, \dur, 6, \degree, Pseq([8, 5, 3, 4], inf), \octave, 3))

Pdef(\mini2, Pbind(\instrument, \mini, \dur, 2/3, \degree, Pseq([0, 5, 3, 4], inf), \ctranspose, Pseq([Pn(5, 6), Pn(0, 10)], inf)))

Pdef(\mini3, Pbind(\instrument, \mini, \dur, 4, \degree, Pseq([0, 5, 3, 4], inf), \octave, 4, \ctranspose, Pseq([Pn(5, 6), Pn(0, 10)], inf)))

Pdef(\mini0).play(c, quant:2)
Pdef(\mini0, Pbind(\instrument, \mini, \dur, Pseq([Pn(0.5, 10), 0.25], inf), \degree, Pseq([0, 5, 3, 4], inf), \octave, 5, \ctranspose, 0))

Pdef(\three, Pbind(\instrument, \mini, \dur, 6/8, \degree, Pseq([0, 0, 5, 5, 3, 4], inf), \octave, 5, \ctranspose, 0, \pan, Pseq([-1, 1], inf)))
Pdef(\three).play(c, quant:2)

(SynthDef(\delay, {|out= 0, in= 10, time= 0.3, decay= 1|
	var z;
	z= CombL.ar(InFeedback.ar(in, 2), 2, time.clip(0, 2), decay);
	Out.ar(out, z);
}).store)

a= Synth(\delay)

Pdef(\three, Pbind(\instrument, \mini, \dur, 6/8, \degree, Pseq([0, 0, 5, 5, 3, 4], inf), \octave, 5, \ctranspose, 0, \pan, Pseq([-1, 1], inf), \out, Prand([10, 0], inf)))

Pdef(\mini3, Pbind(\instrument, \mini, \dur, 4, \degree, Pseq([0, 5, 3, 4], inf), \octave, 4, \out, Prand([10, 0], inf)))

a.set(\decay, 2)

Pdef(\mini1, Pbind(\instrument, \mini, \out, 10))

Pdef(\mini2, Pbind(\instrument, \mini, \dur, 2/3, \degree, Pseq([0, 5, 3, 4], inf), \ctranspose, Pseq([Pn(5, 6), Pn(0, 10)], inf), \out, Pseq([0, 10, 0], inf)))

Pdef(\three, Pbind(\instrument, \mini, \dur, 3/8, \degree, Pseq([0, 0, 5, 5, 3, 4], inf), \octave, 5, \ctranspose, 0, \pan, Pseq([-1, 1], inf)))

Pdef(\mini4, Pbind(\instrument, \mini, \dur, 12/8, \degree, Pseq([8, 5, 3, 4], inf), \octave, 3, \out, Pseq([0, 0, 0, 0, 10, 0, 0, 0], inf)))

Pdef(\mini0, Pbind(\instrument, \mini, \dur, Pseq([Pn(0.5, 8), 0.125, 0.25, 0.25], inf), \degree, Pseq([0, 5, 3, 4], inf), \octave, 5, \ctranspose, Pseq([5, 0, 0], inf)))

Pdef(\mini0, Pbind(\instrument, \mini, \dur, Pseq([Pn(0.5, 8), 0.125, 0.25, 0.25], inf), \degree, Pseq([0, 5, 3, 4], inf), \octave, 5, \ctranspose, Pseq([5, 0, 0], inf)))

Pdef(\miniminus).play(c, quant:2)
Pdef(\miniminus, Pbind(\instrument, \mini, \dur, Pseq([0.125, 0.125, 0.25], inf), \degree, Pseq([0, 5, 3, 4, 5, 0, 3, 4], inf), \octave, 6, \amp, Prand([0.02, 0.04, 0.06], inf), \ctranspose, Pseq([Pn(0, 32), Pn(-5, 32)], inf)))

Pdef(\mini0, Pbind(\instrument, \mini, \dur, Pseq([Pn(0.5, 8), 0.125, 0.25, 0.25], inf), \degree, Pseq([0, 5, 3, 4], inf), \octave, 6, \ctranspose, Pseq([5, 0, 0], inf)))

Pdef(\mini2, Pbind(\instrument, \mini, \dur, 1/3, \degree, Pseq([0, 5, 3, 4], inf), \ctranspose, Pseq([Pn(5, 6), Pn(0, 10)], inf), \out, 10))

//more delays
a.set(\decay, 3)

Pdef(\three, Pbind(\instrument, \mini, \dur, Pseq([Pn(3/8, 64), Pn(2/8, 64)], inf), \degree, Pseq([0, 0, 5, 5, 3, 4], inf), \octave, 6, \ctranspose, 0, \pan, Pseq([-1, 1], inf)))

Pdef(\mini4, Pbind(\instrument, \mini, \dur, Pseq([Pn(12/8, 48), Pn(6/8, 48), Pn(3/8, 48)], inf), \degree, Pseq([8, 5, 3, 4], inf), \octave, 3, \out, Pseq([0, 0, 0, 0, 10, 0, 0, 0], inf)))

Pdef(\mini3, Pbind(\instrument, \mini, \dur, Pseq([Pn(4, 32), Pn(3, 32)], inf), \degree, Pseq([0, 5, 3, 4], inf), \octave, 4, \out, Prand([10, 0], inf)))

Pdef(\mini2).stop

Pdef(\mini0).stop

Pdef(\mini4, Pbind(\instrument, \mini, \dur, Pseq([Pn(12/8, 48), Pn(6/8, 48), Pn(3/8, 48)], inf), \degree, Pseq([8, 5, 3, 4], inf), \octave, Pseq([Pn(3, 16), Pn(4, 16)], inf), \out, Pseq([0, 10, 0], inf)))

a.set(\decay, 1)

Pdef(\mini3, Pbind(\instrument, \mini, \dur, Pseq([Pn(4, 16), Pn(3, 32), Pn(2, 8)], inf), \amp, Prand([0.1, 0.05, 0.05, 0], inf), \degree, Pseq([0, 5, 3, 4], inf), \octave, 4, \out, Prand([10, 0], inf)))

Pdef(\three).stop
Pdef(\three).play

Pdef(\mini4).stop
Pdef(\miniminus).isPlaying

Pdef(\miniminus, Pbind(\instrument, \mini, \dur, Pseq([0.125, 0.125, 0.25], inf)*0.5, \degree, Pseq([0, 5, 3, 4, 5, 0, 3, 4], inf), \octave, 5, \amp, Prand([0.02, 0.04, 0.06], inf), \ctranspose, Pseq([Pn(0, 32), Pn(-5, 32)], inf)))

Pdef(\mini3, Pbind(\instrument, \mini, \dur, Pseq([Pn(4, 16), Pn(3, 32), Pn(2, 8)], inf), \amp, Prand([0.1, 0.05, 0.05, 0], inf), \degree, Pseq([0, 0, 5, 3, 4], inf), \octave, 3, \out, Prand([10, 0], inf)))

Pdef(\mini3).isPlaying
a.set(\decay, 4)

Pdef(\miniminus, Pbind(\instrument, \mini, \dur, Pseq([0.125, 0.125, 0.25], inf)*0.5, \degree, Pseq([0, 5, 3, 4, 5, 0, 3, 4], inf), \octave, 4, \amp, Prand([0.02, 0.04, 0.06], inf), \ctranspose, Pseq([Pn(0, 32), Pn(-5, 32)], inf)))

Pdef(\miniminus).stop
Pdef(\mini3).stop
Pdef(\mini3).play
Pdef(\mini2).stop
Pdef(\mini1).play
Pdef(\three).isPlaying
Pdef(\three, Pbind(\instrument, \mini, \dur, Pseq([Pn(3/8, 64), Pn(2/8, 64)], inf)*2, \degree, Pseq([0, 0, 5, 5, 3, 4], inf), \octave, 6, \ctranspose, 0, \pan, Pseq([-1, 1], inf)))
Pdef(\three, Pbind(\instrument, \mini, \dur, Pseq([Pn(3/8, 64), Pn(2/8, 64)], inf)*3, \degree, Pseq([0, 0, 5, 5, 3, 4], inf), \octave, 5, \ctranspose, 0, \pan, Pseq([-1, 1], inf)))

a.set(\decay, 5)

Pdef(\three, Pbind(\instrument, \mini, \dur, Pseq([Pn(3/8, 64), Pn(1/16, 8)], inf)*3, \degree, Pseq([0, 0, 5, 5, 3, 4], inf), \octave, 5, \ctranspose, 0, \pan, Pseq([-1, 1], inf), \out, Pseq([0, 10, 0], inf)))

Pdef(\mini2).play
Pdef(\mini2).stop
Pdef(\mini2).play
Pdef(\mini2).stop

Pdef(\mini2, Pbind(\instrument, \mini, \dur, Pseq([Pn(1/3, 8), 16], inf), \degree, Pseq([0, 5, 3, 4], inf), \ctranspose, Pseq([Pn(5, 6), Pn(0, 10)], inf), \out, 10))
Pdef(\mini2).play(c, quant:1)

Pdef(\mini3, Pbind(\instrument, \mini, \dur, Pseq([8, Pn(1/3, 8), 16], inf), \degree, Pseq([0, 5, 3, 4], inf), \octave, 4, \out, 10))
Pdef(\mini3).play(c, quant:1)

Pdef(\mini4, Pbind(\instrument, \mini, \dur, 6, \degree, Pseq([8, 5, 3, 4], inf), \octave, 3))
Pdef(\mini4).play(c, quant:2)

Pdef(\mini4).stop
Pdef(\mini4).play

Pdef(\mini3).stop
Pdef(\mini2).stop
Pdef(\three).stop
Pdef(\mini3).play

Tdef(\stop).play
Tdef(\stop, {50.do{|i| c.tempo_(c.tempo*0.99); 0.5.wait}})
//hm does not work.  what did i miss?

Pdef(\mini1, Pbind(\instrument, \mini, \dur, 0.9))
Tdef(\stop).stop
Pdef(\mini3).stop
Pdef(\mini4).stop
Pdef(\mini1, Pbind(\instrument, \mini, \dur, 0.8))
Pdef(\mini1, Pbind(\instrument, \mini, \dur, 0.7))
Pdef(\mini1, Pbind(\instrument, \mini, \dur, 0.6))
Pdef(\mini1, Pbind(\instrument, \mini, \dur, 0.5))
Pdef(\mini1, Pbind(\instrument, \mini, \dur, 0.4))
Pdef(\mini1, Pbind(\instrument, \mini, \dur, 0.3))
Pdef(\mini1, Pbind(\instrument, \mini, \dur, 0.2))
Pdef(\mini1, Pbind(\instrument, \mini, \dur, 0.1))

a.free
p.clear
p.pop