touch instrument supercollider

master
Rob Canning 2023-09-29 09:15:13 +02:00
parent 63be7ee648
commit a774c5a8ce
1 changed files with 137 additions and 88 deletions

View File

@ -3,7 +3,7 @@
s.options.numInputBusChannels = 4; s.options.numInputBusChannels = 4;
s.options.numOutputBusChannels = 4; s.options.numOutputBusChannels = 4;
b = NetAddr.new("192.168.0.116", 8888); // create the NetAddr b = NetAddr.new("192.168.0.100", 8888); // create the NetAddr
//b.sendMsg("/led", [0,1].choose); // send the application the message "hello" with the parameter "there" //b.sendMsg("/led", [0,1].choose); // send the application the message "hello" with the parameter "there"
//OSCFunc.trace(true); // Turn posting on //OSCFunc.trace(true); // Turn posting on
@ -48,6 +48,10 @@ s.waitForBoot{
sig = PlayBuf.ar(1, bufnum, rate*tpse*dir, t_trig, startPos: spos, loop:loop, doneAction: 0); sig = PlayBuf.ar(1, bufnum, rate*tpse*dir, t_trig, startPos: spos, loop:loop, doneAction: 0);
sig = sig * env * amp; sig = sig * env * amp;
sig = Pan2.ar(sig, FSinOsc.kr(panRate)); sig = Pan2.ar(sig, FSinOsc.kr(panRate));
//sig = PanAz.ar(4, sig, FSinOsc.kr(panRate));
//sig = Pan4.ar(sig, FSinOsc.kr(panRate));
Out.ar(out, sig); Out.ar(out, sig);
}).add; }).add;
@ -55,17 +59,16 @@ s.waitForBoot{
~oPA = 8.collect({ ~oPA = 8.collect({
arg itt, rate=1, out=0, sdir=\bowl, arg itt, rate=1, out=0, sdir=\bowl,
amp=0.9, loop=0, panRate=rrand(0.05,0.75), group=~sGA; amp=0.8, loop=0, panRate=rrand(0.05,0.75), group=~sGA;
Synth.new(\splay, [ \bufnum, ~smp[sdir][rrand(0,~smp[sdir].size-1)], \out, out, \loop, loop, panRate: panRate], group); Synth.new(\splay, [ \bufnum, ~smp[sdir][rrand(0,~smp[sdir].size-1)], \out, out, \loop, loop, panRate: panRate], group);
}); });
~oPB = 8.collect({ ~oPB = 8.collect({
arg itt, rate=1, out=0, sdir=\green, arg itt, rate=1, out=0, sdir=\bowl,
amp=0.5, loop=0, panRate=rrand(0.05,0.75), group=~sGB; amp=0.8, loop=0, panRate=rrand(0.05,0.75), group=~sGB;
Synth.new(\splay, [\bufnum, ~smp[sdir][rrand(0,~smp[sdir].size-1)], \out, out, \loop, loop, panRate: panRate], group); Synth.new(\splay, [\bufnum, ~smp[sdir][rrand(0,~smp[sdir].size-1)], \out, out, \loop, loop, panRate: panRate], group);
}); });
// RECEIVE OSC MESSAGES FROM ESP32s // RECEIVE OSC MESSAGES FROM ESP32s
~transpositionsA = 0; ~transpositionsA = 0;
@ -75,6 +78,9 @@ s.waitForBoot{
~modeC = 0; ~modeC = 0;
~modeD = 0; ~modeD = 0;
~loopA = 0; // loop state
~loopA = 0; //
~shiftA = 0; // shift state ~shiftA = 0; // shift state
~shiftB = 0; // shift state ~shiftB = 0; // shift state
~shiftC = 0; // shift state ~shiftC = 0; // shift state
@ -83,7 +89,7 @@ s.waitForBoot{
~ctrlA = 0; // ctrl state ~ctrlA = 0; // ctrl state
~ctrlB = 0; // ctrl state ~ctrlB = 0; // ctrl state
~sampleDir = [\green, \bowl, \blue, \green]; ~sampleDir = [\bowl, \green, \bowed, \zither];
~lsA=0; // loop state ~lsA=0; // loop state
~lsB=0; // loop state ~lsB=0; // loop state
@ -112,6 +118,10 @@ s.waitForBoot{
~dirStateA = [0,0,0,0,0,0,0,0]; ~dirStateA = [0,0,0,0,0,0,0,0];
~dirStateB = [0,0,0,0,0,0,0,0]; ~dirStateB = [0,0,0,0,0,0,0,0];
~loopStateA = [0,0,0,0,0,0,0,0];
~loopStateB = [0,0,0,0,0,0,0,0];
//~dirState.put(3,1); //~dirState.put(3,1);
//~scales[2].tuning; ~scales[2].size; ~scales[2].pitchesPerOcatave; //~scales[2].tuning; ~scales[2].size; ~scales[2].pitchesPerOcatave;
@ -131,17 +141,20 @@ s.waitForBoot{
if (msg[2] < 8) { // if sensor 0 - 7 and looper if (msg[2] < 8) { // if sensor 0 - 7 and looper
if ( msg[3]== 1 ) { if ( msg[3]== 1 ) {
postln("PITCHCLASS: " + ~psetA[msg[2]] ); postln("PITCHCLASS: " + ~psetA[msg[2]] );
b.sendMsg("/led", msg[2], ~psetA[msg[2]], msg[4]); b.sendMsg("/led", msg[2], ~psetA[msg[2]], msg[4]);
~loopStateA.put(msg[2],0);
w = case w = case
{ msg[2] == 0} { ~oPA[0].set(\rate, ~scaleA[~psetA[0]].midiratio, \t_trig, 1, \gate, 1, \tpse, 1, \dir, 1); } { msg[2] == 0} { ~oPA[0].set(\rate, ~scaleA[~psetA[0]].midiratio, \t_trig, 1, \gate, 1, \tpse, 1, \dir, 1, \loop, 0, \spos, 0); }
{ msg[2] == 1} { ~oPA[1].set(\rate, ~scaleA[~psetA[1]].midiratio, \t_trig, 1, \gate, 1, \tpse, 1, \dir, 1); } { msg[2] == 1} { ~oPA[1].set(\rate, ~scaleA[~psetA[1]].midiratio, \t_trig, 1, \gate, 1, \tpse, 1, \dir, 1, \loop, 0, \spos, 0); }
{ msg[2] == 2} { ~oPA[2].set(\rate, ~scaleA[~psetA[2]].midiratio, \t_trig, 1, \gate, 1, \tpse, 1, \dir, 1); } { msg[2] == 2} { ~oPA[2].set(\rate, ~scaleA[~psetA[2]].midiratio, \t_trig, 1, \gate, 1, \tpse, 1, \dir, 1, \loop, 0, \spos, 0); }
{ msg[2] == 3} { ~oPA[3].set(\rate, ~scaleA[~psetA[3]].midiratio, \t_trig, 1, \gate, 1, \tpse, 1, \dir, 1); } { msg[2] == 3} { ~oPA[3].set(\rate, ~scaleA[~psetA[3]].midiratio, \t_trig, 1, \gate, 1, \tpse, 1, \dir, 1, \loop, 0, \spos, 0); }
{ msg[2] == 4} { ~oPA[4].set(\rate, ~scaleA[~psetA[4]].midiratio, \t_trig, 1, \gate, 1, \tpse, 1, \dir, 1); } { msg[2] == 4} { ~oPA[4].set(\rate, ~scaleA[~psetA[4]].midiratio, \t_trig, 1, \gate, 1, \tpse, 1, \dir, 1, \loop, 0, \spos, 0); }
{ msg[2] == 5} { ~oPA[5].set(\rate, ~scaleA[~psetA[5]].midiratio, \t_trig, 1, \gate, 1, \tpse, 1, \dir, 1); } { msg[2] == 5} { ~oPA[5].set(\rate, ~scaleA[~psetA[5]].midiratio, \t_trig, 1, \gate, 1, \tpse, 1, \dir, 1, \loop, 0, \spos, 0); }
{ msg[2] == 6} { ~oPA[6].set(\rate, ~scaleA[~psetA[6]].midiratio, \t_trig, 1, \gate, 1, \tpse, 1, \dir, 1); } { msg[2] == 6} { ~oPA[6].set(\rate, ~scaleA[~psetA[6]].midiratio, \t_trig, 1, \gate, 1, \tpse, 1, \dir, 1, \loop, 0, \spos, 0); }
// TODO: LOGIC TO FIX NEXT OCTAVE IN 7 NOTE VS OTHER NOTE LENGTH SCALES ~psetA.size // TODO: LOGIC TO FIX NEXT OCTAVE IN 7 NOTE VS OTHER NOTE LENGTH SCALES ~psetA.size
// if logic below not workingif (~scaleA.size == 7 ) {t // if logic below not workingif (~scaleA.size == 7 ) {t
@ -149,27 +162,19 @@ s.waitForBoot{
{ msg[2] == 7} { if (~scaleA.size == 7 ) { { msg[2] == 7} { if (~scaleA.size == 7 ) {
~oPA[7].set(\rate, ~scaleA[~psetA[0]].midiratio + 1 ,\t_trig, 1, \gate, 1, \tpse, 1); ~oPA[7].set(\rate, ~scaleA[~psetA[0]].midiratio + 1 ,\t_trig, 1, \gate, 1, \tpse, 1, \loop, 0, \spos, 0);
postln("notes in scale: " + ~scaleA );}; postln("notes in scale: " + ~scaleA );};
if (~scaleA.size == 12 ) { ~oPA[7].set(\te, ~scaleA[~psetA[0]].midiratio,\t_trig, 1, \gate, 1, \tpse, 2); if (~scaleA.size == 12 ) { ~oPA[7].set(\rate, ~scaleA[~psetA[0]].midiratio,\t_trig, 1, \gate, 1, \tpse, 2, \loop, 0, \spos, 0);
postln("notes in scale: " + ~scaleA + "not>>> debug");} postln("notes in scale: " + ~scaleA + "not>>> debug");}
} }
} { ~dirStateA.put(msg[2],0); } {
postln("release"); ~dirStateA.put(msg[2],0);
//postln("release");
} // if first 8 sensors are released after being touched set state to } // if first 8 sensors are released after being touched set state to
}; };
// LOOP mode on off // GROUP //////////////////////////////
if ( msg[2] == 8 && msg[3] == 0 ) { // release 7 = toggle looping of all samplers
~lsA = (~lsA + 1)% 2;
~sGA.set(\loop, ~lsA ); // toggle this
b.sendMsg("/led", msg[2], ~lsA, msg[4]);
postln("LOOP: " + ~lsA );
};
// SHIFT state /////////////////////////////////// // SHIFT state ///////////////////////////////////
if ( msg[2] == 11 ) { if ( msg[2] == 11 ) {
@ -187,19 +192,62 @@ s.waitForBoot{
{ ~ctrlA = 0; postln("CTRL disabled" ); b.sendMsg("/led", msg[2], ~ctrlA, msg[4]);}; { ~ctrlA = 0; postln("CTRL disabled" ); b.sendMsg("/led", msg[2], ~ctrlA, msg[4]);};
}; };
// LOOP state ////////////////////////////////////
if (msg[2] == 8 ) {
if (msg[3]==1){
~loopA = 1; postln("LOOP READY"); b.sendMsg("/led", msg[2], ~loopA, msg[4])}
{ ~loopA = 0; b.sendMsg("/led", msg[2], ~loopA, msg[4])};
};
// LOOP GROUP mode on off // GROUP //////////////////////////////
if ( ~ctrlA == 1 && ~shiftA == 0 && msg[2] == 8 && msg[3] == 0 ) {
// release 7 = toggle looping of all samplers
~lsA = (~lsA + 1)% 2;
~sGA.set(\loop, ~lsA ); // toggle this
b.sendMsg("/led", msg[2], ~lsA, msg[4]);
postln("LOOP: " + ~lsA );
};
// INDIVIDUAL LOOPS ///////////////////////////////////////////////////
if (~loopA == 1 ) { // while control pressed
if (msg[2] < 8 ){ // only applies to the first 8 sensors
if (msg[3] == 1 ){ // if touched
postln("LOOP sample @ index: " ++ msg[2] );
~loopStateA.put(msg[2],1);
postln("loop state {all} : " ++ ~loopStateA);
w = case
{ msg[2] == 0} { ~oPA[0].set(\loop, 1 ); }
{ msg[2] == 1} { ~oPA[1].set(\loop, 1 ); }
{ msg[2] == 2} { ~oPA[2].set(\loop, 1 ); }
{ msg[2] == 3} { ~oPA[3].set(\loop, 1 ); }
{ msg[2] == 4} { ~oPA[4].set(\loop, 1 ); }
{ msg[2] == 5} { ~oPA[5].set(\loop, 1 ); }
{ msg[2] == 6} { ~oPA[6].set(\loop, 1 ); }
{ msg[2] == 7} { ~oPA[7].set(\loop, 1 ); }
} {
//~dirStateA.put(msg[2],1);
//postln("loop release");
} // if not 1 (released after CTRL+touch)
} // set the state for neopixel // when released
};
// SCALE CHANGER --------------------------------- // SCALE CHANGER ---------------------------------
if (~shiftA==1 && msg[2] == 9 && msg[3] == 1) { if (~shiftA==1 && msg[2] == 9 && msg[3] == 1) {
if (msg[3]==1){
~ssA = (~ssA + 1) % 14; // fourteen slots for scales ~ssA = (~ssA + 1) % 14; // fourteen slots for scales
// use key release to // use key release to
~scaleA = ~scaleMode[~ssA]; ~scaleA = ~scaleMode[~ssA];
postln("SCALE: " + ~scaleA.name + " : " + ~scaleA); postln("SCALE: " + ~scaleA.name + " : " + ~scaleA);
//b.sendMsg("/led", 9, ~ssA, msg[4]); b.sendMsg("/led", 9, ~ssA, msg[4]);
}; };
// todo color code for SCALE CHANGER... red not updating // todo color code for SCALE CHANGER... red not updating
b.sendMsg("/led", msg[2], ~ssA, msg[4]); //b.sendMsg("/led", 9, ~ssA, msg[4]);
};
// PITCH SET SCRAMBLER --------------------------------- // PITCH SET SCRAMBLER ---------------------------------
@ -222,7 +270,8 @@ s.waitForBoot{
// use key release to // use key release to
~sdir = ~sampleDir[~smpA]; ~sdir = ~sampleDir[~smpA];
postln("NEW SAMPLE DIRECTORY SELECTED:"+ ~sampleDir[~smpA+1] + " : " + ~sampleDir); postln("NEW SAMPLE DIRECTORY SELECTED:"+ ~sampleDir[~smpA] + " : " + ~sampleDir);
b.sendMsg("/led", 8, ~smpA, msg[4]);
}; };
@ -239,7 +288,7 @@ s.waitForBoot{
{ msg[2] == 6} { ~oPA[6].set(\bufnum, ~smp[\bowl][0]); } { msg[2] == 6} { ~oPA[6].set(\bufnum, ~smp[\bowl][0]); }
{ msg[2] == 7} { ~oPA[7].set(\bufnum, ~smp[\bowl][0]); }; { msg[2] == 7} { ~oPA[7].set(\bufnum, ~smp[\bowl][0]); };
b.sendMsg("/led", 9, ~smpA, msg[4]); b.sendMsg("/led", 8, ~smpA, msg[4]);
}; };
if (~smpA == 1){ if (~smpA == 1){
@ -254,37 +303,37 @@ s.waitForBoot{
{ msg[2] == 6} { ~oPA[6].set(\bufnum, x[2]); } { msg[2] == 6} { ~oPA[6].set(\bufnum, x[2]); }
{ msg[2] == 7} { ~oPA[7].set(\bufnum, x[3]); }; { msg[2] == 7} { ~oPA[7].set(\bufnum, x[3]); };
b.sendMsg("/led", 9, ~smpA, msg[4]); b.sendMsg("/led", 8, ~smpA, msg[4]);
}; };
if (~smpA == 2){ if (~smpA == 2){
x =~smp[\blue]; x =~smp[\bowed];
w = case w = case
{ msg[2] == 0} { ~oPA[0].set(\bufnum, x[0]); } { msg[2] == 0} { ~oPA[0].set(\bufnum, x[0]); }
{ msg[2] == 1} { ~oPA[1].set(\bufnum, x[1]); } { msg[2] == 1} { ~oPA[1].set(\bufnum, x[0]); }
{ msg[2] == 2} { ~oPA[2].set(\bufnum, x[1]); } { msg[2] == 2} { ~oPA[2].set(\bufnum, x[0]); }
{ msg[2] == 3} { ~oPA[3].set(\bufnum, x[1]); } { msg[2] == 3} { ~oPA[3].set(\bufnum, x[0]); }
{ msg[2] == 4} { ~oPA[4].set(\bufnum, x[2]); } { msg[2] == 4} { ~oPA[4].set(\bufnum, x[0]); }
{ msg[2] == 5} { ~oPA[5].set(\bufnum, x[2]); } { msg[2] == 5} { ~oPA[5].set(\bufnum, x[0]); }
{ msg[2] == 6} { ~oPA[6].set(\bufnum, x[2]); } { msg[2] == 6} { ~oPA[6].set(\bufnum, x[0]); }
{ msg[2] == 7} { ~oPA[7].set(\bufnum, x[3]); }; { msg[2] == 7} { ~oPA[7].set(\bufnum, x[0]); };
b.sendMsg("/led", 9, ~smpA, msg[4]); b.sendMsg("/led", 8, ~smpA, msg[4]);
}; };
if (~smpA == 3){ if (~smpA == 3){
x =~smp[\red]; x =~smp[\zither];
w = case w = case
{ msg[2] == 0} { ~oPA[0].set(\bufnum, x[0]); } { msg[2] == 0} { ~oPA[0].set(\bufnum, x[0]); }
{ msg[2] == 1} { ~oPA[1].set(\bufnum, x[1]); } { msg[2] == 1} { ~oPA[1].set(\bufnum, x[0]); }
{ msg[2] == 2} { ~oPA[2].set(\bufnum, x[1]); } { msg[2] == 2} { ~oPA[2].set(\bufnum, x[0]); }
{ msg[2] == 3} { ~oPA[3].set(\bufnum, x[1]); } { msg[2] == 3} { ~oPA[3].set(\bufnum, x[0]); }
{ msg[2] == 4} { ~oPA[4].set(\bufnum, x[2]); } { msg[2] == 4} { ~oPA[4].set(\bufnum, x[0]); }
{ msg[2] == 5} { ~oPA[5].set(\bufnum, x[2]); } { msg[2] == 5} { ~oPA[5].set(\bufnum, x[0]); }
{ msg[2] == 6} { ~oPA[6].set(\bufnum, x[2]); } { msg[2] == 6} { ~oPA[6].set(\bufnum, x[0]); }
{ msg[2] == 7} { ~oPA[7].set(\bufnum, x[3]); }; { msg[2] == 7} { ~oPA[7].set(\bufnum, x[0]); };
b.sendMsg("/led", 9, ~smpA, msg[4]); b.sendMsg("/led", 8, ~smpA, msg[4]);
}; };
// REVERSE SAMPLES //////////////////////////////////////////// // REVERSE SAMPLES ////////////////////////////////////////////
@ -294,14 +343,14 @@ s.waitForBoot{
if (msg[3] == 1 ){ // if touched if (msg[3] == 1 ){ // if touched
postln("reverse sample @ index: " + msg[2] ); postln("reverse sample @ index: " + msg[2] );
w = case w = case
{ msg[2] == 0} { ~oPA[0].set(\dir, -1, \spos, 44100); } { msg[2] == 0} { ~oPA[0].set(\dir, -1, \spos, 441000, \loop, 1 ); }
{ msg[2] == 1} { ~oPA[1].set(\dir, -1, \t_trig, 1, \gate, 1, ); } { msg[2] == 1} { ~oPA[1].set(\dir, -1, \spos, 441000, \loop, 1 ); }
{ msg[2] == 2} { ~oPA[2].set(\dir, -1 ); } { msg[2] == 2} { ~oPA[2].set(\dir, -1, \spos, 441000, \loop, 1 ); }
{ msg[2] == 3} { ~oPA[3].set(\dir, -1 ); } { msg[2] == 3} { ~oPA[3].set(\dir, -1, \spos, 441000, \loop, 1 ); }
{ msg[2] == 4} { ~oPA[4].set(\dir, -1 ); } { msg[2] == 4} { ~oPA[4].set(\dir, -1, \spos, 441000, \loop, 1 ); }
{ msg[2] == 5} { ~oPA[5].set(\dir, -1 ); } { msg[2] == 5} { ~oPA[5].set(\dir, -1, \spos, 441000, \loop, 1 ); }
{ msg[2] == 6} { ~oPA[6].set(\dir, -1 ); } { msg[2] == 6} { ~oPA[6].set(\dir, -1, \spos, 441000, \loop, 1 ); }
{ msg[2] == 7} { ~oPA[7].set(\dir, -1 ); } { msg[2] == 7} { ~oPA[7].set(\dir, -1, \spos, 441000, \loop, 1 ); }
} { ~dirStateA.put(msg[2],1); } { ~dirStateA.put(msg[2],1);
postln("set direction state to 1 reverse magenta"); postln("set direction state to 1 reverse magenta");
} // if not 1 (released after CTRL+touch) } // if not 1 (released after CTRL+touch)
@ -314,7 +363,7 @@ s.waitForBoot{
if (msg[3]==1){ if (msg[3]==1){
~transpositionsA = ~transpositionsA+1 % 6; ~transpositionsA = ~transpositionsA+1 % 6;
w = case w = case
{ ~transpositionsA == 0} { postln("MODE: ------> NORMAL" ); } { ~transpositionsA == 0} { postln("MODE: ----------------------------> NORMAL" ); }
{ ~transpositionsA == 1} { postln("MODE: ------> TRANSPOSE ---- 1 8VE-DOWN" ); } { ~transpositionsA == 1} { postln("MODE: ------> TRANSPOSE ---- 1 8VE-DOWN" ); }
{ ~transpositionsA == 2} { postln("MODE: ------> TRANSPOSE ---- 2 8VE-DOWN" ); } { ~transpositionsA == 2} { postln("MODE: ------> TRANSPOSE ---- 2 8VE-DOWN" ); }
{ ~transpositionsA == 3} { postln("MODE: ------> TRANSPOSE ---- 1 8VE-UP" ); } { ~transpositionsA == 3} { postln("MODE: ------> TRANSPOSE ---- 1 8VE-UP" ); }
@ -446,13 +495,13 @@ s.waitForBoot{
b.sendMsg("/led", msg[2], ~psetB[msg[2]], msg[4]); b.sendMsg("/led", msg[2], ~psetB[msg[2]], msg[4]);
w = case w = case
{ msg[2] == 0} { ~oPB[0].set(\rate, ~scaleB[~psetB[0]].midiratio, \t_trig, 1, \gate, 1, \tpse, 1, \dir, 1); } { msg[2] == 0} { ~oPB[0].set(\rate, ~scaleB[~psetB[0]].midiratio, \t_trig, 1, \gate, 1, \tpse, 1, \dir, 1, \loop, 0); }
{ msg[2] == 1} { ~oPB[1].set(\rate, ~scaleB[~psetB[1]].midiratio, \t_trig, 1, \gate, 1, \tpse, 1, \dir, 1); } { msg[2] == 1} { ~oPB[1].set(\rate, ~scaleB[~psetB[1]].midiratio, \t_trig, 1, \gate, 1, \tpse, 1, \dir, 1, \loop, 0); }
{ msg[2] == 2} { ~oPB[2].set(\rate, ~scaleB[~psetB[2]].midiratio, \t_trig, 1, \gate, 1, \tpse, 1, \dir, 1); } { msg[2] == 2} { ~oPB[2].set(\rate, ~scaleB[~psetB[2]].midiratio, \t_trig, 1, \gate, 1, \tpse, 1, \dir, 1, \loop, 0); }
{ msg[2] == 3} { ~oPB[3].set(\rate, ~scaleB[~psetB[3]].midiratio, \t_trig, 1, \gate, 1, \tpse, 1, \dir, 1); } { msg[2] == 3} { ~oPB[3].set(\rate, ~scaleB[~psetB[3]].midiratio, \t_trig, 1, \gate, 1, \tpse, 1, \dir, 1, \loop, 0); }
{ msg[2] == 4} { ~oPB[4].set(\rate, ~scaleB[~psetB[4]].midiratio, \t_trig, 1, \gate, 1, \tpse, 1, \dir, 1); } { msg[2] == 4} { ~oPB[4].set(\rate, ~scaleB[~psetB[4]].midiratio, \t_trig, 1, \gate, 1, \tpse, 1, \dir, 1, \loop, 0); }
{ msg[2] == 5} { ~oPB[5].set(\rate, ~scaleB[~psetB[5]].midiratio, \t_trig, 1, \gate, 1, \tpse, 1, \dir, 1); } { msg[2] == 5} { ~oPB[5].set(\rate, ~scaleB[~psetB[5]].midiratio, \t_trig, 1, \gate, 1, \tpse, 1, \dir, 1, \loop, 0); }
{ msg[2] == 6} { ~oPB[6].set(\rate, ~scaleB[~psetB[6]].midiratio, \t_trig, 1, \gate, 1, \tpse, 1, \dir, 1); } { msg[2] == 6} { ~oPB[6].set(\rate, ~scaleB[~psetB[6]].midiratio, \t_trig, 1, \gate, 1, \tpse, 1, \dir, 1, \loop, 0); }
// TODO: LOGIC TO FIX NEXT OCTAVE IN 7 NOTE VS OTHER NOTE LENGTH SCALES ~psetA.size // TODO: LOGIC TO FIX NEXT OCTAVE IN 7 NOTE VS OTHER NOTE LENGTH SCALES ~psetA.size
// if logic below not workingif (~scaleB.size == 7 ) {t // if logic below not workingif (~scaleB.size == 7 ) {t
@ -463,7 +512,7 @@ s.waitForBoot{
~oPB[7].set(\rate, ~scaleB[~psetB[0]].midiratio + 1 ,\t_trig, 1, \gate, 1, \tpse, 1); ~oPB[7].set(\rate, ~scaleB[~psetB[0]].midiratio + 1 ,\t_trig, 1, \gate, 1, \tpse, 1);
postln("notes in scale: " + ~scaleB );}; postln("notes in scale: " + ~scaleB );};
if (~scaleB.size == 12 ) { ~oPB[7].set(\te, ~scaleB[~psetB[0]].midiratio,\t_trig, 1, \gate, 1, \tpse, 2); if (~scaleB.size == 12 ) { ~oPB[7].set(\rate, ~scaleB[~psetB[0]].midiratio,\t_trig, 1, \gate, 1, \tpse, 2);
postln("notes in scale: " + ~scaleB + "not>>> debug");} postln("notes in scale: " + ~scaleB + "not>>> debug");}
} }
} { ~dirStateB.put(msg[2],0); } { ~dirStateB.put(msg[2],0);
@ -533,7 +582,7 @@ s.waitForBoot{
// use key release to // use key release to
~sdir = ~sampleDir[~smpB]; ~sdir = ~sampleDir[~smpB];
postln("NEW SAMPLE DIRECTORY SELECTED:"+ ~sampleDir[~smpB+1] + " : " + ~sampleDir); postln("NEW SAMPLE DIRECTORY SELECTED:"+ ~sampleDir[~smpB] + " : " + ~sampleDir);
}; };
@ -569,31 +618,31 @@ s.waitForBoot{
}; };
if (~smpB == 2){ if (~smpB == 2){
x =~smp[\blue]; x =~smp[\bowed];
w = case w = case
{ msg[2] == 0} { ~oPB[0].set(\bufnum, x[0]); } { msg[2] == 0} { ~oPB[0].set(\bufnum, x[0]); }
{ msg[2] == 1} { ~oPB[1].set(\bufnum, x[1]); } { msg[2] == 1} { ~oPB[1].set(\bufnum, x[0]); }
{ msg[2] == 2} { ~oPB[2].set(\bufnum, x[1]); } { msg[2] == 2} { ~oPB[2].set(\bufnum, x[0]); }
{ msg[2] == 3} { ~oPB[3].set(\bufnum, x[1]); } { msg[2] == 3} { ~oPB[3].set(\bufnum, x[0]); }
{ msg[2] == 4} { ~oPB[4].set(\bufnum, x[2]); } { msg[2] == 4} { ~oPB[4].set(\bufnum, x[0]); }
{ msg[2] == 5} { ~oPB[5].set(\bufnum, x[2]); } { msg[2] == 5} { ~oPB[5].set(\bufnum, x[0]); }
{ msg[2] == 6} { ~oPB[6].set(\bufnum, x[2]); } { msg[2] == 6} { ~oPB[6].set(\bufnum, x[0]); }
{ msg[2] == 7} { ~oPB[7].set(\bufnum, x[3]); }; { msg[2] == 7} { ~oPB[7].set(\bufnum, x[0]); };
b.sendMsg("/led", 9, ~smpB, msg[4]); b.sendMsg("/led", 16, ~smpB, msg[4]);
}; };
if (~smpB == 3){ if (~smpB == 3){
x =~smp[\red]; x =~smp[\zither];
w = case w = case
{ msg[2] == 0} { ~oPB[0].set(\bufnum, x[0]); } { msg[2] == 0} { ~oPB[0].set(\bufnum, x[0]); }
{ msg[2] == 1} { ~oPB[1].set(\bufnum, x[1]); } { msg[2] == 1} { ~oPB[1].set(\bufnum, x[0]); }
{ msg[2] == 2} { ~oPB[2].set(\bufnum, x[1]); } { msg[2] == 2} { ~oPB[2].set(\bufnum, x[0]); }
{ msg[2] == 3} { ~oPB[3].set(\bufnum, x[1]); } { msg[2] == 3} { ~oPB[3].set(\bufnum, x[0]); }
{ msg[2] == 4} { ~oPB[4].set(\bufnum, x[2]); } { msg[2] == 4} { ~oPB[4].set(\bufnum, x[0]); }
{ msg[2] == 5} { ~oPB[5].set(\bufnum, x[2]); } { msg[2] == 5} { ~oPB[5].set(\bufnum, x[0]); }
{ msg[2] == 6} { ~oPB[6].set(\bufnum, x[2]); } { msg[2] == 6} { ~oPB[6].set(\bufnum, x[0]); }
{ msg[2] == 7} { ~oPB[7].set(\bufnum, x[3]); }; { msg[2] == 7} { ~oPB[7].set(\bufnum, x[0]); };
b.sendMsg("/led", 9, ~smpB, msg[4]); b.sendMsg("/led", 9, ~smpB, msg[4]);
}; };
@ -751,7 +800,7 @@ s.waitForBoot{
~sG.set(\amp, 1); ~sG.set(\amp, 1);
~sG.set(\rate, -1); ~sG.set(\rate, -1);
~sGB.set(\amp, 0.2); //~sGB.set(\amp, 0.2);
"patch loaded and ready...".postln; "patch loaded and ready...".postln;