649 lines
24 KiB
Plaintext
649 lines
24 KiB
Plaintext
/*RUN*/
|
|
|
|
// RUNME 0 =========================================
|
|
|
|
Server.default.waitForBoot { // see below .bundle timings for starting synths etc.
|
|
|
|
// SETUP ---------------=--------------------------
|
|
b = Buffer.alloc(s, s.sampleRate * 10, 1); // Allocate a 5 second mono buffer
|
|
|
|
// Open port 57121 for ESP32 UDP OSC
|
|
thisProcess.openUDPPort(57121);
|
|
|
|
// allocate busses
|
|
~reverbBus = Bus.audio(s, 1);
|
|
~ringModBus = Bus.audio(s, 1);
|
|
~micBus = Bus.audio(s,1);
|
|
~ptrBus = Bus.audio(s,1);
|
|
|
|
//~sourceGrp = Group.new;
|
|
//~fxGrp = Group.after(~sourceGrp);
|
|
|
|
// create group order
|
|
~micGrp = Group.new;
|
|
~ptrGrp = Group.after(~micGrp);
|
|
~recGrp = Group.after(~ptrGrp);
|
|
~granGrp = Group.after(~recGrp);
|
|
~fxGrp = Group.after(~micGrp);
|
|
|
|
//load the gui
|
|
"/home/rob/gtr/GUI.scd".load;
|
|
s.plotTree;
|
|
s.meter;
|
|
|
|
// RUNME 2 ==========================================
|
|
s.makeBundle(1.0, {
|
|
// -------------------------------------------------
|
|
// DEFINE SYNTHS ---------------------------------
|
|
// -------------------------------------------------
|
|
// direct signal + reverb -------------------------
|
|
///// outs set to 2 /// for recording to ardour .... fork todo
|
|
|
|
SynthDef("dryIn", { arg in=0, instrPanModeIndex=0, out=2, sensorInstrPan=0, instrPitch=0.7, instrAmp=1;
|
|
var signal, dry, wet, instrPan, instrPanMode0, instrPanMode1, instrPanMode2, instrPanMode3, instrPanMode4, instrPanMode5;
|
|
|
|
instrPanMode0 = 0; //LFNoise1.kr(100).range(-0.2, 0.2);
|
|
instrPanMode1 = 1; //LFNoise1.kr(100).range(-0.2, 0.2);
|
|
instrPanMode2 = SinOsc.kr(0.33).range(-0.2, 0.2);
|
|
instrPanMode3 = LFNoise1.kr(10).range(-0.2, 0.2);
|
|
instrPanMode4 = LFSaw.kr(0.33).bipolar.range(-1,1);
|
|
instrPanMode5 = LFNoise1.kr(10).range(-1, 1);
|
|
instrPan = Select.kr(instrPanModeIndex,
|
|
[instrPanMode0, instrPanMode1, instrPanMode2, instrPanMode3,
|
|
instrPanMode4, instrPanMode5, sensorInstrPan]);
|
|
signal = SoundIn.ar(in);
|
|
//signal = PanAz.ar(4, signal, instrPan);
|
|
signal = signal * instrAmp;
|
|
//wet = PitchShift.ar(signal, pitchRatio: instrPitch, pitchDispersion: 0.3, timeDispersion: 0.1);
|
|
Out.ar(out, signal);
|
|
//Out.ar(0, Mix.ar( [signal, wet] ));
|
|
}).add;
|
|
|
|
SynthDef("freeVerb", {
|
|
arg in=0, mix=0.5, room=0.8, damp = 0.5;
|
|
var signal, dry, wet;
|
|
dry = In.ar(in);
|
|
wet = FreeVerb.ar(dry, mix:mix, room:room, damp:damp,);
|
|
signal = wet * 0.9;
|
|
Out.ar(2, signal!2);
|
|
}).add;
|
|
|
|
SynthDef("ringModulator", {
|
|
arg in=0, modulator=300, mulrate=0.2;
|
|
var signal, rm , carrier, multiplier;
|
|
signal = In.ar(in);
|
|
multiplier = SinOsc.ar(mulrate);
|
|
rm = signal * SinOsc.ar(modulator, mul:multiplier);
|
|
//signal = (rm + signal) * 0.5;
|
|
Out.ar(2, rm!2);
|
|
}).add;
|
|
|
|
SynthDef.new(\mic, {
|
|
arg in=0, out=0, amp=1;
|
|
var sig;
|
|
sig = SoundIn.ar(in) * amp;
|
|
Out.ar(out, sig);
|
|
}).add;
|
|
|
|
SynthDef.new(\ptr, {
|
|
arg out=0, buf=0, ptrMode=0, rate=1;
|
|
var sig;
|
|
sig = Select.ar(ptrMode, [
|
|
Phasor.ar(0, BufRateScale.kr(buf) * rate, 0, BufFrames.kr(buf)),
|
|
LFNoise1.ar(100).exprange(10000, 10001)
|
|
//LFNoise1.ar(100).exprange(1/BufFrames.kr(buf), BufFrames.kr(buf))
|
|
]);
|
|
|
|
Out.ar(out, sig);
|
|
}).add;
|
|
|
|
// mono buffer recorder ----------------------------
|
|
// with loop and overdub modes /////////////////////
|
|
|
|
SynthDef("recBuf",{
|
|
arg micIn=0, ptrIn=0, bufnum=0, t_trig=0, l=0, overdub=0;
|
|
var sig, ptr, chain, onsets;
|
|
|
|
ptr = In.ar(ptrIn, 1);
|
|
sig = In.ar(micIn, 1);
|
|
|
|
// Onsets
|
|
//chain = FFT(LocalBuf(512), sig);
|
|
//onsets = Onsets.kr(chain, MouseX.kr(0,1), \rcomplex);
|
|
|
|
RecordBuf.ar(sig, bufnum, loop:l,
|
|
recLevel: 1,
|
|
preLevel: overdub,
|
|
doneAction: 0, trigger:t_trig,
|
|
offset: ptr);
|
|
}).add;
|
|
|
|
SynthDef.new(\gran, {
|
|
arg amp=0.5, out=0, buf=0,
|
|
atk=1, rel=1, gate=1,
|
|
sync=1, dens=40,
|
|
baseDur=0.05, durRand=1,
|
|
rate=1, rateRand=1,
|
|
pan=0, panRand=0,
|
|
grainEnv=(-1), ptrBus=0, ptrSampleDelay=20000,
|
|
ptrRandSamples=5000, minPtrDelay=1000;
|
|
|
|
var sig, env, densCtrl, durCtrl, rateCtrl, panCtrl, ptr, ptrRand, totalDelay, maxGrainDur;
|
|
|
|
env= EnvGen.kr(Env.asr(atk,1,rel),gate, doneAction:2);
|
|
densCtrl = Select.ar(sync, [Dust.ar(dens), Impulse.ar(dens)]);
|
|
durCtrl = baseDur * LFNoise1.ar(100).exprange(1/durRand, durRand);
|
|
rateCtrl = rate * LFNoise1.ar(100).exprange(1/rateRand, rateRand);
|
|
panCtrl = pan + LFNoise1.kr(100).bipolar(panRand);
|
|
|
|
ptrRand = LFNoise1.ar(100).bipolar(ptrRandSamples);
|
|
totalDelay = max(ptrSampleDelay - ptrRand, minPtrDelay); // make sure value doesnt go below this value and cross discontinuity point
|
|
|
|
ptr = In.ar(ptrBus, 1);
|
|
ptr = ptr - totalDelay; // how far ptr lags behind discontinuity point
|
|
ptr = ptr / BufFrames.kr(buf); //normalise to 0 - 1 range
|
|
|
|
maxGrainDur = (totalDelay / rateCtrl) / SampleRate.ir;
|
|
durCtrl = min(durCtrl, maxGrainDur);
|
|
|
|
sig = GrainBuf.ar(
|
|
4,
|
|
densCtrl,
|
|
durCtrl,
|
|
buf,
|
|
rateCtrl,
|
|
ptr,
|
|
2,
|
|
panCtrl,
|
|
grainEnv
|
|
);
|
|
|
|
sig = sig * env * amp;
|
|
Out.ar(out, sig);
|
|
|
|
}).add;
|
|
|
|
}); //end make bundle
|
|
|
|
// RUNME 3 ==========================================
|
|
|
|
s.makeBundle(2.0, {
|
|
|
|
// START SYNTHS -------------------------------------
|
|
|
|
~mic = Synth(\mic, [\in, 0, \out, ~micBus], ~micGrp);
|
|
~pointer = Synth(\ptr, [\buf, b, \out, ~ptrBus], ~ptrGrp);
|
|
// todo make togglable between fx and dry feeding sampler
|
|
r = Synth(\recBuf, [\ptrIn, ~ptrBus, \micIn, ~micBus, \buf, b, \t_trig, 0], ~recGrp); // recorder
|
|
~gtrIn = Synth(\dryIn, [\instrAmp, 1, \out, ~reverbBus], ~micGrp); // dry audio signaL
|
|
~reverbFX = Synth(\freeVerb, [\in, ~reverbBus], ~fxGrp);
|
|
~ringMod = Synth(\ringModulator, [\in, ~ringModBus], ~fxGrp);
|
|
|
|
|
|
|
|
~g = 1.collect({
|
|
arg n;
|
|
Synth(\gran,[
|
|
\amp, 0.25,
|
|
// \amp, n.linlin(0,4, -3,-20).dbamp,
|
|
\buf, b, // which buffer
|
|
\out, 0,
|
|
\atk, 10,
|
|
\rel, 10,
|
|
\gate, 1,
|
|
\sync, 0,
|
|
\dens, 1, // exprand(2,80),
|
|
\baseDur, 1, //0.08
|
|
\durRand, 1,
|
|
\rate, 1,
|
|
\rateRand, 1,
|
|
\pan, 0,
|
|
\panRand, 1,
|
|
\grainEnv, -1,
|
|
\ptrBus, ~ptrBus, // make different style ptrs
|
|
//\ptrSampleDelay, n.linlin(0,4, 20000, s.sampleRate*2),
|
|
\ptrSampleDelay, 20000, // how far pointer lags behind write head
|
|
\ptrRandSamples, 2000, // how much to randomly jump around
|
|
\minPtrDelay, 1000, // dont get any closer to the ptr than this
|
|
], ~granGrp);
|
|
});
|
|
|
|
}); // end makeBundle
|
|
|
|
s.makeBundle(2.0, {
|
|
|
|
// RUNME 4 ==========================================
|
|
|
|
// - - OSC Receivers // ENABLE SENSOR AND SWITCH VALUES
|
|
( // ----------------------------------------------------
|
|
|
|
r.set(\l, 1);
|
|
~overdubMode= 0;
|
|
~pitchMode = 0;
|
|
~posMode = 6;
|
|
~densMode= 4;
|
|
~impulseMode = 0;
|
|
~gdurMode=0;
|
|
~gpanMode=0;
|
|
~channelmode=0;
|
|
~instrPanMode=0;
|
|
|
|
~btn0val = -1; ~btn1val = -1; ~btn2val = -1; ~btn3val = -1;
|
|
~btn4val = -1; ~btn5val = -1; ~btn6val = -1; ~btn7val = -1;
|
|
~btn8val = -1; // shift buttons
|
|
|
|
~btn9val = -1; ~btn10val = -1; ~btn11val = -1; ~btn12val = -1;
|
|
~btn13val = -1; ~btn14val = -1; ~btn15val = -1; ~btn16val = -1;
|
|
|
|
(( // accel gyro quaternion mapping ///////////////////
|
|
|
|
// msg[1] msg[2] msg[3] X Y Z ==> ROLL, PITCH, YAW
|
|
|
|
o = OSCdef(\test, { arg msg, time, addr, recvPort, rlow, rhigh;
|
|
|
|
if ( ~pitchMode == 7,
|
|
{
|
|
//"it's 7".postln;
|
|
// msg.postln;
|
|
~g.do({arg n; n.set( \rateRand, 1)}; );
|
|
~g.do({arg n; n.set( \rate, msg[2].linlin(-0.5, 0.5, 0.125,2);
|
|
//\rateRand, msg[3].linlin(0, -0.5, 1, 10);
|
|
)}; );
|
|
|
|
},
|
|
{} );
|
|
|
|
if ( ~posMode == 7,
|
|
{
|
|
//"it's 7".postln;
|
|
msg.postln;
|
|
~ptr.do({arg n; n.set(
|
|
//\ptrRandSamples, s.sampleRate * 0.125, \minPtrDelay, 1000, \ptrSampleDelay, s.sampleRate * msg[2].linlin(-0.3, 0.3, 0.1, 3) ;
|
|
//\sig, BufFrames.kr(b) * msg[2].linlin(-0.3, 0.3, 0.1, 1)
|
|
)}; );
|
|
}, {} );
|
|
|
|
|
|
}; , '/euler');
|
|
);
|
|
|
|
// ----------------------------------------------------
|
|
// send message back to nodejs
|
|
m = NetAddr("127.0.0.1", 57100);
|
|
// on off osconoff accelerometer data
|
|
m.sendMsg("/xyzc", 1);
|
|
m.sendMsg("/xyzc", 0);
|
|
|
|
// ----------------------------------------------------
|
|
// button press mapping ///////////////////////////////
|
|
// ----------------------------------------------------
|
|
|
|
n = NetAddr("127.0.0.1", NetAddr.langPort);
|
|
|
|
p = OSCdef(\keys, { arg msg, time, addr, recvPort;
|
|
|
|
// /// PRESETS !!!!!!!!!!!!!!!!!!!!!!!
|
|
//
|
|
// if (msg[9] == 1 && msg[10] == 1, {
|
|
//
|
|
// ( ~btn0val = (~btn0val + 1) % 5 ) ;
|
|
// switch( ~btn0val,
|
|
// 0, { "PONTALISTIFANTASTICO".postln;
|
|
//
|
|
// ~g.do({arg n; n.set(\baseDur, 0.5 )});
|
|
// ~g.do({arg n; n.set(\durRand, 1)});
|
|
// ~g.do({arg n; n.set(\dens, 32)});
|
|
// ~g.do({arg n; n.set(\rate, 1)});
|
|
// ~g.do({arg n; n.set(\rateRand, 32)});
|
|
// ~g.do({arg n; n.set(\sync, 1)});
|
|
// ~g.do({arg n; n.set(\ptrRandSamples, 6400000, )});
|
|
// },
|
|
//
|
|
// 1, { "DRONAUSAURUS".postln;
|
|
// ~g.do({arg n; n.set([\baseDur, 1, \durRand, 2, \dens, 100, \rate, 1, \rateRand, 1, \sync, 0, \ptrRandSamples, 200000, ])}); },
|
|
// 2, { "MINIMAL5THsISM".postln;
|
|
// ~g.do({arg n; n.set([\baseDur, 0, \durRand, 6, \dens, 1, \rate, 1, \rateRand, 1.1, \sync, 1, \ptrRandSamples, 200000, ])}); },
|
|
// 3, { "PONTALISTIFANTASTICO====".postln;
|
|
// ~g.do({arg n; n.set([\baseDur, 0, \durRand, 6, \dens, 1, \rate, 1, \rateRand, 1.1, \sync, 1, \ptrRandSamples, 200000, ])}); },
|
|
// 4, { "PONTALISTIFANTASTICO+++++++++".postln;
|
|
// ~g.do({arg n; n.set([\baseDur, 0, \durRand, 6, \dens, 1, \rate, 1, \rateRand, 1.1, \sync, 1, \ptrRandSamples, 200000, ])}); },
|
|
// );
|
|
//
|
|
//});
|
|
|
|
// ==============================
|
|
// BUTTON MAPPING
|
|
// ==============================
|
|
|
|
// TRIGGER BUTTONS (3) ------------------------------
|
|
|
|
// if SHIFT key is 0:
|
|
if (msg[9] == 0, {
|
|
|
|
// BUTTON X ----- TRIGGER ONESHOT BUFFER RECORD
|
|
if (msg[10] == 1, {
|
|
//r.set( \in, 0, \l, 0, \t_trig, 1); "/////////// SAMPLING!".postln; { ~recTrigButton.value_(0) }.defer;
|
|
r.set(\t_trig, 1); "/////////// SAMPLING!".postln; { ~recTrigButton.value_(0) }.defer;
|
|
|
|
|
|
}, {
|
|
{~recTrigButton.value_(1) }.defer
|
|
} );
|
|
|
|
// BUTTON X ----> LOOP RECORDING MODE ON/OFF
|
|
if (msg[11]==1,
|
|
{
|
|
( ~btn2val = (~btn2val + 1) % 3 ) ;
|
|
switch( ~btn2val,
|
|
0, { r.set(\l, 0); "RECORD LOOPING OFF".postln; { ~recModeGui.value_(0) }.defer; },
|
|
1, { r.set(\l, 1); "RECORD LOOPING ON".postln; { ~recModeGui.value_(1) }.defer; },
|
|
2, { r.set(\l, 0); "ONSET DETECTION ON".postln; { ~recModeGui.value_(2) }.defer; },
|
|
);
|
|
});
|
|
|
|
// BUTTON X ----> OVERDUB RECORDING MODE ON/OFF
|
|
if (msg[12]==1,
|
|
{
|
|
( ~btn3val = (~btn3val + 1) % 6 ) ;
|
|
switch( ~btn3val,
|
|
0, { ~overdubMode = 0; "SAMPLE OVERDUB OFF".postln; },
|
|
1, { ~overdubMode = 1; "SAMPLE OVERDUB ON 30%".postln; },
|
|
2, { ~overdubMode = 2; "SAMPLE OVERDUB ON 50%".postln; },
|
|
3, { ~overdubMode = 3; "SAMPLE OVERDUB ON 75%".postln; },
|
|
4, { ~overdubMode = 4; "SAMPLE OVERDUB ON 90%".postln; },
|
|
5, { ~overdubMode = 5; "SAMPLE OVERDUB ON 100%".postln; },
|
|
)
|
|
});
|
|
|
|
///// GUI UPDATER CODE /////////////////////////////////////////////////////////////////
|
|
//// sampler gui
|
|
case
|
|
{~overdubMode == 0 }{{~overdubModeGui.value_(0) }.defer; r.set(\overdub, 0); }
|
|
{~overdubMode == 1 }{{~overdubModeGui.value_(1) }.defer; r.set(\overdub, 0.3); }
|
|
{~overdubMode == 2 }{{~overdubModeGui.value_(2) }.defer; r.set(\overdub, 0.5); }
|
|
{~overdubMode == 3 }{{~overdubModeGui.value_(3) }.defer; r.set(\overdub, 0.75); }
|
|
{~overdubMode == 4 }{{~overdubModeGui.value_(4) }.defer; r.set(\overdub, 0.9); }
|
|
{~overdubMode == 5 }{{~overdubModeGui.value_(5) }.defer; r.set(\overdub, 1); };
|
|
|
|
// ~recTrigButton
|
|
// ~recModeGui
|
|
|
|
// granular gui ////////////////////////////////////////////////////////////////
|
|
|
|
// rrand(1,3); exprand(1,2); 5.rand; 1.0.linrand;
|
|
case
|
|
{~pitchMode == 0 }{{~pitchModeGui.value_(0) }.defer; ~g.do({arg n; n.set(\rateRand, 1, \rate, 1) }); }
|
|
{~pitchMode == 1 }{{~pitchModeGui.value_(1) }.defer; ~g.do({arg n; n.set(\rate, 2, \rateRand, 1) }); }
|
|
{~pitchMode == 2 }{{~pitchModeGui.value_(2) }.defer; ~g.do({arg n; n.set(\rate, 0.5, \rateRand, 1) }); }
|
|
{~pitchMode == 3 }{{~pitchModeGui.value_(3) }.defer; ~g.do({arg n; n.set(\rate, 1, \rateRand, 1.1) }); }
|
|
{~pitchMode == 4 }{{~pitchModeGui.value_(4) }.defer; ~g.do({arg n; n.set(\rate, 1, \rateRand, 5) }); }
|
|
{~pitchMode == 5 }{{~pitchModeGui.value_(5) }.defer; ~g.do({arg n; n.set(\rate, 1, \rateRand, 10) }); }
|
|
{~pitchMode == 6 }{{~pitchModeGui.value_(6) }.defer; ~g.do({arg n; n.set(\rate, 1, \rateRand, 100) }); }
|
|
{~pitchMode == 7 }{{~pitchModeGui.value_(7) }.defer; ~g.do({arg n; n.set() }); };
|
|
|
|
case
|
|
{~gdurMode == 0 }{{~durModeGui.value_(0) }.defer; ~g.do({arg n; n.set(\baseDur, 1, \durRand, 1)}); }
|
|
{~gdurMode == 1 }{{~durModeGui.value_(1) }.defer; ~g.do({arg n; n.set(\baseDur, 4, \durRand, 1)}); }
|
|
{~gdurMode == 2 }{{~durModeGui.value_(2) }.defer; ~g.do({arg n; n.set(\baseDur, 1/4, \durRand, 5)});}
|
|
{~gdurMode == 3 }{{~durModeGui.value_(3) }.defer; ~g.do({arg n; n.set(\baseDur, 1/8, \durRand, 100)});}
|
|
{~gdurMode == 4 }{{~durModeGui.value_(4) }.defer; ~g.do({arg n; n.set(\baseDur, 1/16, \durRand, 1)});}
|
|
{~gdurMode == 5 }{{~durModeGui.value_(5) }.defer; ~g.do({arg n; n.set(\baseDur, 1, \durRand, 100)});}
|
|
{~gdurMode == 6 }{{~durModeGui.value_(6) }.defer; ~g.do({arg n; n.set(\baseDur, 1, \durRand, 1000)});}
|
|
{~gdurMode == 7 }{{~durModeGui.value_(7) }.defer; ~g.do({arg n; n.set(\baseDur, 1, \durRand, 1)});};
|
|
|
|
case // \ptrSampleDelay
|
|
{~posMode == 0 }{{~posModeGui.value_(0) }.defer; ~g.do({arg n; n.set(
|
|
\ptrRandSamples, s.sampleRate * 0, \minPtrDelay, 1000, \ptrSampleDelay, s.sampleRate * 1) }); }
|
|
|
|
{~posMode == 1 }{{~posModeGui.value_(1) }.defer; ~g.do({arg n; n.set(
|
|
\ptrRandSamples, s.sampleRate * 0.25, \minPtrDelay, 1500, \ptrSampleDelay, s.sampleRate * 1) }); }
|
|
|
|
{~posMode == 2 }{{~posModeGui.value_(2) }.defer; ~g.do({arg n; n.set(
|
|
\ptrRandSamples, s.sampleRate * 0.5, \minPtrDelay, 1500, \ptrSampleDelay, s.sampleRate * 1) }); }
|
|
|
|
{~posMode == 3 }{{~posModeGui.value_(3) }.defer; ~g.do({arg n; n.set(
|
|
\ptrRandSamples, s.sampleRate * 1, \minPtrDelay, 1500, \ptrSampleDelay, s.sampleRate * 1) }); }
|
|
|
|
{~posMode == 4 }{{~posModeGui.value_(4) }.defer; ~g.do({arg n; n.set(
|
|
\ptrRandSamples, s.sampleRate * 2, \ptrSampleDelay, s.sampleRate * 1) }); }
|
|
|
|
{~posMode == 5 }{{~posModeGui.value_(5) }.defer; ~g.do({arg n; n.set(
|
|
\ptrRandSamples, s.sampleRate * 3, \ptrSampleDelay, s.sampleRate * 1) }); }
|
|
|
|
{~posMode == 6 }{{~posModeGui.value_(6) }.defer; ~g.do({arg n; n.set(
|
|
\ptrRandSamples, s.sampleRate * 5, \minPtrDelay, 1500, \ptrSampleDelay, s.sampleRate * 1) }); }
|
|
|
|
{~posMode == 7 }{{~posModeGui.value_(7) }.defer; ~g.do({arg n; n.set( ) }); }; //SENSOR MODE - SEE ABOVE
|
|
|
|
//[1,2,3].choose;
|
|
|
|
case
|
|
{~densMode == 0 }{{~densModeGui.value_(0) }.defer; ~g.do({arg n; n.set(\dens, 1, )}); }
|
|
{~densMode == 1 }{{~densModeGui.value_(1) }.defer; ~g.do({arg n; n.set(\dens, 2, )}); }
|
|
{~densMode == 2 }{{~densModeGui.value_(2) }.defer; ~g.do({arg n; n.set(\dens, 3, )});}
|
|
{~densMode == 3 }{{~densModeGui.value_(3) }.defer; ~g.do({arg n; n.set(\dens, 5, )});}
|
|
{~densMode == 4 }{{~densModeGui.value_(4) }.defer; ~g.do({arg n; n.set(\dens, 8, )});}
|
|
{~densMode == 5 }{{~densModeGui.value_(5) }.defer; ~g.do({arg n; n.set(\dens, 13, )});}
|
|
{~densMode == 6 }{{~densModeGui.value_(6) }.defer; ~g.do({arg n; n.set(\dens, 21, )});}
|
|
{~densMode == 7 }{{~densModeGui.value_(7) }.defer; ~g.do({arg n; n.set(\dens, 34, )}); }
|
|
{~densMode == 8 }{{~densModeGui.value_(8) }.defer; ~g.do({arg n; n.set(\dens, 55, )}); }
|
|
{~densMode == 9 }{{~densModeGui.value_(9) }.defer; ~g.do({arg n; n.set(\dens, 89, )}); }
|
|
{~densMode == 10 }{{~densModeGui.value_(10) }.defer; ~g.do({arg n; n.set(\dens, 144, )}); }
|
|
{~densMode == 11 }{{~densModeGui.value_(11) }.defer; ~g.do({arg n; n.set(\dens, 233, )}); }
|
|
{~densMode == 12 }{{~densModeGui.value_(12) }.defer; ~g.do({arg n; n.set(\dens, 377, )}); };
|
|
|
|
case
|
|
{~gpanMode == 0 }{{~gPanModeGui.value_(0) }.defer; ~g.do({arg n; n.set(\panRand, 0.25, \pan, 0)}); }
|
|
{~gpanMode == 1 }{{~gPanModeGui.value_(1) }.defer; ~g.do({arg n; n.set(\panRand, 0.25, \pan, 0)}); }
|
|
{~gpanMode == 2 }{{~gPanModeGui.value_(2) }.defer; ~g.do({arg n; n.set(\pan, 0, \panRand, 1)}); }
|
|
{~gpanMode == 3 }{{~gPanModeGui.value_(3) }.defer; ~g.do({arg n; n.set(\panRand, 0)}); }
|
|
{~gpanMode == 4 }{{~gPanModeGui.value_(4) }.defer; ~g.do({arg n; n.set(\panRand, 0)}); }
|
|
{~gpanMode == 5 }{{~gPanModeGui.value_(5) }.defer; ~g.do({arg n; n.set(\panRand, 0)}); }
|
|
{~gpanMode == 6 }{{~gPanModeGui.value_(6) }.defer; ~g.do({arg n; n.set(\panRand, 0)}); }
|
|
{~gpanMode == 7 }{{~gPanModeGui.value_(7) }.defer; ~g.do({arg n; n.set(\panRand, 0)}); };
|
|
|
|
case
|
|
{~impulseMode == 0 }{{~impulseModeGui.value_(0) }.defer; ~g.do({arg n; n.set(\sync, 1)}); }
|
|
{~impulseMode == 1 }{{~impulseModeGui.value_(1) }.defer; ~g.do({arg n; n.set(\sync, 0)}); };
|
|
|
|
////////////////// instrument mode gui ////////////////////////////
|
|
|
|
case
|
|
{~instrPanMode == 0 }{{~instrPanModeGui.value_(0) }.defer }
|
|
{~instrPanMode == 1 }{{~instrPanModeGui.value_(1) }.defer }
|
|
{~instrPanMode == 2 }{{~instrPanModeGui.value_(2) }.defer }
|
|
{~instrPanMode == 3 }{{~instrPanModeGui.value_(3) }.defer }
|
|
{~instrPanMode == 4 }{{~instrPanModeGui.value_(4) }.defer }
|
|
{~instrPanMode == 5 }{{~instrPanModeGui.value_(5) }.defer }
|
|
{~instrPanMode == 6 }{{~instrPanModeGui.value_(6) }.defer }
|
|
{~instrPanMode == 7 }{{~instrPanModeGui.value_(7) }.defer };
|
|
|
|
case
|
|
{~fxMode == 0 }{{~fxModeGui.value_(0) }.defer; ~gtrIn.set(\out, ~ringModBus); ~ringMod.set(\modulator, 0, \mulrate, 0,); }
|
|
{~fxMode == 1 }{{~fxModeGui.value_(1) }.defer; ~gtrIn.set(\out, ~ringModBus); ~ringMod.set(\modulator, 477, \mulrate, 100.1); }
|
|
{~fxMode == 2 }{{~fxModeGui.value_(2) }.defer; ~gtrIn.set(\out, ~ringModBus); ~ringMod.set(\modulator, 277, \mulrate, 100.1);}
|
|
{~fxMode == 3 }{{~fxModeGui.value_(3) }.defer; ~gtrIn.set(\out, ~reverbBus); ~reverbFX.set(\room, 0.6, \mix, 0.5, \damp, 0); }
|
|
{~fxMode == 4 }{{~fxModeGui.value_(4) }.defer; ~gtrIn.set(\out, ~reverbBus); ~reverbFX.set(\room, 0.8, \mix, 0.5, \damp, 0); }
|
|
{~fxMode == 5 }{{~fxModeGui.value_(5) }.defer; ~gtrIn.set(\out, ~reverbBus); ~reverbFX.set(\room, 0.95, \mix, 1, \damp, 0);}
|
|
{~fxMode == 6 }{{~fxModeGui.value_(6) }.defer; ~gtrIn.set(\out, ~ringModBus); ~ringMod.set(\modulator, 1, \mulrate, 3); }
|
|
{~fxMode == 7 }{{~fxModeGui.value_(7) }.defer; ~gtrIn.set(\out, ~ringModBus); ~ringMod.set(\modulator, 2, \mulrate, 5); }
|
|
{~fxMode == 8 }{{~fxModeGui.value_(8) }.defer; ~gtrIn.set(\out, ~ringModBus); ~ringMod.set(\modulator, 3, \mulrate, 7); }
|
|
{~fxMode == 9 }{{~fxModeGui.value_(9) }.defer; ~gtrIn.set(\out, ~ringModBus); ~ringMod.set(\modulator, 5, \mulrate, 13); }
|
|
{~fxMode == 10 }{{~fxModeGui.value_(10) }.defer; ~gtrIn.set(\out, ~ringModBus); ~ringMod.set(\modulator, 8, \mulrate, 21); }
|
|
{~fxMode == 11 }{{~fxModeGui.value_(11) }.defer; ~gtrIn.set(\out, ~ringModBus); ~ringMod.set(\modulator, rrand(1,1111), \mulrate, 1); }
|
|
{~fxMode == 12 }{{~fxModeGui.value_(12) }.defer; ~gtrIn.set(\out, ~ringModBus); ~ringMod.set(\modulator, rrand(1,22111), \mulrate, 1); };
|
|
|
|
|
|
// BUTTON X ----> toggle fx ////////////////////////////////////
|
|
if (msg[13]==1,
|
|
{
|
|
( ~btn4val = (~btn4val + 1) % 13 ) ;
|
|
switch( ~btn4val,
|
|
0, { ~fxMode=0; "fx0".postln; },
|
|
1, { ~fxMode=1; "fx1".postln; },
|
|
2, { ~fxMode=2; "fx2".postln; },
|
|
3, { ~fxMode=3; "fx3".postln; },
|
|
4, { ~fxMode=4; "fx4".postln; },
|
|
5, { ~fxMode=5; "fx5".postln; },
|
|
6, { ~fxMode=6; "fx6".postln; },
|
|
7, { ~fxMode=7; "fx7".postln; },
|
|
8, { ~fxMode=8; "fx8".postln; },
|
|
9, { ~fxMode=9; "fx9".postln; },
|
|
10, { ~fxMode=10; "fx10".postln; },
|
|
11, { ~fxMode=11; "fx11".postln; },
|
|
12, { ~fxMode=12; "fx12".postln; },
|
|
);
|
|
});
|
|
|
|
/////////////////// RESET RANDOM PITCH TO FIXED PITCH IN ONE TAP
|
|
|
|
if (msg[14]==1,
|
|
{
|
|
( ~btn5val = (~btn5val + 1) % 2 ) ;
|
|
switch( ~btn5val,
|
|
0, { ~pitchMode = 0; "PITCH RESET TO UNTRANSPOSED MODE".postln; },
|
|
1, { ~pitchMode = 7; "PITCH IN SENSOR MODE".postln; }
|
|
);
|
|
});
|
|
|
|
// INCREASE IMPULSE RATE ---------------------------------------
|
|
// todo - counter wrap around -- to ping pong count up and down
|
|
// if counter is > then + otherwise minus counter
|
|
if (msg[15]==1,
|
|
{
|
|
( ~btn6val = (~btn6val + 1) % 13 ) ;
|
|
switch(~btn6val,
|
|
0, { ~densMode = 0; "DENSITY MODE 0".postln; },
|
|
1, { ~densMode = 1; "DENSITY MODE 1".postln; },
|
|
2, { ~densMode = 2; "DENSITY MODE 2".postln; },
|
|
3, { ~densMode = 3; "DENSITY MODE 3".postln; },
|
|
4, { ~densMode = 4; "DENSITY MODE 4".postln; },
|
|
5, { ~densMode = 5; "DENSITY MODE 5".postln; },
|
|
6, { ~densMode = 6; "DENSITY MODE 6".postln; },
|
|
7, { ~densMode = 7; "DENSITY MODE 7".postln; },
|
|
8, { ~densMode = 8; "DENSITY MODE 8".postln; },
|
|
9, { ~densMode = 9; "DENSITY MODE 9".postln; },
|
|
10, { ~densMode = 10; "DENSITY MODE 10".postln; },
|
|
11, { ~densMode = 11; "DENSITY MODE 11".postln; },
|
|
12, { ~densMode = 12; "DENSITY MODE 12".postln; },
|
|
|
|
|
|
)
|
|
});
|
|
|
|
// BUTTON X ----- G PANNING MODE
|
|
// TODO FIX MAPPINGS - GUI AND REALITY DO NOT MATCH
|
|
if (msg[16]==1,
|
|
{
|
|
( ~btn7val = (~btn7val + 1) % 9 ) ;
|
|
switch( ~btn7val,
|
|
0, { ~gpanMode = 0 ; "SIGNAL OFF".postln; },
|
|
1, { ~gpanMode = 1 ; "DRY FRONT {STERE0}".postln; },
|
|
2, { ~gpanMode = 2 ; "DRY BACK {STERE0}".postln; },
|
|
3, { ~gpanMode = 3 ; "L/R PAN {STEREO}".postln; },
|
|
4, { ~gpanMode = 4 ; "DRY RaND {STEREO}".postln; },
|
|
5, { ~gpanMode = 5 ; "DRY ROTATE {QUAD}".postln; },
|
|
6, { ~gpanMode = 6 ; "DRY RaND {QUAD}".postln; },
|
|
7, { ~gpanMode = 7 ; "DRY SENSOR {QUAD}".postln; },
|
|
8, { ~gpanMode = 8 ; "PAN RANDOM QUAD".postln; },
|
|
)
|
|
});
|
|
|
|
}, /// SHIFT 0 LOGIC ENDS HERE --------------------------------------------
|
|
|
|
{ // SHIFT IN STATE 1 ======================= ..........................
|
|
|
|
// GTR INPUT =======================
|
|
if (msg[11]==1,
|
|
{
|
|
( ~btn10val = (~btn10val + 1) % 9 ) ;
|
|
|
|
switch(~btn10val,
|
|
|
|
0, { ~gtrIn.set(\instrAmp, 0 ); "DRY SIGNAL OFF".postln; },
|
|
1, { ~instrPanMode=0; ~gtrIn.set(\instrAmp, 1 ); "DRY FRONT {STERE0}".postln; },
|
|
2, { ~instrPanMode=1; "DRY BACK {STERE0}".postln; },
|
|
3, { ~instrPanMode=2; "DRY RaND {STEREO}".postln; },
|
|
4, { ~instrPanMode=3; "L/R PAN {STEREO}".postln; },
|
|
5, { ~instrPanMode=4; "DRY ROTATE {QUAD}".postln; },
|
|
6, { ~instrPanMode=5; "DRY RaND {QUAD}".postln; },
|
|
7, { ~instrPanMode=6; "DRY SENSOR {QUAD}".postln; },
|
|
8, { ~instrPanMode=7; "DRY SENSOR {QUAD}".postln; },
|
|
)
|
|
});
|
|
|
|
// BUTTON X && X RESET/ZERO SENSORS [in firmware just here for notificaton]
|
|
if (msg[12] == 1, { " ===== EULER ZEROED! =====".postln }, {});
|
|
|
|
|
|
// BUTTON X ----- GRANULAR POSITION MODE
|
|
if (msg[13]==1,
|
|
{
|
|
( ~btn12val = (~btn12val + 1) % 8 ) ;
|
|
switch(~btn12val,
|
|
0, { ~posMode = 0; "~posMode 0 ".postln; },
|
|
1, { ~posMode = 1; "~posMode 1 ".postln; },
|
|
2, { ~posMode = 2; "~posMode 2".postln; },
|
|
3, { ~posMode = 3; "~posMode 3".postln; },
|
|
4, { ~posMode = 5; "~posMode 4".postln; },
|
|
5, { ~posMode = 6; "~posMode 5".postln; },
|
|
6, { ~posMode = 7; "~posMode 6 ".postln; },
|
|
7, { ~posMode = 8; "~posMode 7 ".postln; },
|
|
)
|
|
});
|
|
|
|
// BUTTON X ----- GRANULAR PITCH MODE
|
|
if (msg[14]==1,
|
|
{
|
|
( ~btn13val = ((~btn13val + 1) % 8 ) ) ;
|
|
switch(~btn13val,
|
|
0, { ~pitchMode = 0; "pitch mode 0".postln; },
|
|
1, { ~pitchMode = 1; "pitch mode 1".postln; },
|
|
2, { ~pitchMode = 2; "pitch mode 2".postln; },
|
|
3, { ~pitchMode = 3; "pitch mode 3".postln; },
|
|
4, { ~pitchMode = 4; "pitch mode 4".postln; },
|
|
5, { ~pitchMode = 5; "pitch mode 5".postln; },
|
|
6, { ~pitchMode = 6; "pitch mode 6".postln; },
|
|
7, { ~pitchMode = 7; "pitch mode 7".postln; },
|
|
)
|
|
});
|
|
|
|
//~durBtn = 1;
|
|
|
|
// BUTTON X ----- GRAIN DURATION MODE
|
|
if (msg[15]==1,
|
|
{
|
|
( ~btn14val = (~btn14val + 1) % 8 ) ;
|
|
switch(~btn14val,
|
|
0, { ~gdurMode = 0; "DURATION MODE 0".postln; },
|
|
1, { ~gdurMode = 1; "DURATION MODE 1".postln; },
|
|
2, { ~gdurMode = 2; "DURATION MODE 2".postln; },
|
|
3, { ~gdurMode = 3; "DURATION MODE 3".postln; },
|
|
4, { ~gdurMode = 4; "DURATION MODE 4".postln; },
|
|
5, { ~gdurMode = 5; "DURATION MODE 5".postln; },
|
|
6, { ~gdurMode = 6; "DURATION MODE 6".postln; },
|
|
7, { ~gdurMode = 7; "DURATION MODE: SENSOR".postln; },
|
|
)
|
|
});
|
|
|
|
// BUTTON X ----- GRANULAR IMPULSE MODE
|
|
if (msg[16]==1,
|
|
{
|
|
( ~btn15val = (~btn15val + 1) % 2 ) ;
|
|
switch( ~btn15val,
|
|
0, { ~impulseMode = 0; ~g1.set(\impulsemodeindex, 0 ); "IMPULSE MODE FIXED".postln; },
|
|
1, { ~impulseMode = 1; ~g1.set(\impulsemodeindex, 1 ); "IMPULSE MODE DUST".postln; },
|
|
)
|
|
});
|
|
|
|
}); // SHIFT ONE LOGIC ENDS HERE ================
|
|
|
|
} , '/keys');
|
|
// } , '/localhostInLevels');
|
|
);
|
|
);
|
|
}); // end makeBundle for OSC code
|
|
}; // end wait for boot
|
|
|
|
// todo countdown on density voices
|