scale and sample bank changer and LED improvements

master
Rob Canning 2023-09-16 10:35:11 +02:00
parent dc967ec68e
commit 5e11d493fd
2 changed files with 250 additions and 82 deletions

View File

@ -164,8 +164,7 @@ void connectWiFi(){
//NEOPIXEL COLOUR LOGIC ///////////////////////////////////////////// //NEOPIXEL COLOUR LOGIC /////////////////////////////////////////////
uint32_t colors[] = {RED, GREEN, BLUE, YELLOW, CYAN, MAGENTA, uint32_t colors[] = {RED, GREEN, BLUE, YELLOW, CYAN, MAGENTA, PURPLE, ORANGE, PINK, GRAY, ULTRAWHITE, WHITE, BLACK };
PURPLE, ORANGE, PINK, GRAY, ULTRAWHITE, WHITE, BLACK };
void led(OSCMessage &msg) { void led(OSCMessage &msg) {
@ -175,7 +174,7 @@ void led(OSCMessage &msg) {
// increment led index based on which board input i.e. board 1 is 0-11, board 2 is 12 - 24 // increment led index based on which board input i.e. board 1 is 0-11, board 2 is 12 - 24
if (touchBoard==0){ledNum = ledNum + 0; }; if (touchBoard==0){ledNum = ledNum + 0; };
if (touchBoard==1){ledNum = ledNum+6; }; // change to 12 when new strip wired! 6 for testing if (touchBoard==1){ledNum = ledNum+12; }; // change to 12 when new strip wired! 6 for testing
switch (msg.getInt(1)) { switch (msg.getInt(1)) {
ws2812fx.setMode(FX_MODE_BLINK); ws2812fx.setMode(FX_MODE_BLINK);
@ -215,7 +214,25 @@ void led(OSCMessage &msg) {
case 6: case 6:
ws2812fx.setPixelColor(ledNum, colors[ledState]); ws2812fx.setPixelColor(ledNum, colors[ledState]);
break; break;
case 7:
ws2812fx.setPixelColor(ledNum, colors[ledState]);
break;
case 8:
ws2812fx.setPixelColor(ledNum, colors[ledState]);
break;
case 9:
ws2812fx.setPixelColor(ledNum, colors[ledState]);
break;
case 10:
ws2812fx.setPixelColor(ledNum, colors[ledState]);
break;
case 11:
ws2812fx.setPixelColor(ledNum, colors[ledState]);
break;
case 12:
ws2812fx.setPixelColor(ledNum, colors[ledState]);
break;
ws2812fx.start(); ws2812fx.start();
} }

View File

@ -15,6 +15,7 @@ s.waitForBoot{
//~samplepath = thisProcess.nowExecutingPath.dirname ++ "/samples"; //~samplepath = thisProcess.nowExecutingPath.dirname ++ "/samples";
~samplepath = "/home/rob/pifcamp2023/sc/samples"; // CHANGE THIS TO YOUR OWN PATH ~samplepath = "/home/rob/pifcamp2023/sc/samples"; // CHANGE THIS TO YOUR OWN PATH
~smp = Dictionary.new; ~smp = Dictionary.new;
//~smp[\green];
PathName(~samplepath).entries.do{ PathName(~samplepath).entries.do{
arg subfolder; arg subfolder;
@ -36,18 +37,15 @@ s.waitForBoot{
// create group order // create group order
~sGA = Group.new; ~sGB = Group.new; ~sGC = Group.new; ~sGD = Group.new; ~sGA = Group.new; ~sGB = Group.new; ~sGC = Group.new; ~sGD = Group.new;
s.sync; s.sync;
//// SYNTHS ////////////////////////////////// //// SYNTHS //////////////////////////////////
SynthDef.new(\splay, {| out=0, bufnum=0, tpse=1, t_trig=0, amp=0.8, rate=1, SynthDef.new(\splay, {| out=0, bufnum=0, tpse=1, t_trig=0, amp=0.8, rate=1,
atk=1, rel=1, loop=0, spos=0, gate=0, panRate=0.2 | atk=1, rel=1, loop=0, spos=0, gate=0, panRate=0.2, dir=1 |
var env, sig; var env, sig;
env= EnvGen.kr(Env.asr(atk,1,rel),gate, doneAction:2); env= EnvGen.kr(Env.asr(atk,1,rel),gate, doneAction:2);
sig = PlayBuf.ar(1, bufnum, rate*tpse, 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));
Out.ar(out, sig); Out.ar(out, sig);
@ -58,7 +56,7 @@ 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=1, panRate=rrand(0.05,0.75), group=~sGA; amp=0.9, loop=1, 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({
@ -69,6 +67,7 @@ s.waitForBoot{
// RECEIVE OSC MESSAGES FROM ESP32s // RECEIVE OSC MESSAGES FROM ESP32s
~modeA = 0; ~modeA = 0;
~modeB = 0; ~modeB = 0;
~modeC = 0; ~modeC = 0;
@ -79,18 +78,29 @@ s.waitForBoot{
~shiftC = 0; // shift state ~shiftC = 0; // shift state
~shiftD = 0; // shift state ~shiftD = 0; // shift state
~scaleMode = [Scale.partch_o1, Scale.major, Scale.minor, Scale.chromatic]; ~ctrlA = 0; // ctrl state
~scaleA = ~scaleMode[0]; ~ctrlB = 0; // ctrl state
~scaleB = ~scaleMode[3];
~sampleDir = [\green, \bowl, \blue, \green];
~lsA=1; // loop state ~lsA=1; // loop state
~lsB=1; // loop state ~lsB=1; // loop state
~ssA = 0;
~scaleMode = [Scale.major, Scale.minor, Scale.chromatic, Scale.ajam.pitchesPerOctave];
~scaleA = ~scaleMode[0];
~scaleB = ~scaleMode[3];
~ssA = 0; // scale index
~ssB = 0; ~ssB = 0;
//~scales[2].tuning; ~scales[2].size; ~scales[2].pitchesPerOcatave; ~psetA = Array.series(~scaleA.size, start: 0, step: 1);
~psetB = Array.series(~scaleB.size, start: 0, step: 1);
~smpA = 0; // sample bank index
~smpB = 0;
//~scales[2].tuning; ~scales[2].size; ~scales[2].pitchesPerOcatave;
s.sync; s.sync;
@ -101,111 +111,251 @@ s.waitForBoot{
// msg[3] is it a touch [1] or a release [0] // msg[3] is it a touch [1] or a release [0]
// msg[4] which of the connected mpr121 boards is sending // msg[4] which of the connected mpr121 boards is sending
if (msg[1] == mac && msg[3] == 1 && msg[4] == 0 && ~shiftA == 0 ) { if (msg[2] < 8) { // when not touched turn led 0-7 black/off(12) gray/9
//12.0.rand.round; if (msg[1] == mac && msg[3] == 0 && msg[4] == 0 ) {
// use an array to spread different patterns over the keys b.sendMsg("/led", msg[2], 7, msg[4]);
~rpitch = rrand(0,~scaleA.size -1); };
postln("first board" + msg[2] + "pitchclass: " + ~rpitch ); };
b.sendMsg("/led", msg[2], ~rpitch, msg[4]);
if (msg[1] == mac && msg[3] == 1 && msg[4] == 0 ) {
postln("PITCHCLASS: " + ~psetA[msg[2]] );
b.sendMsg("/led", msg[2], ~psetA[msg[2]], msg[4]);
w = case w = case
{ msg[2] == 0} { ~oPA[0].set(\rate, ~scaleA[~rpitch].midiratio, \t_trig, 1, \gate, 1, \tpse, 1); } { msg[2] == 0} { ~oPA[0].set(\rate, ~scaleA[~psetA[0]].midiratio, \t_trig, 1, \gate, 1, \tpse, 1, \dir, 1); }
{ msg[2] == 1} { ~oPA[1].set(\rate, ~scaleA[0].midiratio, \t_trig, 1, \gate, 1, \tpse, 1); } { msg[2] == 1} { ~oPA[1].set(\rate, ~scaleA[~psetA[1]].midiratio, \t_trig, 1, \gate, 1, \tpse, 1, \dir, 1); }
// always have a know root { 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[~rpitch].midiratio, \t_trig, 1, \gate, 1, \tpse, 1); } { 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[~rpitch].midiratio, \t_trig, 1, \gate, 1, \tpse, 1); } { 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[~rpitch].midiratio, \t_trig, 1, \gate, 1, \tpse, 1); } { 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[~rpitch].midiratio, \t_trig, 1, \gate, 1, \tpse, 1); } { 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[~rpitch].midiratio, \t_trig, 1, \gate, 1, \tpse, 1); } { msg[2] == 7} { ~oPA[7].set(\rate, ~scaleA[~psetA[7]].midiratio + 1 , \t_trig, 1, \gate, 1); }
{ msg[2] == 7} { ~oPA[7].set(\rate, ~scaleA[~rpitch].midiratio + 1 , \t_trig, 1, \gate, 1); }
// LOOP mode on off // LOOP mode on off
{ msg[2] == 8 } { // touch 7 = toggle looping of all samplers { msg[2] == 8 } { // touch 7 = toggle looping of all samplers
~lsA = (~lsA + 1)% 2; ~lsA = (~lsA + 1)% 2;
~sGA.set(\loop, ~lsA ); // toggle this ~sGA.set(\loop, ~lsA ); // toggle this
b.sendMsg("/led", msg[2], ~lsA, msg[4]); b.sendMsg("/led", msg[2], ~lsA, msg[4]);
postln("loop state set as:" + ~lsA + " 7 " + msg[2] ); postln("LOOP: " + ~lsA );
}; };
}; };
// SHIFT logic for board A - 3 function= shift off on extra // SHIFT logic for board A - 2 function= shift off on
///if SHIFT IS DEPRESSED on board 0 - shift enabled while 11 depressed ///if SHIFT IS DEPRESSED on board 0 - shift enabled while 11 depressed
/* if (msg[1] == mac && msg[2] == 11 && msg[4] == 0 ) {
if (msg[3]==1){
~shiftA = (~shiftA + 1)% 3;
postln("SHIFT: " + ~shiftA);
b.sendMsg("/led", msg[2], ~shiftA, msg[4]);
};
};*/
// SHIFT state
if (msg[1] == mac && msg[2] == 11 && msg[4] == 0 ) { if (msg[1] == mac && msg[2] == 11 && msg[4] == 0 ) {
if (msg[3]==1){ if (msg[3]==1){
~shiftA = (~shiftA + 1)% 3; ~shiftA = 1; postln("shift is enabled" )}
postln("SHIFT is: " + ~shiftA); { ~shiftA = 0; postln("shift is disabled" )};
b.sendMsg("/led", msg[2], ~shiftA, msg[4]); b.sendMsg("/led", msg[2], ~shiftA, msg[4]);
};
}; };
if (~shiftA==1 && msg[3]==1) { // CTRL state
postln(" shift is pressed " + msg[2]);
w = case if (msg[1] == mac && msg[2] == 10 && msg[4] == 0 ) {
{ msg[2] == 0} { ~oPA[0].set(\tpse, 2, \t_trig, 1); } if (msg[3]==1){
{ msg[2] == 1} { ~oPA[1].set(\tpse, 2, \t_trig, 1); } ~ctrlA = 1; postln("ctrl is enabled" ); b.sendMsg("/led", msg[2], ~ctrlA, msg[4]);}
{ msg[2] == 2} { ~oPA[2].set(\tpse, 2, \t_trig, 1); } { ~ctrlA = 0; postln("ctrl is disabled" ); b.sendMsg("/led", msg[2], ~ctrlA, msg[4]);};
{ msg[2] == 3} { ~oPA[3].set(\tpse, 2, \t_trig, 1); }
{ msg[2] == 4} { ~oPA[4].set(\tpse, 2, \t_trig, 1); }
{ msg[2] == 5} { ~oPA[5].set(\tpse, 2, \t_trig, 1); }
{ msg[2] == 6} { ~oPA[6].set(\tpse, 2, \t_trig, 1); }
{ msg[2] == 7} { ~oPA[7].set(\tpse, 2, \t_trig, 1); }
}; };
// SCALE CHANGER // SCALE CHANGER
if (~shiftA==1 && msg[2] == 8 && msg[3] == 1) { if (~shiftA==1 && msg[2] == 9 && msg[3] == 1) {
~ssA = (~ssA + 1) % 4; ~ssA = (~ssA + 1) % 4;
// use key release to // use key release to
~scaleA = ~scaleMode[~ssA]; ~scaleA = ~scaleMode[~ssA];
postln(" shift is pressed - scale changed to: " + ~ssA); postln("SCALE: " + ~scaleA.name);
b.sendMsg("/led", 9, ~ssA, msg[4]); b.sendMsg("/led", 9, ~ssA, msg[4]);
}; };
////////////////////////////////////////////////////////////////////////// // PITCH SET SCRAMBLER
// MODE logic for board A
if (msg[1] == mac && msg[2] == 10 && msg[4] == 0 ) { if (~shiftA==0 && ~ctrlA==0 && msg[2] == 9 && msg[3] == 1) {
~psetA = Array.series(~scaleA.size+1, start: 0, step: 1).scramble;
postln(~scaleA.name + " SCALE SCRAMBLED: " + ~psetA);
b.sendMsg("/led", 9, ~ssA, msg[4]);
};
if (~shiftA==1 && ~ctrlA==0 && msg[2] == 9 && msg[3] == 1) {
~psetA = Array.series(~scaleA.size+1, start: 0, step: 1);
postln(~scaleA.name + " SCALE ORDER RESTORED: " + ~psetA);
b.sendMsg("/led", 9, ~ssA, msg[4]);
};
// SAMPLE DIRECTORY CHANGER
if (~ctrlA==1 && msg[2] == 9 && msg[3] == 1) {
~smpA = (~smpA + 1) % 4;
// use key release to
~sdir = ~sampleDir[~smpA];
//~smp[sdir]
//~sGA.set(\sdir, \green); // toggle this
//~sGA.set(\bufnum, ~smp[\green][1]);
};
if (~smpA == 0){
w = case
{ msg[2] == 0} { ~oPA[0].set(\bufnum, ~smp[\bowl][0]); }
{ msg[2] == 1} { ~oPA[1].set(\bufnum, ~smp[\bowl][0]); }
{ msg[2] == 2} { ~oPA[2].set(\bufnum, ~smp[\bowl][0]); }
{ msg[2] == 3} { ~oPA[3].set(\bufnum, ~smp[\bowl][0]); }
{ msg[2] == 4} { ~oPA[4].set(\bufnum, ~smp[\bowl][0]); }
{ msg[2] == 5} { ~oPA[5].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]); };
postln("SAMPLE DIR: " + ~smpA + " sample: " + ~smp[\bowl][0]);
b.sendMsg("/led", 9, ~smpA, msg[4]);
};
if (~smpA == 1){
x =~smp[\green];
w = case
{ msg[2] == 0} { ~oPA[0].set(\bufnum, x[0]); }
{ msg[2] == 1} { ~oPA[1].set(\bufnum, x[1]); }
{ msg[2] == 2} { ~oPA[2].set(\bufnum, x[1]); }
{ msg[2] == 3} { ~oPA[3].set(\bufnum, x[1]); }
{ msg[2] == 4} { ~oPA[4].set(\bufnum, x[2]); }
{ msg[2] == 5} { ~oPA[5].set(\bufnum, x[2]); }
{ msg[2] == 6} { ~oPA[6].set(\bufnum, x[2]); }
{ msg[2] == 7} { ~oPA[7].set(\bufnum, x[3]); };
postln("SAMPLE DIR: " + ~smpA + " sample: " + x[0] );
b.sendMsg("/led", 9, ~smpA, msg[4]);
};
//--------------------------------------------------------------------
// MODE logic for board A ////////////////////////////////////////////
if (~ctrlA == 1 && msg[1] == mac && msg[4] == 0 ) {
postln("reverse sample @ index: " + msg[2] );
w = case
{ msg[2] == 0} { ~oPA[0].set(\dir, -1); }
{ msg[2] == 1} { ~oPA[1].set(\dir, -1 ); }
{ msg[2] == 2} { ~oPA[1].set(\dir, -1 ); }
{ msg[2] == 3} { ~oPA[1].set(\dir, -1 ); }
{ msg[2] == 4} { ~oPA[1].set(\dir, -1 ); }
{ msg[2] == 5} { ~oPA[1].set(\dir, -1 ); }
{ msg[2] == 6} { ~oPA[1].set(\dir, -1 ); }
{ msg[2] == 7} { ~oPA[1].set(\dir, -1 ); }
};
// mode setter
if (~shiftA == 1 && msg[1] == mac && msg[2] == 10 && msg[4] == 0 ) {
if (msg[3]==1){ if (msg[3]==1){
// send the esp32 an osc message ~modeA = ~modeA+1 % 6;
~modeA = ~modeA+1 % 3; w = case
b.sendMsg("/led", msg[2], ~modeA, msg[4]); postln(~modeA); }; { ~modeA == 0} { postln("MODE: ------> NORMAL" ); }
{ ~modeA == 1} { postln("MODE: ------> TRANSPOSE ---- 1 8VE-DOWN" ); }
{ ~modeA == 2} { postln("MODE: ------> TRANSPOSE ---- 2 8VE-DOWN" ); }
{ ~modeA == 3} { postln("MODE: ------> TRANSPOSE ---- 1 8VE-UP" ); }
{ ~modeA == 4} { postln("MODE: ------> TRANSPOSE ---- 2 8VE-UP" ); }
{ ~modeA == 5} { postln("MODE: ------> TRANSPOSE ---- RANDOM 0.25 <-> 5" ); };
b.sendMsg("/led", msg[2], ~modeA, msg[4]);
};
b.sendMsg("/led", msg[2], ~modeA, msg[4]);
}; };
// modes ----
if (msg[1] == mac && msg[3] == 1 && msg[4] == 0 && ~modeA == 1 ) { if (~shiftA==0 && msg[1] == mac && msg[3] == 1 && msg[4] == 0 ){
w = case
{ msg[2] == 0} { ~oPA[0].set(\tpse, -1); } if (~modeA == 0) {
{ msg[2] == 1} { ~oPA[1].set(\tpse, -1 ); } w = case
{ msg[2] == 2} { ~oPA[1].set(\tpse, -1 ); } { msg[2] == 0} { ~oPA[0].set(\tpse, 1); }
{ msg[2] == 3} { ~oPA[1].set(\tpse, -1 ); } { msg[2] == 1} { ~oPA[1].set(\tpse, 1 ); }
{ msg[2] == 4} { ~oPA[1].set(\tpse, -1 ); } { msg[2] == 2} { ~oPA[1].set(\tpse, 1 ); }
{ msg[2] == 5} { ~oPA[1].set(\tpse, -1 ); } { msg[2] == 3} { ~oPA[1].set(\tpse, 1 ); }
{ msg[2] == 6} { ~oPA[1].set(\tpse, -1 ); } { msg[2] == 4} { ~oPA[1].set(\tpse, 1 ); }
{ msg[2] == 7} { ~oPA[1].set(\tpse, -1 ); } { msg[2] == 5} { ~oPA[1].set(\tpse, 1 ); }
{ msg[2] == 6} { ~oPA[1].set(\tpse, 1 ); }
{ msg[2] == 7} { ~oPA[1].set(\tpse, 1 ); }
};
if (~modeA == 1) {
w = case
{ msg[2] == 0} { ~oPA[0].set(\tpse, 0.5); }
{ msg[2] == 1} { ~oPA[1].set(\tpse, 0.5 ); }
{ msg[2] == 2} { ~oPA[2].set(\tpse, 0.5 ); }
{ msg[2] == 3} { ~oPA[3].set(\tpse, 0.5 ); }
{ msg[2] == 4} { ~oPA[4].set(\tpse, 0.5 ); }
{ msg[2] == 5} { ~oPA[5].set(\tpse, 0.5 ); }
{ msg[2] == 6} { ~oPA[6].set(\tpse, 0.5 ); }
{ msg[2] == 7} { ~oPA[7].set(\tpse, 0.5 ); }
};
if (~modeA == 2 ) {
w = case
{ msg[2] == 0} { ~oPA[0].set(\tpse, [0.25].choose ); }
{ msg[2] == 1} { ~oPA[1].set(\tpse, [0.25].choose ); }
{ msg[2] == 2} { ~oPA[2].set(\tpse, [0.25].choose ); }
{ msg[2] == 3} { ~oPA[3].set(\tpse, [0.25].choose ); }
{ msg[2] == 4} { ~oPA[4].set(\tpse, [0.25].choose ); }
{ msg[2] == 5} { ~oPA[5].set(\tpse, [0.25].choose ); }
{ msg[2] == 6} { ~oPA[6].set(\tpse, [0.25].choose ); }
{ msg[2] == 7} { ~oPA[7].set(\tpse, [0.25].choose ); }
};
if (~modeA == 3 ) {
w = case
{ msg[2] == 0} { ~oPA[0].set(\tpse, [2].choose ); }
{ msg[2] == 1} { ~oPA[1].set(\tpse, [2].choose ); }
{ msg[2] == 2} { ~oPA[2].set(\tpse, [2].choose ); }
{ msg[2] == 3} { ~oPA[3].set(\tpse, [2].choose ); }
{ msg[2] == 4} { ~oPA[4].set(\tpse, [2].choose ); }
{ msg[2] == 5} { ~oPA[5].set(\tpse, [2].choose ); }
{ msg[2] == 6} { ~oPA[6].set(\tpse, [2].choose ); }
{ msg[2] == 7} { ~oPA[7].set(\tpse, [2].choose ); }
};
if (~modeA == 4 ) {
w = case
{ msg[2] == 0} { ~oPA[0].set(\tpse, [3].choose ); }
{ msg[2] == 1} { ~oPA[1].set(\tpse, [3].choose ); }
{ msg[2] == 2} { ~oPA[2].set(\tpse, [3].choose ); }
{ msg[2] == 3} { ~oPA[3].set(\tpse, [3].choose ); }
{ msg[2] == 4} { ~oPA[4].set(\tpse, [3].choose ); }
{ msg[2] == 5} { ~oPA[5].set(\tpse, [3].choose ); }
{ msg[2] == 6} { ~oPA[6].set(\tpse, [3].choose ); }
{ msg[2] == 7} { ~oPA[7].set(\tpse, [3].choose ); }
};
if (~modeA == 5 ) {
x = [0.25, 0.5, 1, 2, 3, 4, 5];
w = case
{ msg[2] == 0} { ~oPA[0].set(\tpse, x.choose); }
{ msg[2] == 1} { ~oPA[1].set(\tpse, x.choose); }
{ msg[2] == 2} { ~oPA[2].set(\tpse, x.choose ); }
{ msg[2] == 3} { ~oPA[3].set(\tpse, x.choose ); }
{ msg[2] == 4} { ~oPA[4].set(\tpse, x.choose ); }
{ msg[2] == 5} { ~oPA[5].set(\tpse, x.choose ); }
{ msg[2] == 6} { ~oPA[6].set(\tpse, x.choose ); }
{ msg[2] == 7} { ~oPA[7].set(\tpse, x.choose ); }
};
}; };
// mode 2 randomize transposition if (~shiftA == 0 && ~ctrlA == 1 && msg[2] == 9 ){
if (msg[1] == mac && msg[3] == 1 && msg[4] == 0 && ~modeA == 2 ) {
w = case
{ msg[2] == 0} { ~oPA[0].set(\tpse, [0.25].choose); }
{ msg[2] == 1} { ~oPA[1].set(\tpse, [0.25].choose ); }
{ msg[2] == 2} { ~oPA[2].set(\tpse, [0.25].choose); }
{ msg[2] == 3} { ~oPA[3].set(\tpse, [0.25].choose ); }
{ msg[2] == 4} { ~oPA[4].set(\tpse, [0.25].choose ); }
{ msg[2] == 5} { ~oPA[5].set(\tpse, [0.25].choose ); }
{ msg[2] == 6} { ~oPA[6].set(\tpse, [0.25].choose ); }
{ msg[2] == 7} { ~oPA[7].set(\tpse, [0.25].choose ); }
}; };
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
//////////// second board //////////// second board
if (msg[1] == mac && msg[3] == 1 && msg[4] == 1) { if (msg[1] == mac && msg[3] == 1 && msg[4] == 1) {
@ -214,7 +364,6 @@ s.waitForBoot{
~rpitch = ~rpitch%11; postln("second board" + msg[2] + "color: " + ~rpitch ); ~rpitch = ~rpitch%11; postln("second board" + msg[2] + "color: " + ~rpitch );
b.sendMsg("/led", msg[2], ~rpitch, msg[4]); b.sendMsg("/led", msg[2], ~rpitch, msg[4]);
w = case w = case
{ msg[2] == 0} { ~oPB[0].set(\rate, Scale.major[0].midiratio, \t_trig, 1, \gate, 1, \tpse, 1); } { msg[2] == 0} { ~oPB[0].set(\rate, Scale.major[0].midiratio, \t_trig, 1, \gate, 1, \tpse, 1); }
{ msg[2] == 1} { ~oPB[1].set(\rate, Scale.major[1].midiratio, \t_trig, 1, \gate, 1, \tpse, 1); } { msg[2] == 1} { ~oPB[1].set(\rate, Scale.major[1].midiratio, \t_trig, 1, \gate, 1, \tpse, 1); }
@ -266,7 +415,9 @@ s.waitForBoot{
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
},'/touch') } ; },'/touch') };
s.sync; s.sync;