/*RUN*/

//// avante synth pop breakcore wtf

(

~transp = 4;

// scales / pitch structure ////////

~s0 = Scale.harmonicMinor;
//~s2 = Scale.melodicMinor;
~s3 = Scale.gong;
~s1 = Scale.whole;
~s4 = Scale.chromatic;

~op1 =  Scale.new(#[4,5,1,3,0,2,8,9,10,6,7,11], name: "op27_I");
~s2 =  Scale.new(#[4,5,1,3,0,2,8,9,10,6,7,11], name: "op27_I");


// rhythmic patterns /////////////
// shuffled durs
(
~r0s = Pshuf([
	1/8,
	1/8,
	1/8,
	1/8,
	Rest(1/8),
	1/8,
	1/8,
	1/8,
],1);

~r1s = Pshuf([
	1/8,
	1/8,
	1/8,
	1/8,
	Rest(1/8),
	Rest(1/8),
	1/8,
	1/8,
],1);

//Place

~r2s = Pshuf([
	1/8,
	1/8,
	1/8,
	1/8,
	Rest(1/8),
	Rest(1/8),
	Rest(1/8),
	1/8,
],1);

~r3s = Pshuf([
	1/8,
	1/8,
	1/8,
	1/8,
	Rest(1/8),
	Rest(1/8),
	Rest(1/8),
	Rest(1/8),
],1);


~unfolding = Pseq([~r0s, ~r1s, ~r2s, ~r3s, ~r4s, ~r5s, ~r6s, ~r7s], 1);



~r0 = Pn(1/8, 16);
~r1 = Pseq([Rest(1/16), 1/8, Rest(1/16)], inf);
~r2 = Pseq([1/5],inf);
~r3 = Pseq([1/3],inf);
~r4 = Pseq([1/4],inf);

~rx0 = Pwrand([1/8, 1/4, 1/2, 4],[80,50,20,20].normalizeSum, 1);
~rx1 = Pwrand([1/8, 1/4, 1/2, 1],[80,50,20,20].normalizeSum, 1);
~rx2 = Pwrand([1/8, 1/4, 1/2],[80,50,20].normalizeSum, 1);
~rx3 = Pwrand([1/8, 1/4],[90,30].normalizeSum, 1);

);

// patterns
~rs = Pseq([
	Pconst(32, Pseq([~r0], inf)),
],inf);

~rb = Pseq([
	Pconst(32, Pseq([~r0], inf)),
],inf);

~rb1 = Pseq([
	Pconst(8, Pseq([~r0], inf)),
	Pconst(3, Pseq([~r1], inf)),
	Pconst(5, Pseq([~r2], inf)),
	Pconst(2, Pseq([~r3], inf)),
	Pconst(3, Pseq([~r4], inf)),

],inf);


~rb2 = Pseq([
	Pconst(8, Pseq([~r0], inf)),
	Pconst(3, Pseq([~r1], inf)),
	Pconst(5, Pseq([~r2], inf)),
	Pconst(2, Pseq([~r3], inf)),
	Pconst(3, Pseq([~r4], inf)),

].reverse,inf);

/*~rb2 = Pseq([
	Pconst(32, Pseq([~r2], inf)),
],inf);*/


// harmonic structure and bassline

// arpeggios + patterns

~d0 = Pxrand([0,2,4,6], 32);
~d1 = Pxrand([1,3,5,7], 32); // 1 bar
~d2 = Pseq([2,4,6,8], 8);
~d3 = Pseq([3,5,7,9],8);
~d4 = Pseq([4,6,8,10],8);
~d5 = Pxrand([5,7,9, 11, 13], 32);

~harmon_dur = [];

// bassline
~bassroot8  = Pdup(16, Pseq([0, 4, 2, 3, 1, 4, 4, 0],1));
~bassroot16 = Pdup(32, Pseq([0, 0,  4, 4,  2, 2, 3, 3,  1, 1,  4, 4,  4, 4,  5, 5],1));
//~bassroot16 = Pdup(32, Pseq([0, 4, 2, 3, 1, 4, 4, 0],1));
~bass12tone = Pdup(32, Pseq([0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11],1));

// harmonic structure 0,4,2,3,1,4,0

~dseq =  Pseq([
	Pn( ~d0, 2),
	Pn( ~d4, 2),
	Pn( ~d2, 2),
	Pn( ~d3, 2),
	Pn( ~d1, 2),
	Pn( ~d4, 2),
	Pn( ~d4, 2),
	Pn( ~d5, 2),
], 1);

// octavisation patterns

~o0 = Prand([5], inf);
~o1 = Prand([2,3], inf);
~o2 = Prand([3,4], inf);
~o3 = Prand([3,4,5], inf);
~o4 = Prand([5,6,7], inf);
~o5 = Pwrand([4,5,6,7],[20,3,4,5].normalizeSum, inf);

/////////////////////////////////////////////////
// e harmonic minor (\root 4) ///////////////////
//var ~t1, ~t2, ~t3, ~t4, b1, b2, b3, b4, a, b, r ,t, q , w;


// PLace variants into below
// =========================
~synth1_intr = Pbind( \type, \midi, \midicmd, \noteOn, \midiout, ~m32_1,
	\root, ~transp, \scale,~s2,
	\degree, 0,
	\octave, 5,
	//Pwrand([6,7,8], [25, 50, 25].normalizeSum, inf),
	\dur, Pconst(32, ~rb1));

// =========================
~synth2_intr = Pbind( \type, \midi, \midicmd, \noteOn, \midiout, ~m32_2,
	\root, ~transp, \scale,~s2,
	\degree, 0,
	\octave, 2,
	//Pwrand([2,3,4], [25, 50, 25].normalizeSum, inf),
	\dur, Pseq([1/8, 1/8, 1/8, 1/8, 1/8, 1/8, 1/8, 1/8], 32)
);


// =========================
// middle stasis
~synth1_midl = Pbind( \type, \midi, \midicmd, \noteOn, \midiout, ~m32_1,
	\root, ~transp, \scale,~s2,
	\degree, Pseq([7],inf),
	\octave, 7,
	//Pwrand([6,7,8], [25, 50, 25].normalizeSum, inf),
	\dur, Pseq([1/8, 1/8, 1/8, 1/8, 1/8, 1/8, 1/8, 1/8], 64)
);

~synth2_midl = Pbind( \type, \midi, \midicmd, \noteOn, \midiout, ~m32_2,
	\root, ~transp, \scale,~s2,
	\degree, Pseq([0],inf),
	\octave, 2,
	//Pwrand([2,3,4], [25, 50, 25].normalizeSum, inf),
	\dur, Pseq([1/8, 1/8, 1/8, 1/8, 1/8, 1/8, 1/8, 1/8], 64)
);

//==========================================
// outro

~synth1_outr = Pbind( \type, \midi, \midicmd, \noteOn, \midiout, ~m32_1,
	\root, ~transp, \scale,~s4,
	\degree, Pseq((32..0),inf),
	\octave, 7,
	//Pwrand([6,7,8], [25, 50, 25].normalizeSum, inf),
	\dur, Pseq([1/8, 1/8, 1/8, 1/8, 1/8, 1/8, 1/8, 1/8], 32)
);

~synth2_outr = Pbind( \type, \midi, \midicmd, \noteOn, \midiout, ~m32_2,
	\root, ~transp, \scale,~s4,
	\degree, Pseq((0..24),inf),
	\octave, 2,
	//Pwrand([2,3,4], [25, 50, 25].normalizeSum, inf),
	\dur, Pseq([1/8, 1/8, 1/8, 1/8, 1/8, 1/8, 1/8, 1/8], 32)
);



// treble m31
~synth1_0000 = Pbind( \type, \midi, \midicmd, \noteOn, \midiout, ~m32_1,
	\root, ~transp, \scale,~s2, \degree, ~bassroot16, \octave, ~o4, \dur,~rb);

//~synth1_0000.play;

~synth1_0001 = Pbind( \type, \midi, \midicmd, \noteOn, \midiout, ~m32_1,
	\root, ~transp, \scale,~s2, \degree, ~bassroot16, \octave, ~o4, \dur,~rb,
	\p5, Pfunc { |e| n.sendMsg("/mother1",  (e[\degree]).asFloat );  },
	\rotation, Pfunc { |e| n.sendMsg("/rotation1",  (e[\octave]).asFloat );
	},
);

// syncopated
~synth1_0002 = Pbind(\type, \midi, \midicmd, \noteOn, \midiout, ~m32_1,
	\root, ~transp, \scale,~s2, \degree, ~dseq, \octave, 4, \dur,~rb,
	\p5, Pfunc { |e| n.sendMsg("/mother1",  (e[\degree]).asFloat );  },
	\rotation, Pfunc { |e| n.sendMsg("/rotation1",  (e[\octave]).asFloat );
	},
);

~synth1_0003 = Pbind(\type, \midi, \midicmd, \noteOn, \midiout, ~m32_1,
	\root, ~transp, \scale,~s2, \degree, ~dseq, \octave, ~o3, \dur,~rb,
	\p5, Pfunc { |e| n.sendMsg("/mother1",  (e[\degree]).asFloat );  },
	\rotation, Pfunc { |e| n.sendMsg("/rotation1",  (e[\octave]).asFloat );
	},
);

~synth1_0004 = Pbind(\type, \midi, \midicmd, \noteOn, \midiout, ~m32_1,
	\root, ~transp, \scale,~s2, \degree, ~dseq, \octave, ~o4, \dur,~rb,
	\p5, Pfunc { |e| n.sendMsg("/mother1",  (e[\degree]).asFloat );  },
	\rotation, Pfunc { |e| n.sendMsg("/rotation1",  (e[\octave]).asFloat );
	},
);

~synth1_0005 = Pbind(\type, \midi, \midicmd, \noteOn, \midiout, ~m32_1,
	\root, ~transp, \scale,~s2, \degree, ~bassroot16, \octave, ~o4, \dur,~rb,
	\p5, Pfunc { |e| n.sendMsg("/mother1",  (e[\degree]).asFloat );  },
	\rotation, Pfunc { |e| n.sendMsg("/rotation1",  (e[\octave]).asFloat );
	},
);

~synth1_0006 = Pbind(\type, \midi, \midicmd, \noteOn, \midiout, ~m32_1,
	\root, ~transp, \scale,~s2, \degree, ~dseq, \octave, ~o3, \dur,~rb,
	\p5, Pfunc { |e| n.sendMsg("/mother1",  (e[\degree]).asFloat );  },
	\rotation, Pfunc { |e| n.sendMsg("/rotation1",  (e[\octave]).asFloat );
	},
);


// =========================
// bass m32

~synth2_0000 = Pbind( \type, \midi, \midicmd, \noteOn, \midiout, ~m32_2,
	\root, ~transp, \scale,~s2, \degree, ~bassroot8, \octave, 3, \dur, 1/4,
	\p5, Pfunc { |e| n.sendMsg("/mother1",  (e[\degree]).asFloat );  },
	\rotation, Pfunc { |e| n.sendMsg("/rotation1",  (e[\octave]).asFloat ); },
);

~synth2_0001 = Pbind( \type, \midi, \midicmd, \noteOn, \midiout, ~m32_2,
	\root, ~transp, \scale,~s2, \degree, ~bassroot16, \octave, ~o1, \dur,~rb,
	\p5, Pfunc { |e| n.sendMsg("/mother1",  (e[\degree]).asFloat );  },
	\rotation, Pfunc { |e| n.sendMsg("/rotation1",  (e[\octave]).asFloat ); },
);

~synth2_0002 = Pbind(\type, \midi, \midicmd, \noteOn, \midiout, ~m32_2,
	\root, ~transp, \scale,~s2, \degree, ~bassroot16, \octave, ~o2, \dur,~rb,
	\p5, Pfunc { |e| n.sendMsg("/mother2",  (e[\degree]).asFloat );  },
	\rotation, Pfunc { |e| n.sendMsg("/rotation2",  (e[\octave]).asFloat );
	},
);

~synth2_0003 = Pbind(\type, \midi, \midicmd, \noteOn, \midiout, ~m32_2,
	\root, ~transp, \scale,~s2, \degree, ~bassroot16, \octave, ~o2, \dur,~rb,
	\p5, Pfunc { |e| n.sendMsg("/mother2",  (e[\degree]).asFloat );  },
	\rotation, Pfunc { |e| n.sendMsg("/rotation2",  (e[\octave]).asFloat );
	},
);

~synth2_0004 = Pbind(\type, \midi, \midicmd, \noteOn, \midiout, ~m32_2,
	\root, ~transp, \scale,~s2, \degree, ~dseq, \octave, 3, \dur,~rb,
	\p5, Pfunc { |e| n.sendMsg("/mother2",  (e[\degree]).asFloat );  },
	\rotation, Pfunc { |e| n.sendMsg("/rotation2",  (e[\octave]).asFloat );
	},
);

~synth2_0005 = Pbind(\type, \midi, \midicmd, \noteOn, \midiout, ~m32_2,
	\root, ~transp, \scale,~s2, \degree, ~dseq, \octave, ~o2, \dur,~rb,
	\p5, Pfunc { |e| n.sendMsg("/mother2",  (e[\degree]).asFloat );  },
	\rotation, Pfunc { |e| n.sendMsg("/rotation2",  (e[\octave]).asFloat );
	},
);

~synth2_0006 = Pbind(\type, \midi, \midicmd, \noteOn, \midiout, ~m32_2,
	\root, ~transp, \scale,~s2, \degree, ~bassroot16, \octave, ~o2, \dur,~rb,
	\p5, Pfunc { |e| n.sendMsg("/mother2",  (e[\degree]).asFloat );  },
	\rotation, Pfunc { |e| n.sendMsg("/rotation2",  (e[\octave]).asFloat );
	},
);

// drum patterns ///////////////////////////////////////////////////////////


//~hh3.play;


~d00 = Pbind(\type, \midi, \midicmd, \noteOn, \midiout, ~hydro_0, \chan, 10,
	\midinote, Prand([42, 43, 44,45], inf),
	\dur, Pconst(8, Pseq( [ Prand([1/8, 1/2, Rest(1/8)], 8), Rest(1/2)], inf)),
	\amp, Pexprand(20,35, inf) / 127,

);

~d01 = Pbind(\type, \midi, \midicmd, \noteOn, \midiout, ~hydro_0, \chan, 10,
	\midinote, Prand([42, 43, 44], inf),
	\dur,  Pconst(8,  Pwrand([1/8, 1/4, Rest(1/8)], [5,3,2].normalizeSum,  inf)),
	\amp, Pexprand(20,35, inf) / 127,
);

~d02 = Pbind(\type, \midi, \midicmd, \noteOn, \midiout, ~hydro_0, \chan, 10,
	\midinote, Prand([42,  43, 44, 45], inf),
	\dur,  Pconst(8, Pwrand([1/8, 1/4], [5,3,2].normalizeSum,  inf)),
	\amp, Pexprand(20,35, inf) / 127,

);

~d03 = Pbind(\type, \midi, \midicmd, \noteOn, \midiout, ~hydro_0, \chan, 10,
	\midinote, Prand([42,43, 44, 45, 46], inf),
	\dur, Pconst(8, Prand([1/8, 1/4], inf)),
	\amp, Pexprand(20,35, inf) / 127,

);

~d04 = Pbind(\type, \midi, \midicmd, \noteOn, \midiout, ~hydro_0, \chan, 10,
	\midinote, Prand([42,43, 44, 45, 46, 47], inf),
	\dur, Pconst(8, Prand([1/8, 1/4], inf)),
	\amp, Pexprand(20,35, inf) / 127,

);

~d05 = Pbind(\type, \midi, \midicmd, \noteOn, \midiout, ~hydro_0, \chan, 10,
	\midinote, Prand([42,43], inf),
	\dur, Pconst(8, Pseq([
		1/8, 1/8, 1/4, Rest(1/2),
		//Prand([1/16],3), Rest(13/16),
		Pseq([ Rest(1/16), 1/16], 16)], inf)),
	\amp, Pexprand(20,35, inf) / 127,

);

// -----Prand([1/16], 8)


//////////////////////////////////////////////

~hh0 = Pbind(\type, \midi, \midicmd, \noteOn, \midiout, ~hydro_0, \chan, 10,
	\midinote, Prand([45], inf),
	\dur, Pseq([ Rest(1/4), 1/4], 16),
	\amp, Pexprand(10,15, inf) / 127,
);

~hh1 = Pbind(\type, \midi, \midicmd, \noteOn, \midiout, ~hydro_0, \chan, 10,
	\midinote, Prand([45], inf),
	\dur, Pconst(8, Pxrand([ Rest(1/4), 1/8, 1/8], inf)),
	\amp, Pexprand(10,15, inf) / 127,
);

~hh2 = Pbind(\type, \midi, \midicmd, \noteOn, \midiout, ~hydro_0, \chan, 10,
	\midinote, Pxrand([43,44,45], inf),
	\dur, Pseq([ Rest(1/8), 1/8, 1/8, 1/8], 16),
	\amp, Pexprand(10,20, inf) / 127,
);

~hh3 = Pbind(\type, \midi, \midicmd, \noteOn, \midiout, ~hydro_0, \chan, 10,
	\midinote, Pxrand([43,44,45], inf),
	\dur, Pconst(8, Prand([1/8], 64)),
	\amp, Pexprand(10,20, inf) / 127,
);


~hh4 = Pbind(\type, \midi, \midicmd, \noteOn, \midiout, ~hydro_0, \chan, 10,
	\midinote, Pxrand([43,44,45], inf),
	\dur, Pconst(8, Prand([1/8], 64)),
	\amp, Pexprand(20,35, inf) / 127,
);

~hh5 = Pbind(\type, \midi, \midicmd, \noteOn, \midiout, ~hydro_0, \chan, 10,
	\midinote, Pxrand([43,44,45], inf),
	\dur, Pconst(8, Prand([1/8], 64)),
	\amp, Pexprand(10,25, inf) / 127,
);

~hh6 = Pbind(\type, \midi, \midicmd, \noteOn, \midiout, ~hydro_0, \chan, 10,
	\midinote, Pxrand([43], inf),
	\dur, Pconst(8, Prand([1/16], 64)),
	\amp, Pexprand(10,25, inf) / 127,
);

//~hh0.play;


~drop_0000 = Pbind(\type, \midi, \midicmd, \noteOn, \midiout, ~m32_1,
	\root, ~transp, \scale,~s2,
	//\degree, Pseq([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16], inf),
	\degree, Pseq((0..64), inf),
	\octave, 3,
	\dur, Pconst(8, 1/8)
);

~drop_0001 = Pbind(\type, \midi, \midicmd, \noteOn, \midiout, ~m32_2,
	\root, ~transp, \scale,~s2,
	//\degree, Pseq([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16], inf),
	\degree, Pseq((64..0), inf),
	\octave, 2,
	\dur, Pconst(8, 1/8)
);


~drum_break = Pbind(\type, \midi, \midicmd, \noteOn, \midiout, ~hydro_0, \chan, 10,
	\midinote, Pxrand((32..48), inf),
	\dur, Pconst(2, Pseq([1/8, 1/8, 1/8, Rest(1/8), 1/16, 1/16,  1/16,  1/16], inf    )),
	\amp, Pexprand(10, 25, inf) / 127,

);

///////////////////////////////////////////////
~sdpat01 = Pseq([

	Pxrand([
		Pseq([Rest(1/4), Pxrand([1/8, 1/4, Rest(1/4), Rest(1/8)], 4)], 1),
		Pseq([Rest(1/4), Pxrand([1/8, 1/4, Rest(1/8)], 3), 1/8, 1/8 ], 1),
	], 1),

	Prand( [1, Pseq([1/6], 6)], 1),

	Pxrand([
				Pseq([Rest(1/2), Pseq([1/8, 1/16,1/16, 1/8, 1/16,1/16], 1)], 1),
		Pseq([Rest(1/2), Pseq([Rest(1/4), 1/8, 1/16,1/16], 1)], 1),
		Pseq([Rest(1/2), Pseq([Rest(3/8),      1/16,1/16], 1)], 1),
		Pseq([Rest(1/2), Pseq([Rest(1/4), 1/16, 1/16, 1/16, 1/16], 1)], 1),
	], 1),

	1

], 2);

//~snare_wild.play;

~snare00 = Pbind(\type, \midi, \midicmd, \noteOn, \midiout, ~hydro_0, \chan, 10,
	\midinote, Pxrand([38, 39,40, 41], inf),
	\dur, Pconst(8, Prand([1/8, 1/4, Rest(1)], inf)),
);

~snare01 = Pbind(\type, \midi, \midicmd, \noteOn, \midiout, ~hydro_0, \chan, 10,
	\midinote, Pxrand([38, 39, 40 ,41], inf),
	\dur, Pconst(8, Prand([1/8, 1/4, Rest(1/2)], inf)),
);

~snare02 = Pbind(\type, \midi, \midicmd, \noteOn, \midiout, ~hydro_0, \chan, 10,
	\midinote, Pxrand([38, 39,40,41], inf),
	\dur, Pconst(8, Prand([1/8, 1/4, Rest(1/4)], inf)),
);

~snare03 = Pbind(\type, \midi, \midicmd, \noteOn, \midiout, ~hydro_0, \chan, 10,
	\midinote, Pxrand([38, 39,40, 41], inf),
	\dur, Pconst(8, Prand([1/8, 1/4, Rest(1/8)], inf)) ,
);

~snare04 = Pbind(\type, \midi, \midicmd, \noteOn, \midiout, ~hydro_0, \chan, 10,
	\midinote, Pxrand([38, 39,40, 41, 49], inf),
	\dur, Pconst(8, Prand([1/8, 1/4, Rest(1/8)], inf)) ,
);

~snare05 = Pbind(\type, \midi, \midicmd, \noteOn, \midiout, ~hydro_0, \chan, 10,
	\midinote, Pxrand([36, 38, 39], inf),
	\dur, Pconst(8, Pxrand([1/8, 1/8, 1/16, 1/4, Rest(1/8)], inf)),
	\amp, Pexprand(20,30, inf) / 127
	);

//~snare06.play;

~snare06 = Pbind(\type, \midi, \midicmd, \noteOn, \midiout, ~hydro_0, \chan, 10,
	\midinote, Pxrand([39], inf),
	\dur, Pconst(8, ~sdpat01),
	\amp, Pexprand(10,40, inf) / 127,
);

~snare07 = Pbind(\type, \midi, \midicmd, \noteOn, \midiout, ~hydro_0, \chan, 10,
	\midinote, Pseq([39, 40,41], inf),
	\dur, Pconst(8, Pseq([1/3, 1/3, 1/3], inf)),
	\amp, Pexprand(10,40, inf) / 127,
);



// KICK DRUM PATTERNS



~kdpat01 = Pseq([

	1,

	Pxrand([
		Pseq([Rest(1/4), Pxrand([1/8, 1/4, Rest(1/4), Rest(1/8)], 4)], 1),
		Pseq([Rest(1/4), Pxrand([1/8, 1/4, Rest(1/8)], 3), 1/8, 1/8 ], 1),
	], 1),

	1,

	Pxrand([
//		Pseq([Rest(1/2), Pseq([1/8, 1/8, 1/8, 1/8], 1)], 1),
		Pseq([Rest(1/2), Pseq([Rest(1/4), 1/8, 1/8], 1)], 1),
		Pseq([Rest(1/2), Pseq([Rest(3/8),      1/8], 1)], 1),
		Pseq([Rest(1/2), Pseq([Rest(1/4), 1/16, 1/16, 1/16, 1/16], 1)], 1),
	],

	1

)], 2);

//Pconst(4, Prand([1/8, 1/4, Rest(1/8)], inf)

//~kick04.play;
//~kick04.stop;

~kick00 = Pbind(\type, \midi, \midicmd, \noteOn, \midiout, ~hydro_0, \chan, 10,
	\midinote, Prand([36], inf),
	\dur, Pconst(8, Pseq([1,Rest(1),Rest(1),Rest(1)], inf)));

~kick01 = Pbind(\type, \midi, \midicmd, \noteOn, \midiout, ~hydro_0, \chan, 10,
	\midinote, Prand([36, 37,], inf),
	\dur, Pconst(8, Prand([1/8, 1/4, Rest(1/2)], inf)));

~kick02 = Pbind(\type, \midi, \midicmd, \noteOn, \midiout, ~hydro_0, \chan, 10,
	\midinote, Prand([36,37,38], inf),
	\dur, Pconst(8, Prand([1/8, 1/4, Rest(1/4)], inf)));

~kick03 = Pbind(\type, \midi, \midicmd, \noteOn, \midiout, ~hydro_0, \chan, 10,
	\midinote, Prand([36,37, 38], inf),
	\dur, Pconst(8, Prand([1/8, 1/4, Rest(1/4)], inf)));

~kick04 = Pbind(\type, \midi, \midicmd, \noteOn, \midiout, ~hydro_0, \chan, 10,
	\midinote, Prand([36,37], inf),
		\dur, Pconst(8, ~kdpat01) );

~kick05 = Pbind(\type, \midi, \midicmd, \noteOn, \midiout, ~hydro_0, \chan, 10,
	\midinote, Prand([38, 36,37], inf),
	\dur, Pconst(8, Prand([1/2, 1/4, 1/8], inf)));

// =========================
// AMEN BREAK

~snare_a = Pbind(\type, \midi, \midicmd, \noteOn, \midiout, ~hydro_0, \chan, 10,
	\midinote, Prand([39], inf),
	\dur, Pseq(
		[
			Rest(1/2), 3/8, 1/8,     Rest(1/8), 1/8,  Rest(1/4), 3/8, 1/8, // bar 1
			Rest(1/2), 3/8, 1/8,     Rest(1/8), 1/8,  Rest(1/4), 3/8, 1/8, // bar 1
			Rest(1/2), 3/8, 1/8,     Rest(1/8), 1/8,  Rest(1/2), 1/4, // bar 1
			Rest(1/8), 1/8, Rest(1/4), 3/8, 1/8,  Rest(1/8), 1/8, Rest(1/4), Rest(1/4), 1/4 // bar 1
], 1));

~kick_a = Pbind(\type, \midi, \midicmd, \noteOn, \midiout, ~hydro_0, \chan, 10,
	\midinote, Prand([36], inf),
	\dur, Pseq(
		[
			1/4, 1/4, Rest(1/2), Rest(1/4), 1/8, 1/8, Rest(1/2), // bar 1
			1/4, 1/4, Rest(1/2), Rest(1/4), 1/8, 1/8, Rest(1/2), // bar 1
			1/4, 1/4, Rest(1/2), Rest(1/4), 1/4, Rest(1/2), // bar 1
			Rest(1/4), 1/8, 1/8, Rest(1/2), Rest(1/4), 1/4, Rest(1/2), // bar 1
], 1));

//~kick_a.play;
////

~kickrr = Rest(4);
~snarerr = Rest(4);

// =================

~kick_one_ =  Pseq( [ ~kick00, ~kick00, ~kick01, ~kick00, ~kick00, ~kick00, ~kick01, ~kick00 ], 1);
~kick_intr =  Pseq( [ ~kick01, ~kick01, ~kick02, ~kick02, ~kick03, ~kick03, ~kick03, ~kick03 ], 1);
~kick_main =  Pseq( [ ~kick04, ~kick04, ~kick04, ~kick04, ~kick04, ~kick04, ~kick04, ~kick04 ], 1);

// ===
//~kick_amen =  Pseq( [ ~kick_a,  ], 1);
//~snare_amen = Pseq( [ ~snare_a ], 1);

~snare_intr = Pseq( [ ~snarerr, ~snare00, ~snarerr, ~snare00, ~snare01, ~snare02, ~snare03, ~snare04 ], 1);
~snare_main = Pseq( [ ~snare04, ~snare05, ~snare06, ~snare03, ~snare04, ~snare05, ~snare05, ~snare05 ], 1);
~snare_wild = Pseq( [ ~snare06, ~snare07, ~snare06, ~snare07, ~snare06, ~snare07, ~snare06, ~snare07 ], 1);

//==

~hh_intr =  Pseq( [~hh0, ~hh0, ~hh1, ~hh2, ~hh3, ~hh3, ~hh3, ~hh3], 1);
~hh_main =  Pseq( [~hh4, ~hh4, ~hh3, ~hh4, ~hh3, ~hh4, ~hh3, ~hh5], 1);
~hh_wild =  Pseq( [~hh4, ~hh5, ~hh4, ~hh5, ~hh3, ~hh4, ~hh5, ~hh5], 1);

// =================

~d_intr = Pseq([~d00, ~d00, ~d01, ~d01, ~d02, ~d02, ~d03, ~d03], 1); // hydrogen part
~d_main = Pseq([~d04, ~d04, ~d04, ~d04, ~d04, ~d04, ~d04, ~d04], 1); // hydrogen part
~d_wild = Pseq([~d05, ~d04, ~d05, ~d04, ~d05, ~d04, ~d05, ~d04], 1); // hydrogen part
);

//z = Ppar( [r, t, d, ~kick, ~snare, ~hh1], 1 ).play;  // in parallel
//z = Ppar( [r, t, d, ~hh], 1 ).play;  // in parallel
//~synth1_intr.play;