sensor layout plan added

master
Rob Canning 2023-09-19 01:09:01 +02:00
parent 00fcc023fe
commit 5522dbfa26
3 changed files with 351 additions and 4 deletions

44
neoGUI.md 100644
View File

@ -0,0 +1,44 @@
# TACTUS TOUCH SENSOR LAYOUT
// PLAY SENSORS // ----------------------------------
0 SAMPLE {orange} [CTRL REVERSE] {magenta} [SHIFT: TRANSPOSE]
1 SAMPLE [CTRL REVERSE] [SHIFT: TRANSPOSE]
2 SAMPLE [CTRL REVERSE] [SHIFT: TRANSPOSE]
3 SAMPLE [CTRL REVERSE] [SHIFT: TRANSPOSE]
4 SAMPLE [CTRL REVERSE] [SHIFT: TRANSPOSE]
5 SAMPLE [CTRL REVERSE] [SHIFT: TRANSPOSE]
6 SAMPLE [CTRL REVERSE] [SHIFT: TRANSPOSE]
7 SAMPLE [CTRL REVERSE] [SHIFT: TRANSPOSE]
// F-KEY SENSORS // ----------------------------------
8 LOOP ON/OFF {red/green} [EMPTY] [SHIFT: +SAMPLE DIR]
9 SCRAMBLE SET [CTRL: REORDER SET] [SHIFT: +SCALE ]
10 CTRL [SHIFT: TRANSPOSE]
11 SHIFT [CTRL: TRANSPOSE]
// SCALES: // ------------------------------------
0: Major [red]
1: Minor [green]
2: melodic [blue]
3: minorPENTATONIC
4: IONIAN [PYTHAGOREAN]
5: WHOLETONE
6: CHROMATIC
7: GONG
8: INDIAN
9: EGYPTIAN
// TRANSPOSITION MODES: // -----------------------
RED: UNTRANSPOSED
GREEN: 1 OCTAVE DOWN
BLUE: 2 OCTAVES DOWN
YELLOW: 1 OCTAVES UP
CYAN: 2 OCTAVES UP
MAGENTA: RANDOM OCTAVE DISPLACEMENT

View File

