"/home/rob/gtr/motherMIDISetup.scd".load;

TempoClock.default.tempo = 60/60;

~host = NetAddr("localhost", 4859); // address de PROCESSING

Pfunc



~xx = (
Pdef(\m_1).play(quant: 4);    // TOP MOTHER
Pdef(\m_1_CC).play(quant:4);  // CC 1
Pdef(\m_2).play(quant: 4);    // BTM MOTHER NOTEON
Pdef(\m_2_CC).play(quant:4);  // CC 1
)

Pdef(\m_1).stop;              // NOTEON
Pdef(\m_1_CC).stop;
Pdef(\m_2).stop;              // NOTEON
Pdef(\m_2_CC).stop;

////////////////////////////////////////
Pdef(\m_1).play(quant: 4);    // TOP MOTHER
Pdef(\m_1_CC).play(quant:4);  // CC 1
Pdef(\m_1).stop;              // NOTEON
Pdef(\m_1_CC).stop;
// --------------- /
Pdef(\m_2).play(quant: 4);    // BTM MOTHER NOTEON
Pdef(\m_2_CC).play(quant:4);  // CC 1
Pdef(\m_2).stop;              // NOTEON
Pdef(\m_2_CC).stop;
//////////////////////////////
Pbindef(\m_1,\scale,~s1,\degree,~d4,\dur,~r1,\octave,~o2, \mtranspose,0);
Pbindef(\m_2,\scale,~s1,\degree,~d4,\dur,~r2,\octave,~o2, \mtranspose,0);

// indiviudal controls //////////////
Pbindef(\m_1, \root, 4); Pbindef(\m_2, \root, 4);
Pbindef(\m_1, \mtranspose, 0); Pbindef(\m_2, \mtranspose, 0);
Pbindef(\m_1, \scale, ~s1 ); Pbindef(\m_2, \scale, ~s1);
Pbindef(\m_1, \octave, ~o0); Pbindef(\m_2, \octave, 2);
Pbindef(\m_1, \dur, ~r4);  Pbindef(\m_2, \dur, ~r0);
Pbindef(\m_1, \degree, ~ddd); Pbindef(\m_2, \degree, ~ddd);

(
var a;
a = Pfunc({
	//exprand(0.1, 0.3) + #[1, 2, 3, 6, 7].choose
	~host.sendMsg("/sc3p5", rrand(1,100).asFloat); // send OSC message to P5

}).asStream;
{
    a.do { |val|
		~host.sendMsg("/sc3p5", rrand(1,100).asFloat); // send OSC message to P5

		//Synth(\help_sinegrain, [\freq, val * 100 + 300]);
        0.02.wait;
    }
}.fork;
)

