post mfru mods

master
Rob Canning 2023-10-16 17:32:44 +02:00
parent c3c1bb6e4f
commit b3ab447a36
1 changed files with 33 additions and 23 deletions

View File

@ -1,7 +1,9 @@
/*RUN*/ /*RUN*/
s.options.numInputBusChannels = 4; s.options.numInputBusChannels = 8;
s.options.numOutputBusChannels = 4; s.options.numOutputBusChannels = 8;
~channels = 2;
b = NetAddr.new("192.168.0.100", 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"
@ -47,9 +49,9 @@ s.waitForBoot{
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*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 = PanAz.ar(4, sig, FSinOsc.kr(panRate));
//sig = Pan4.ar(sig, FSinOsc.kr(panRate)); /// //sig = Pan4.ar(sig, FSinOsc.kr(panRate));
Out.ar(out, sig); Out.ar(out, sig);
@ -59,14 +61,14 @@ 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.8, loop=0, panRate=rrand(0.05,0.75), group=~sGA; amp=0.8, loop=0, panRate=rrand(0.05,0.15), 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, rrand(0,(~channels-1)), \loop, loop, panRate: panRate], group);
}); });
~oPB = 8.collect({ ~oPB = 8.collect({
arg itt, rate=1, out=0, sdir=\bowl, arg itt, rate=1, out=0, sdir=\bowl,
amp=0.8, loop=0, panRate=rrand(0.05,0.75), group=~sGB; amp=0.8, loop=0, panRate=rrand(0.05,0.15), 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, rrand(0,(~channels-1)), \loop, loop, panRate: panRate], group);
}); });
// RECEIVE OSC MESSAGES FROM ESP32s // RECEIVE OSC MESSAGES FROM ESP32s
@ -121,7 +123,6 @@ s.waitForBoot{
~loopStateA = [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]; ~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;
@ -145,16 +146,30 @@ s.waitForBoot{
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); ~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, \loop, 0, \spos, 0); } { msg[2] == 0} { ~oPA[0].set(\rate, ~scaleA[~psetA[0]].midiratio,
{ msg[2] == 1} { ~oPA[1].set(\rate, ~scaleA[~psetA[1]].midiratio, \t_trig, 1, \gate, 1, \tpse, 1, \dir, 1, \loop, 0, \spos, 0); } \t_trig, 1, \gate, 1, \tpse, 1, \dir, 1, \loop, 0, \spos, 0, \out, rrand(0,~channels-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, \loop, 0, \spos, 0); } { msg[2] == 1} { ~oPA[1].set(\rate, ~scaleA[~psetA[1]].midiratio,
{ msg[2] == 4} { ~oPA[4].set(\rate, ~scaleA[~psetA[4]].midiratio, \t_trig, 1, \gate, 1, \tpse, 1, \dir, 1, \loop, 0, \spos, 0); } \t_trig, 1, \gate, 1, \tpse, 1, \dir, 1, \loop, 0, \spos, 0, \out, rrand(0,~channels-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, \loop, 0, \spos, 0); } { msg[2] == 2} { ~oPA[2].set(\rate, ~scaleA[~psetA[2]].midiratio,
\t_trig, 1, \gate, 1, \tpse, 1, \dir, 1, \loop, 0, \spos, 0, \out, rrand(0,~channels-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, \out, rrand(0,~channels-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, \out, rrand(0,~channels-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, \out, rrand(0,~channels-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, \out, rrand(0,~channels-1)); }
// 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
@ -163,10 +178,10 @@ 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, \loop, 0, \spos, 0); ~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(\rate, ~scaleA[~psetA[0]].midiratio,\t_trig, 1, \gate, 1, \tpse, 2, \loop, 0, \spos, 0); 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); ~dirStateA.put(msg[2],0);
@ -234,8 +249,6 @@ s.waitForBoot{
} // set the state for neopixel // when released } // 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) {
@ -248,7 +261,6 @@ s.waitForBoot{
// todo color code for SCALE CHANGER... red not updating // todo color code for SCALE CHANGER... red not updating
//b.sendMsg("/led", 9, ~ssA, msg[4]); //b.sendMsg("/led", 9, ~ssA, msg[4]);
// PITCH SET SCRAMBLER --------------------------------- // PITCH SET SCRAMBLER ---------------------------------
if (~shiftA==0 && ~ctrlA==0 && msg[2] == 9 && msg[3] == 1) { if (~shiftA==0 && ~ctrlA==0 && msg[2] == 9 && msg[3] == 1) {
@ -269,10 +281,8 @@ s.waitForBoot{
~smpA = (~smpA + 1) % 4; ~smpA = (~smpA + 1) % 4;
// use key release to // use key release to
~sdir = ~sampleDir[~smpA]; ~sdir = ~sampleDir[~smpA];
postln("NEW SAMPLE DIRECTORY SELECTED:"+ ~sampleDir[~smpA] + " : " + ~sampleDir); postln("NEW SAMPLE DIRECTORY SELECTED:"+ ~sampleDir[~smpA] + " : " + ~sampleDir);
b.sendMsg("/led", 8, ~smpA, msg[4]); b.sendMsg("/led", 8, ~smpA, msg[4]);
}; };
// SAMPLE DIRECTORY MAPPINGS --------------------------------- // SAMPLE DIRECTORY MAPPINGS ---------------------------------