@ -425,12 +425,315 @@ s.waitForBoot{
};
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////
// board 2 logic here
if (msg[1] == mac && msg[4] == 1 ) {
if (msg[2] < 8) { // if sensor 0 - 7 and looper
if ( msg[3]== 1 ) {
postln("PITCHCLASS: " + ~psetB[msg[2]] );
b.sendMsg("/led", msg[2], ~psetB[msg[2]], msg[4]);
w = case
{ msg[2] == 0} { ~oPB[0].set(\rate, ~scaleB[~psetB[0]].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); }
{ msg[2] == 2} { ~oPB[2].set(\rate, ~scaleB[~psetB[2]].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); }
{ msg[2] == 4} { ~oPB[4].set(\rate, ~scaleB[~psetB[4]].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); }
{ msg[2] == 6} { ~oPB[6].set(\rate, ~scaleB[~psetB[6]].midiratio, \t_trig, 1, \gate, 1, \tpse, 1, \dir, 1); }
// 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
//{ msg[2] == 7} { ~oPB[7].set(\rate, ~scaleB[~psetB[7]].midiratio,\t_trig, 1, \gate, 1, \tpse, 1); }
{ msg[2] == 7} { if (~scaleB.size == 7 ) {
~oPB[7].set(\rate, ~scaleB[~psetB[0]].midiratio + 1 ,\t_trig, 1, \gate, 1, \tpse, 1);
postln("notes in scale: " + ~scaleB );};
if (~scaleB.size == 12 ) { ~oPB[7].set(\te, ~scaleB[~psetB[0]].midiratio,\t_trig, 1, \gate, 1, \tpse, 2);
postln("notes in scale: " + ~scaleB + "not>>> debug");}
}
} { ~dirStateB.put(msg[2],0);
postln("release");
} // 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
~lsB = (~lsB + 1)% 2;
~sGB.set(\loop, ~lsB ); // toggle this
b.sendMsg("/led", msg[2], ~lsB, msg[4]);
postln("LOOP: " + ~lsB );
};
// SHIFT state ///////////////////////////////////
if ( msg[2] == 11 ) {
if (msg[3]==1){
~shiftB = 1; postln("shift is enabled" )}
{ ~shiftB = 0; postln("shift is disabled" )};
b.sendMsg("/led", msg[2], ~shiftB, msg[4]);
};
// CTRL state ////////////////////////////////////
if (msg[2] == 10 ) {
if (msg[3]==1){
~ctrlB = 1; postln("CTRL enabled" ); b.sendMsg("/led", msg[2], ~ctrlB, msg[4]);}
{ ~ctrlB = 0; postln("CTRL disabled" ); b.sendMsg("/led", msg[2], ~ctrlB, msg[4]);};
};
// SCALE CHANGER ---------------------------------
if (~shiftB==1 && msg[2] == 9 && msg[3] == 1) {
if (msg[3]==1){
~ssB = (~ssB + 1) % 14; // fourteen slots for scales
// use key release to
~scaleB = ~scaleMode[~ssB];
postln("SCBLE: " + ~scaleB.name + " : " + ~scaleB);
//b.sendMsg("/led", 9, ~ssB, msg[4]);
};
// todo color code for SCALE CHANGER... red not updating
b.sendMsg("/led", msg[2], ~ssB, msg[4]);
};
// PITCH SET SCRAMBLER ---------------------------------
if (~shiftB==0 && ~ctrlB==0 && msg[2] == 9 && msg[3] == 1) {
~psetB = Array.series(~scaleB.size+1, start: 0, step: 1).scramble;
postln(~scaleB.name + " SCALE SCRAMBLED: " + ~psetB);
b.sendMsg("/led", 9, ~ssB, msg[4]);
};
if (~shiftB==0 && ~ctrlB==1 && msg[2] == 9 && msg[3] == 1) {
~psetB = Array.series(~scaleB.size+1, start: 0, step: 1);
postln(~scaleB.name + " SCALE ORDER RESTORED: " + ~psetB);
b.sendMsg("/led", 9, ~ssB, msg[4]);
};
// SAMPLE DIRECTORY CHANGER ---------------------------------
if (~shiftB==1 && msg[2] == 8 && msg[3] == 1) {
~smpB = (~smpB + 1) % 4;
// use key release to
~sdir = ~sampleDir[~smpB];
postln("NEW SAMPLE DIRECTORY SELECTED:"+ ~sampleDir[~smpB+1] + " : " + ~sampleDir);
};
// SAMPLE DIRECTORY MAPPINGS ---------------------------------
if (~smpB == 0){
w = case
{ msg[2] == 0} { ~oPB[0].set(\bufnum, ~smp[\bowl][0]); }
{ msg[2] == 1} { ~oPB[1].set(\bufnum, ~smp[\bowl][0]); }
{ msg[2] == 2} { ~oPB[2].set(\bufnum, ~smp[\bowl][0]); }
{ msg[2] == 3} { ~oPB[3].set(\bufnum, ~smp[\bowl][0]); }
{ msg[2] == 4} { ~oPB[4].set(\bufnum, ~smp[\bowl][0]); }
{ msg[2] == 5} { ~oPB[5].set(\bufnum, ~smp[\bowl][0]); }
{ msg[2] == 6} { ~oPB[6].set(\bufnum, ~smp[\bowl][0]); }
{ msg[2] == 7} { ~oPB[7].set(\bufnum, ~smp[\bowl][0]); };
b.sendMsg("/led", 9, ~smpB, msg[4]);
};
if (~smpB == 1){
x =~smp[\green];
w = case
{ msg[2] == 0} { ~oPB[0].set(\bufnum, x[0]); }
{ msg[2] == 1} { ~oPB[1].set(\bufnum, x[1]); }
{ msg[2] == 2} { ~oPB[2].set(\bufnum, x[1]); }
{ msg[2] == 3} { ~oPB[3].set(\bufnum, x[1]); }
{ msg[2] == 4} { ~oPB[4].set(\bufnum, x[2]); }
{ msg[2] == 5} { ~oPB[5].set(\bufnum, x[2]); }
{ msg[2] == 6} { ~oPB[6].set(\bufnum, x[2]); }
{ msg[2] == 7} { ~oPB[7].set(\bufnum, x[3]); };
b.sendMsg("/led", 9, ~smpB, msg[4]);
};
if (~smpB == 2){
x =~smp[\blue];
w = case
{ msg[2] == 0} { ~oPB[0].set(\bufnum, x[0]); }
{ msg[2] == 1} { ~oPB[1].set(\bufnum, x[1]); }
{ msg[2] == 2} { ~oPB[2].set(\bufnum, x[1]); }
{ msg[2] == 3} { ~oPB[3].set(\bufnum, x[1]); }
{ msg[2] == 4} { ~oPB[4].set(\bufnum, x[2]); }
{ msg[2] == 5} { ~oPB[5].set(\bufnum, x[2]); }
{ msg[2] == 6} { ~oPB[6].set(\bufnum, x[2]); }
{ msg[2] == 7} { ~oPB[7].set(\bufnum, x[3]); };
b.sendMsg("/led", 9, ~smpB, msg[4]);
};
if (~smpB == 3){
x =~smp[\red];
w = case
{ msg[2] == 0} { ~oPB[0].set(\bufnum, x[0]); }
{ msg[2] == 1} { ~oPB[1].set(\bufnum, x[1]); }
{ msg[2] == 2} { ~oPB[2].set(\bufnum, x[1]); }
{ msg[2] == 3} { ~oPB[3].set(\bufnum, x[1]); }
{ msg[2] == 4} { ~oPB[4].set(\bufnum, x[2]); }
{ msg[2] == 5} { ~oPB[5].set(\bufnum, x[2]); }
{ msg[2] == 6} { ~oPB[6].set(\bufnum, x[2]); }
{ msg[2] == 7} { ~oPB[7].set(\bufnum, x[3]); };
b.sendMsg("/led", 9, ~smpB, msg[4]);
};
// REVERSE SAMPLES ////////////////////////////////////////////
if (~ctrlB == 1 ) { // while control pressed
if (msg[2] < 8 ){ // only applies to the first 8 sensors
if (msg[3] == 1 ){ // if touched
postln("reverse sample @ index: " + msg[2] );
w = case
{ msg[2] == 0} { ~oPB[0].set(\dir, -1, \spos, 44100); }
{ msg[2] == 1} { ~oPB[1].set(\dir, -1, \t_trig, 1, \gate, 1, ); }
{ msg[2] == 2} { ~oPB[2].set(\dir, -1 ); }
{ msg[2] == 3} { ~oPB[3].set(\dir, -1 ); }
{ msg[2] == 4} { ~oPB[4].set(\dir, -1 ); }
{ msg[2] == 5} { ~oPB[5].set(\dir, -1 ); }
{ msg[2] == 6} { ~oPB[6].set(\dir, -1 ); }
{ msg[2] == 7} { ~oPB[7].set(\dir, -1 ); }
} { ~dirStateB.put(msg[2],1);
postln("set direction state to 1 reverse magenta");
} // if not 1 (released after CTRL+touch)
} // set the state for neopixel // when released
};
// TRANSPOSITION MODE SETTER
if (~shiftB == 1 && msg[2] == 10 ) {
if (msg[3]==1){
~transpositionsB = ~transpositionsB+1 % 6;
w = case
{ ~transpositionsB == 0} { postln("MODE: ------> NORMAL" ); }
{ ~transpositionsB == 1} { postln("MODE: ------> TRANSPOSE ---- 1 8VE-DOWN" ); }
{ ~transpositionsB == 2} { postln("MODE: ------> TRANSPOSE ---- 2 8VE-DOWN" ); }
{ ~transpositionsB == 3} { postln("MODE: ------> TRANSPOSE ---- 1 8VE-UP" ); }
{ ~transpositionsB == 4} { postln("MODE: ------> TRANSPOSE ---- 2 8VE-UP" ); }
{ ~transpositionsB == 5} { postln("MODE: ------> TRANSPOSE ---- RANDOM 0.25 <-> 5" ); };
};
b.sendMsg("/led", msg[2], ~transpositionsB, msg[4]);
};
// modes ----
if (~shiftB==0 && msg[3] == 1 ){
if (~transpositionsB == 0) {
w = case
{ msg[2] == 0} { ~oPB[0].set(\tpse, 1); }
{ msg[2] == 1} { ~oPB[1].set(\tpse, 1 ); }
{ msg[2] == 2} { ~oPB[2].set(\tpse, 1 ); }
{ msg[2] == 3} { ~oPB[3].set(\tpse, 1 ); }
{ msg[2] == 4} { ~oPB[4].set(\tpse, 1 ); }
{ msg[2] == 5} { ~oPB[5].set(\tpse, 1 ); }
{ msg[2] == 6} { ~oPB[6].set(\tpse, 1 ); }
{ msg[2] == 7} { ~oPB[7].set(\tpse, 1 ); }
};
if (~transpositionsB == 1) {
w = case
{ msg[2] == 0} { ~oPB[0].set(\tpse, 0.5); }
{ msg[2] == 1} { ~oPB[1].set(\tpse, 0.5 ); }
{ msg[2] == 2} { ~oPB[2].set(\tpse, 0.5 ); }
{ msg[2] == 3} { ~oPB[3].set(\tpse, 0.5 ); }
{ msg[2] == 4} { ~oPB[4].set(\tpse, 0.5 ); }
{ msg[2] == 5} { ~oPB[5].set(\tpse, 0.5 ); }
{ msg[2] == 6} { ~oPB[6].set(\tpse, 0.5 ); }
{ msg[2] == 7} { ~oPB[7].set(\tpse, 0.5 ); }
};
if (~transpositionsB == 2 ) {
w = case
{ msg[2] == 0} { ~oPB[0].set(\tpse, [0.25].choose ); }
{ msg[2] == 1} { ~oPB[1].set(\tpse, [0.25].choose ); }
{ msg[2] == 2} { ~oPB[2].set(\tpse, [0.25].choose ); }
{ msg[2] == 3} { ~oPB[3].set(\tpse, [0.25].choose ); }
{ msg[2] == 4} { ~oPB[4].set(\tpse, [0.25].choose ); }
{ msg[2] == 5} { ~oPB[5].set(\tpse, [0.25].choose ); }
{ msg[2] == 6} { ~oPB[6].set(\tpse, [0.25].choose ); }
{ msg[2] == 7} { ~oPB[7].set(\tpse, [0.25].choose ); }
};
if (~transpositionsB == 3 ) {
w = case
{ msg[2] == 0} { ~oPB[0].set(\tpse, [2].choose ); }
{ msg[2] == 1} { ~oPB[1].set(\tpse, [2].choose ); }
{ msg[2] == 2} { ~oPB[2].set(\tpse, [2].choose ); }
{ msg[2] == 3} { ~oPB[3].set(\tpse, [2].choose ); }
{ msg[2] == 4} { ~oPB[4].set(\tpse, [2].choose ); }
{ msg[2] == 5} { ~oPB[5].set(\tpse, [2].choose ); }
{ msg[2] == 6} { ~oPB[6].set(\tpse, [2].choose ); }
{ msg[2] == 7} { ~oPB[7].set(\tpse, [2].choose ); }
};
if (~transpositionsB == 4 ) {
w = case
{ msg[2] == 0} { ~oPB[0].set(\tpse, [3].choose ); }
{ msg[2] == 1} { ~oPB[1].set(\tpse, [3].choose ); }
{ msg[2] == 2} { ~oPB[2].set(\tpse, [3].choose ); }
{ msg[2] == 3} { ~oPB[3].set(\tpse, [3].choose ); }
{ msg[2] == 4} { ~oPB[4].set(\tpse, [3].choose ); }
{ msg[2] == 5} { ~oPB[5].set(\tpse, [3].choose ); }
{ msg[2] == 6} { ~oPB[6].set(\tpse, [3].choose ); }
{ msg[2] == 7} { ~oPB[7].set(\tpse, [3].choose ); }
};
if (~transpositionsB == 5 ) {
x = [0.25, 0.5, 1, 2, 3, 4, 5];
w = case
{ msg[2] == 0} { ~oPB[0].set(\tpse, x.choose); }
{ msg[2] == 1} { ~oPB[1].set(\tpse, x.choose); }
{ msg[2] == 2} { ~oPB[2].set(\tpse, x.choose ); }
{ msg[2] == 3} { ~oPB[3].set(\tpse, x.choose ); }
{ msg[2] == 4} { ~oPB[4].set(\tpse, x.choose ); }
{ msg[2] == 5} { ~oPB[5].set(\tpse, x.choose ); }
{ msg[2] == 6} { ~oPB[6].set(\tpse, x.choose ); }
{ msg[2] == 7} { ~oPB[7].set(\tpse, x.choose ); }
};
};
// UPDATE THE NEOPIXELS STATUS
if (msg[2] < 8) { // when not touched turn led 0-7 black/off(12) gray/9
if (msg[1] == mac && msg[3] == 0 && msg[4] == 0 ) { // released
if (~dirStateB[msg[2]] == 0){ // if the direction state is 0 (forward)
b.sendMsg("/led", msg[2], 7, msg[4]); // set the neopixel to 7 (orange)
} {
b.sendMsg("/led", msg[2], 5, msg[4]);
} // else (dirState reverse) set the neopixel to 5 (cyan)
};
} {} ;
};

Binary file not shown.