basic gui added

master
Rob Canning 2022-10-19 10:21:17 +02:00
parent 69fc075715
commit 31a5d4a27a
4 changed files with 441 additions and 188 deletions

View File

@ -1 +1 @@
sudo rfcomm bind 0 10:97:BD:36:D6:4E
rfcomm bind 0 10:97:BD:36:D6:4E

31
go.sh
View File

@ -6,46 +6,41 @@ BTDEV=/dev/rfcomm0;
#killall -9 jackd qjackctl
# turn on bluetooth device
blueman-manager;
blueman-manager &
sleep 1;
killall blueman-manager;
## bind bluetooth to /dev/rfcomm0
## requires password / sudo
if test -e $BTDEV ; then
echo "BLUETOOTH ALREADY BOUND!"
else gnome-terminal --title=BLUDETOOTHBIND -- ./bind_bluetooth.sh;
else gnome-terminal --title=BLUDETOOTHBIND -- rfcomm bind 0 10:97:BD:36:D6:4E;
fi;
# start jackd
if [ $(pidof jackd) ] ; then
echo "jackd ALREADY RUNNING"
else echo "starting jackd"; gnome-terminal --title=JACKD SERVER -- ./start_jackd.sh;
else echo "starting jackd"; gnome-terminal --title=JACKD SERVER -- su -c ./start_jackd.sh rob;
fi;
sleep 2;
sleep 1;
# start node server
echo "starting wavey wind" ;
gnome-terminal --title=NODE SERVER -- node wavey-wind/server.js /dev/rfcomm0 &&
# start supercollider
#scide gtr.scd &
echo "starting supercollider" ;
sh -c 'su -c 'scide gtr.scd' rob &&' ;
# start guitarix
if [ $(pidof guitarix) ] ; then
echo "GUITARIX ALREADY RUNNING"
else echo "starting guitarix"; guitarix;
else echo "starting guitarix"; sh -c 'su -c "guitarix" rob' ;
fi;
sleep 4;
jack_connect system:capture_1 gx_head_amp:in_0 &&
jack_connect gx_head_fx:out_0 SuperCollider:in_1
echo "making jack connections" ;
su -c jack_connect system:capture_1 gx_head_amp:in_0 rob &&
su -c jack_connect gx_head_fx:out_0 SuperCollider:in_1 rob &&

194
gtr-gui-manual.scd 100644
View File

@ -0,0 +1,194 @@
(
Window.closeAll;
w = Window.new().front;
~inputGui = CompositeView(w, Rect(10,80,250,450))
.background_(Color.rand)
.alwaysOnTop_(true);
//~inputGui.decorator = FlowLayout(~inputGui.bounds);
StaticText(w, Rect(10,10,140,50))
.string_("GTR+")
.stringColor_(Color.black)
.background_(Color.rand)
.font_(Font.default.size_(34));
c = QNumberBox(~inputGui, Rect(55, 250, 40, 40))
.font_(Font.default.size_(25))
.background_(Color.white);
a = QSlider(~inputGui, Rect(55, 60, 40, 240))
.action_({
c.value_(a.value)
});
StaticText(~inputGui, Rect(0,0,230,40))
.string_("INPUT //").background_(Color.rand)
.stringColor_(Color.black)
.font_(Font.default.size_(30));
~fxModeGui = QPopUpMenu(~inputGui, Rect(10, 400, 300, 40))
.items_(["dry", "ringmod", "reverb","ringmod and reverb"])
.font_(Font.default.size_(35)).background_(Color.yellow);
~recTrigButton = Button(~inputGui, Rect(100, 50, 140, 45))
.states_([
["TRIGGER", Color.black, Color.green],
["=======", Color.black, Color.red],
])
.font_(Font.default.size_(20))
.value_(0)
.action_({ arg butt;
butt.value.postln;
});
~recModeGui = Button(~inputGui, Rect(100, 110, 140, 90))
.states_([
["TRIGGER \n ACTIVE", Color.black, Color.green],
["LOOPING \n RECORD", Color.black, Color.red],
["ONSET \n DETECTION", Color.black, Color.cyan],
["DISABLE \n RECORDING", Color.black, Color.gray]
])
.font_(Font.default.size_(20))
.value_(2)
.action_({ arg butt;
butt.value.postln;
});
StaticText(~inputGui, Rect(100,200,130,30))
.string_("OVERDUB LEVEL").background_(Color.clear)
.stringColor_(Color.white)
.font_(Font.default.size_(15));
~overdubModeGui = Button(~inputGui, Rect(100, 220, 140, 90))
.states_([
["0%", Color.white, Color.gray],
["30%", Color.white, Color.red],
["50%", Color.white, Color.red],
["75%", Color.white, Color.red],
["90%", Color.white, Color.red],
["100%", Color.white, Color.red],
])
.font_(Font.default.size_(60))
.action_({ arg butt;
butt.value.postln;
});
~instrPanModeGui = QPopUpMenu(~inputGui, Rect(10, 320, 220, 30))
.items_(["OFF","STEREO FRONT","STEREO BACK", "STEREO PAN", "STEREO RND", "QUAD", "QUAD ROTATE", "QUAD RANDOM" ]).font_(Font.default.size_(24));
~c1 = QNumberBox(~inputGui, Rect(200, 360, 70, 40))
.font_(Font.default.size_(25))
.background_(Color.clear);
~a1 = QSlider(~inputGui, Rect(10, 360, 150, 30))
.action_({
~c1.value_(~a1.value)
});
l = LevelIndicator(~inputGui, bounds:Rect(10, 50, 40, 240)).front().value_(1).style_(\led);
l.meterColor = Color.green(0.9);
l.warningColor = Color.yellow(0.7);
l.criticalColor = Color.red(0.5);
///////////// END OF INPUT GUI BOX
// ------------- GRAIN GUI
~grainGui = CompositeView.new(w, bounds:Rect(540,80,350,560))
.background_(Color.white)
.alwaysOnTop_(true);
~grainGui.decorator = FlowLayout(~grainGui.bounds);
VLayout(
StaticText(~grainGui, Rect(50,50,200,30)).string_("gSYNTH////").background_(Color.rand).stringColor_(Color.black).font_(Font.default.size_(30));
StaticText(~grainGui, Rect(50,50,300,40)).string_("PLAYHEAD MODE").background_(Color.clear).stringColor_(Color.black).font_(Font.default.size_(30));
~positionModeGui = QPopUpMenu(~grainGui, Rect(10, 50, 300, 40))
.items_(["Static", "Looping","Randomise","Constrained", "Sensor"])
.font_(Font.default.size_(35)).background_(Color.yellow);
StaticText(~grainGui, Rect(50,50,300,40)).string_("PITCH MODE").background_(Color.clear).stringColor_(Color.black).font_(Font.default.size_(30));
~pitchModeGui = QPopUpMenu.new(~grainGui, Rect(10,100,300,40))
.items_(["no transpose","sensor","octave randomisation", "array 2", "array 3", "array 4", "RND 1", "RND 2", "RND 3", ])
.font_(Font.default.size_(35))
.stringColor_(Color.black).background_(Color.yellow);
StaticText(~grainGui, Rect(50,50,300,40)).string_("DURATION MODE").background_(Color.clear).stringColor_(Color.black).font_(Font.default.size_(30));
~durModeGui = QPopUpMenu.new(~grainGui, Rect(10,150,300,40))
.items_(["0.1","0.2","0.1 - 1", "0.1 - 1", "0.5 - 1", "0.1 - 3"])
.font_(Font.default.size_(35))
.stringColor_(Color.black).background_(Color.yellow);
StaticText(~grainGui, Rect(50,50,300,40)).string_("DENSITY / VOICES").background_(Color.clear).stringColor_(Color.black).font_(Font.default.size_(30));
~densityModeGui = QPopUpMenu.new(~grainGui, Rect(10,200,300,40))
.items_(["1", "2","4","8","16","32","64","128"])
.font_(Font.default.size_(35)).background_(Color.yellow)
.value_(6);
StaticText(~grainGui, Rect(50,50,300,40)).string_("IMPULSE MODE").background_(Color.clear).stringColor_(Color.black).font_(Font.default.size_(30));
~impulseModeGui = QPopUpMenu.new(~grainGui, Rect(10,250,300,40))
.items_(["Impulse","Dust","Array"])
.font_(Font.default.size_(35)).background_(Color.yellow)
.value_(0);
~outAmpModeGui = QSlider(~grainGui, Rect(55, 60, 240, 40)).value_(0.5)
.action_({
~g1.set(\amp, ~outAmpModeGui.value);
});
);
// ------------- GRAIN GUI END
~iSpatGui = CompositeView.new(w, bounds:Rect(500,80,250,400))
.background_(Color.rand)
.alwaysOnTop_(true);
~inputGui.bounds_(Rect(10, 60, 250, 450)); // contents adjust since coords are relative
~grainGui.bounds_(Rect(280, 60, 350, 550)); // contents adjust since coords are relative
~iSpatGui.bounds_(Rect(10, 570, 250, 500)); // contents adjust since coords are relative
)
//~inputGui.resize_(6); // contents adjust since coords are relative
//w.layout = HLayout(~inputGui, ~grainGui);
/*(
Window.closeAll;
w = Window.new("GUI GTR", Rect(100,100,300,300)).layout(
VLayout(
HLayout([~inputGui]);
)
).front
)
w.front;*/

402
gtr.scd
View File

@ -1,47 +1,56 @@
// RUNME 0 =========================================
// todo countdown on density voices
(
s.reboot{
( s.reboot{
s.options.numBuffers = 1024 * 256; // increase this if you need to load more samples
s.options.sampleRate = 44100; // also tried with 44000 value
s.options.memSize = 8192 * 32; // increase this if you get "alloc failed" messages
s.options.numWireBufs = 64; // increase this if you get "exceeded number of interconnect buffers" messages
s.options.maxNodes = 1024 * 32; // increase this if you are getting drop outs and the message "too many nodes"
s.options.numInputBusChannels = 4;
s.options.numOutputBusChannels = 4;
} )
// RUNME 0 =========================================
s.boot();
s.options.numInputBusChannels = 8;
s.options.numOutputBusChannels = 8;
})
// RUNME 1 =========================================
// -------------------------------------------------
( // SETUP ----------------------------------------- -
// ---------------------------------------------------
( // SETUP -----------------------------------------
// Allocate a 4 second mono buffer
b = Buffer.alloc(s, s.sampleRate * 4.0, 1);
~b1 = Buffer.alloc(s, s.sampleRate * 4.0, 1);
f = Buffer.alloc(s, s.sampleRate * 4.0, 1);
// load a test file
f = Buffer.read(s, thisProcess.nowExecutingPath.dirname
+/+ "sounds/Front_Left.wav");
//f = Buffer.read(s, thisProcess.nowExecutingPath.dirname +/+ "sounds/Front_Left.wav");
//b = Buffer.read(s, "/usr/share/sounds/alsa/Front_Left.wav");
//b=f;
// Open port 57121 for ESP32 UDP OSC
thisProcess.openUDPPort(57121);
///////////////////////////////////////
~sourceGroup = Group.new;
~fxGroup = Group.after(~sourceGroup);
~reverbBus = Bus.audio(s, 1);
~ringModBus = Bus.audio(s, 1);
//load the gui
"/home/rob/gtr/gtr-gui-manual.scd".load;
);
s.plotTree;
// RUNME 2 ==========================================
// -------------------------------------------------
( // DEFINE SYNTHS --------------------------------- <--
(( // DEFINE SYNTHS --------------------------------- <--
// -------------------------------------------------
( // direct signal + reverb -------------------------
SynthDef("dryIn", { arg in=0, instrPanModeIndex=0, out=0, sensorInstrPan=0;
SynthDef("dryIn", { arg in=0, instrPanModeIndex=0, out=0, 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);
@ -52,16 +61,42 @@ SynthDef("dryIn", { arg in=0, instrPanModeIndex=0, out=0, sensorInstrPan=0;
instrPanMode5 = LFNoise1.kr(10).range(-1, 1);
instrPan = Select.kr(instrPanModeIndex,
[instrPanMode0, instrPanMode1, instrPanMode2, instrPanMode3, instrPanMode4, instrPanMode5, sensorInstrPan]);
[instrPanMode0, instrPanMode1, instrPanMode2, instrPanMode3,
instrPanMode4, instrPanMode5, sensorInstrPan]);
signal = SoundIn.ar(in);
//wet = FreeVerb.ar(dry, mix:0.4, room:0.55, damp:0);
signal = PanAz.ar(4, signal, instrPan);
signal = signal * 0.9;
//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;
var signal, dry, wet;
dry = In.ar(in);
wet = FreeVerb.ar(dry, mix:0.5, room:1, damp:0);
signal = wet * 0.9;
Out.ar(0, signal);
}).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(0, signal!2);
}).add;
);
( // mono buffer recorder ----------------------------
// with loop and overdub modes /////////////////////
// make record togglable between looping, direct or onset detection trigger
@ -91,7 +126,7 @@ SynthDef("recBuf",{
//z = Buffer.sendCollection(s, winenv.discretize, 1);
// ~rndpos = LFNoise2.kr(0.1).range(0, 1);
SynthDef(\buf_grain, { | out, gate = 1, amp = 0.5,
SynthDef(\buf_grain, { | out=0, gate = 1, amp = 0.5,
sndbuf, envbuf, pan=0, imp=50,
pitchmodeindex=0, sensorpitch=1, sensorgdur=0.1, sensorgpan=0,
positionmodeindex=0, gdurmodeindex=0, gpanmodeindex=0,
@ -99,22 +134,23 @@ SynthDef(\buf_grain, { | out, gate = 1, amp = 0.5,
signalChannelIndex=1, dseqarrayIndex=1,
rlow= -1, rhigh=10 |
var signal, env, freqdev, pos,
pitchmode0, pitchmode1, pitchmode2,pitchmode3,pitchmode4,pitchmode5, pitchmode6, pitch,
gdurmode0, gdurmode1, gdurmode2, gdurmode3, gdurmode4, gdurmode5, gdurmode6, gdur,
gpanmode0, gpanmode1, gpanmode2, gpan,
positionmode0, positionmode1, positionmode2, positionmode3, position,
impulsemode0, impulsemode1, impulse, xdseq, dseq_array1, dseq_array2, dseq_array3, dseq_array4, dseq_array5, dseq_array6, stereosignal, quadsignalL, quadsignalR, quadsignal, signalchannels;
impulsemode0, impulsemode1, impulse,
xdseq, dseq_array1, dseq_array2, dseq_array3, dseq_array4, dseq_array5, dseq_array6,
stereosignal, quadsignalL, quadsignalR, quadsignal, signalchannels;
// grain duration mode -untransposed, random, or sensor controlled
gdurmode0 = 0.2;
gdurmode1 = 0.5;
gdurmode2 = LFNoise1.kr.range(0.1, 0.3);
gdurmode3 = LFNoise1.kr.range(0.1, 0.6);
gdurmode4 = LFNoise1.kr.range(0.6, 0.6);
gdurmode5 = LFNoise1.kr.range(0.1, 2.6);
gdurmode6 = LFNoise1.kr.range(0.01, 4);
gdurmode4 = LFNoise1.kr.range(1, 2);
gdurmode5 = LFNoise1.kr.range(1, 4);
gdurmode6 = LFNoise1.kr.range(4, 4);
gdur = Select.kr(gdurmodeindex,
[gdurmode0, gdurmode1, gdurmode2, gdurmode3, gdurmode4, gdurmode5, gdurmode6, sensorgdur]);
@ -130,31 +166,29 @@ SynthDef(\buf_grain, { | out, gate = 1, amp = 0.5,
Scale.minor.degrees.midiratio;
dseq_array1 = Dseq([1,-1, 2, 1, -1.5, 1, 1.33, 1, -0.5, 1, 3, 1, 2.37, 1, -0.33, 1], inf);
/* dseq_array1 = Dseq([1,-1, 2, 1, -1.5, 1, 1.33, 1, -0.5, 1, 3, 1, 2.37, 1, -0.33, 1], inf);
dseq_array2 = Dseq([1,-1, -0.5, 1, 1.33, 1], inf);
dseq_array3 = Drand([(1..5).mirror.midiratio], inf);
dseq_array4 = Drand(Scale.minor.degrees.midiratio, inf);
dseq_array5 = Dseq([1,-1, -0.5, 1, 1.33, 1], inf);
//
dseq_array5 = Dseq([1,-1, -0.5, 1, 1.33, 1], inf);*/
//
// xdseq = [dseq_array1, dseq_array2,dseq_array3, dseq_array4, dseq_array5];
dseqarrayIndex =1;
//dseqarrayIndex =1;
pitchmode0 = 1;
pitchmode1 = Demand.kr(Impulse.kr(imp), 0, Dseq([1,-1, 2, 1, -1.5, 1, 1.33, 1, -0.5, 1, 3, 1, 2.37, 1, -0.33, 1], inf));
//pitchmode1 = Demand.kr(Impulse.kr(imp), 0, Dseq([1,-1, 2, 1, -1.5, 1, 1.33, 1, -0.5, 1, 3, 1, 2.37, 1, -0.33, 1], inf));
pitchmode1 = Demand.kr(Impulse.kr(imp), 0, Drand([1,1, 1,1,1,1, 2, 3, 3, 0.5, 0.5], inf));
pitchmode2 = Demand.kr(Impulse.kr(imp), 0, Drand(Scale.minor.degrees.midiratio, inf) * Drand([0.5, 0.25,1,2], inf));
pitchmode3 = Demand.kr(Impulse.kr(imp), 0, Dseq([1,-1, -0.5, 1, 1.33, 1], inf));
pitchmode4 = Demand.kr(Impulse.kr(imp), 0, Drand([0.5, 0.25,1,2], inf));
pitchmode5 = Demand.kr(Impulse.kr(imp), 0, Drand(Scale.diminished.degrees.midiratio, inf));
pitchmode6 = LFNoise1.kr(imp).range(rlow, rhigh);
pitch = Select.kr(pitchmodeindex,
[pitchmode0, sensorpitch, pitchmode1, pitchmode2 ,pitchmode3, pitchmode4, pitchmode5, pitchmode6]);
// granular playhead mode - fixed random or sensor controlled
positionmode0 = 0.2;
positionmode1 = (Phasor.ar(0.01, 1 * BufRateScale.ir(b), 0, BufSamples.ir(b)) + LFNoise1.ar(100).bipolar(0.1 * SampleRate.ir) ) / BufSamples.ir(b);
@ -180,28 +214,39 @@ SynthDef(\buf_grain, { | out, gate = 1, amp = 0.5,
);
)
// RUNME 3 ==========================================
// ----------------------------------------------------
(( // START SYNTHS ---------------------------------
// ----------------------------------------------------
// TODO NO EPRAND IN INSTR!
(( // RUNME 3 ==========================================
// START SYNTHS ---------------------------------
// ----------------------------------------------------
r = Synth(\recBuf, [\in, 0, \out, 0, \bufnum, b, \t_trig, 0]); // recorder
~g1 = Synth(\buf_grain, [\sndbuf, b, \amp, 0.5, \envbuf, -1, \gate, 1, doneAction: 2]); // granulate
~gtrIn = Synth(\dryIn); // dry audio signaL
~g1 = Synth(\buf_grain, [\sndbuf, b, \amp, 0.5, \envbuf, -1, \gate, 1, doneAction: 2, ], ~fxGroup); // granulate
~gtrIn = Synth(\dryIn, [\instrAmp, 1, \out, ~ringModBus], ~sourceGroup); // dry audio signaL
~reverbFX = Synth(\freeVerb, [\in, ~reverbBus], ~fxGroup);
~ringMod = Synth(\ringModulator, [\in, ~ringModBus], ~fxGroup);
));
// RUNME 4 ==========================================
// ----------------------------------------------------
~ringMod.set(\in, 9);
~gtrIn.set(\out, 0);
~gtrIn.set(\out, ~ringModBus);
~gtrIn.set(\out, ~reverbBus);
~gtrIn.set(\out, [~reverbBus, ~ringModBus]);
~ringMod.set(\modulator, 0);
~ringMod.set(\mulrate, 0);
// RUNME 4 ==========================================
// ----------------------------------------------
OSCFunc.trace(true); // Turn posting on
OSCFunc.trace(false); // Turn posting off
(( // OSC Receivers // ENABLE SENSOR AND SWITCH VALUES <--
// ----------------------------------------------------
~pitchmode = 0; ~positionmode = 0; ~impulsemode = 1;
~overdubmode= 0; ~pitchmode = 0; ~positionmode = 0; ~impulsemode = 1;
~gdurmode=0; ~gpanmode=0; ~channelmode=0;
~instrPanMode=0;
@ -229,11 +274,11 @@ SynthDef(\buf_grain, { | out, gate = 1, amp = 0.5,
~g1.set(\gpanmodeindex, ~gpanmode );
// PITCH ------- Y Pitch
~g1.set(\sensorpitch, ( msg[3] * 5 ) + 1 );
~g1.set(\sensorpitch, msg[3]+1 * 2);
~g1.set(\pitchmodeindex, ~pitchmode );
// POSITION ------- Z Yaw
~g1.set(\sensorposition, msg[2].linlin(-1, 1, 0.05, 3.99));
~g1.set(\sensorposition, msg[1].linlin(-0.2, 0.6, 0.05, 3.99));
~g1.set(\positionmodeindex, ~positionmode );
// RATE ------- X (roll [with PAN])
@ -268,8 +313,23 @@ SynthDef(\buf_grain, { | out, gate = 1, amp = 0.5,
// ----------------------------------------------------
// button press mapping ///////////////////////////////
// ----------------------------------------------------
p = OSCdef(\keys, { arg msg, time, addr, recvPort;
n = NetAddr("127.0.0.1", NetAddr.langPort);
//~switchArray = [0, 0, 0, 0 ,0 ,0 ,0, 0, 0, 0, 0, 0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ];
//~switchArray.put(15, 1); ~switchArray.put(11, 1); ~switchArray.put(10, 1); ~switchArray.put(9, 1);
//j = List.new;
//j = ~switchArray.replace("[", "").replace("]", "");
//n.sendMsg("/keys", 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
//n.sendMsg("/keys",);
//n.sendMsg("/keys", 1,2,3,4,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1);
p = OSCdef(\keys, { arg msg, time, addr, recvPort;
//msg[1].postln;
~btnsA[~btn2val, ~btn3val];
~btnsB[~btn4val, ~btn5val, ~btn6val, ~btn7val];
~btnsC[~btn5val];
@ -290,45 +350,61 @@ p = OSCdef(\keys, { arg msg, time, addr, recvPort;
// BUTTON X ----- TRIGGER ONESHOT BUFFER RECORD
if (msg[10] == 1, { r.set( \in, 0, \l, 0, \t_trig, 1);
"/////////// SAMPLING!".postln }, {});
"/////////// 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; },
1, { r.set(\l, 1); "RECORD LOOPING ON".postln; },
2, { r.set(\l, 1); "RECORDING ONSET DETECTION ON".postln; }, //todo
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, 1); "ONSET DETECTION ON".postln; { ~recModeGui.value_(2) }.defer },
);
});
// BUTTON X ----> OVERDUB RECORDING MODE ON/OFF
if (msg[12]==1,
{
( ~btn3val = (~btn3val + 1) % 5 ) ;
( ~btn3val = (~btn3val + 1) % 6 ) ;
switch( ~btn3val,
0, { r.set(\overdub, 0); "SAMPLE OVERDUB OFF".postln; },
1, { r.set(\overdub, 0.5); "SAMPLE OVERDUB ON 50%".postln; },
2, { r.set(\overdub, 0.75); "SAMPLE OVERDUB ON 75%".postln; },
3, { r.set(\overdub, 0.90); "SAMPLE OVERDUB ON 90%".postln; },
4, { r.set(\overdub, 1); "SAMPLE OVERDUB ON 100%".postln; },
0, { r.set(\overdub, 0); "SAMPLE OVERDUB OFF".postln; { ~overdubModeGui.value_(0) }.defer },
1, { r.set(\overdub, 0.3); "SAMPLE OVERDUB ON 30%".postln; { ~overdubModeGui.value_(1) }.defer },
2, { r.set(\overdub, 0.5); "SAMPLE OVERDUB ON 50%".postln; { ~overdubModeGui.value_(2) }.defer },
3, { r.set(\overdub, 0.75); "SAMPLE OVERDUB ON 75%".postln; { ~overdubModeGui.value_(3) }.defer },
4, { r.set(\overdub, 0.90); "SAMPLE OVERDUB ON 90%".postln; { ~overdubModeGui.value_(4) }.defer },
5, { r.set(\overdub, 1); "SAMPLE OVERDUB ON 100%".postln; { ~overdubModeGui.value_(5) }.defer },
)
});
//TODO btn7 repeated counter fix
// BUTTON X ----> toggle fx
if (msg[13]==1,
{
( ~btn4val = (~btn4val + 1) % 4 ) ;
switch( ~btn4val,
0, { r.set(\l, 0); "dry".postln; { ~gtrIn.set(\out, ~ringModBus); ~ringMod.set(\modulator, 0, \mulrate, 0); ~fxModeGui.value_(0) }.defer },
1, { r.set(\l, 1); "ring mod".postln; { ~gtrIn.set(\out, ~ringModBus); ~ringMod.set(\modulator, 77, \mulrate, 0.1); ~fxModeGui.value_(1) }.defer },
2, { r.set(\l, 1); "reverb".postln; { ~gtrIn.set(\out, ~reverbBus); ~fxModeGui.value_(2) }.defer },
3, { r.set(\l, 1); "reverb + ringmod".postln; { ~gtrIn.set(\out, [~reverbBus, ~ringModBus]); ~fxModeGui.value_(3) }.defer },
);
});
~gtrIn.set(\out, ~ringModBus);
/////////////////// 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 = 1; "PITCH IN SENSOR MODE".postln; }
0, { ~pitchmode = 0; "PITCH RESET TO UNTRANSPOSED MODE".postln; { ~pitchModeGui.value_(0) }.defer },
1, { ~pitchmode = 1; "PITCH IN SENSOR MODE".postln; { ~pitchModeGui.value_(1) }.defer }
);
});
// INCREASE IMPULSE RATE ---------------------------------------
@ -337,14 +413,14 @@ p = OSCdef(\keys, { arg msg, time, addr, recvPort;
{
( ~btn6val = (~btn6val + 1) % 8 ) ;
switch(~btn6val,
0, { ~g1.set(\imp, 1); "IMPULSE = 1".postln; },
1, { ~g1.set(\imp, 2); "IMPULSE = 2".postln; },
2, { ~g1.set(\imp, 4); "IMPULSE = 4".postln; },
3, { ~g1.set(\imp, 8); "IMPULSE = 8".postln; },
4, { ~g1.set(\imp, 16); "IMPULSE = 16".postln; },
5, { ~g1.set(\imp, 32); "IMPULSE = 32".postln; },
6, { ~g1.set(\imp, 64); "IMPULSE = 64".postln; },
7, { ~g1.set(\imp, 128); "IMPULSE = 128".postln; },
0, { ~g1.set(\imp, 1); "IMPULSE = 1".postln; { ~densityModeGui.value_(0) }.defer },
1, { ~g1.set(\imp, 2); "IMPULSE = 2".postln; { ~densityModeGui.value_(1) }.defer },
2, { ~g1.set(\imp, 4); "IMPULSE = 4".postln; { ~densityModeGui.value_(2) }.defer },
3, { ~g1.set(\imp, 8); "IMPULSE = 8".postln; { ~densityModeGui.value_(3) }.defer },
4, { ~g1.set(\imp, 16); "IMPULSE = 16".postln; { ~densityModeGui.value_(4) }.defer },
5, { ~g1.set(\imp, 32); "IMPULSE = 32".postln; { ~densityModeGui.value_(5) }.defer },
6, { ~g1.set(\imp, 64); "IMPULSE = 64".postln; { ~densityModeGui.value_(6) }.defer },
7, { ~g1.set(\imp, 64); "IMPULSE = 64".postln; { ~densityModeGui.value_(7) }.defer },
)
});
@ -363,7 +439,6 @@ p = OSCdef(\keys, { arg msg, time, addr, recvPort;
}, /// SHIFT 0 LOGIC ENDS HERE --------------------------------------------
{
// SHIFT IN STATE 1 ======================= ..........................
// GTR INPUT =======================
@ -373,15 +448,15 @@ p = OSCdef(\keys, { arg msg, time, addr, recvPort;
switch(~btn10val,
0, { ~gtrIn.set(\in, 1 ); "DRY SIGNAL OFF".postln; },
1, { ~gtrIn.set(\in, 0 ); ~instrPanMode=0; "DRY FRONT {STERE0}".postln; },
2, { ~gtrIn.set(\in, 0 ); ~instrPanMode=1; "DRY BACK {STERE0}".postln; },
3, { ~gtrIn.set(\in, 0 ); ~instrPanMode=2; "DRY RaND {STEREO}".postln; },
4, { ~gtrIn.set(\in, 0 ); ~instrPanMode=3; "DRY L/R PAN {STEREO}".postln; },
5, { ~gtrIn.set(\in, 0 ); ~instrPanMode=4; "DRY ROTATE {QUAD}".postln; },
6, { ~gtrIn.set(\in, 0 ); ~instrPanMode=5; "DRY RaND {QUAD}".postln; },
7, { ~gtrIn.set(\in, 0 ); ~instrPanMode=6; "DRY SENSOR {QUAD}".postln; },
8, { ~gtrIn.set(\in, 0 ); ~instrPanMode=7; "DRY SENSOR {QUAD}".postln; },
0, { ~gtrIn.set(\instrAmp, 0 ); "DRY SIGNAL OFF".postln;{ ~instrPanModeGui.value_(0)}.defer },
1, { ~gtrIn.set(\in, 0, \instrAmp, 1 ); ~instrPanMode=0; "DRY FRONT {STERE0}".postln; { ~instrPanModeGui.value_(1)}.defer },
2, { ~gtrIn.set(\in, 0 ); ~instrPanMode=1; "DRY BACK {STERE0}".postln; { ~instrPanModeGui.value_(2)}.defer },
3, { ~gtrIn.set(\in, 0 ); ~instrPanMode=2; "DRY RaND {STEREO}".postln; { ~instrPanModeGui.value_(3)}.defer },
4, { ~gtrIn.set(\in, 0 ); ~instrPanMode=3; "L/R PAN {STEREO}".postln; { ~instrPanModeGui.value_(4)}.defer },
5, { ~gtrIn.set(\in, 0 ); ~instrPanMode=4; "DRY ROTATE {QUAD}".postln; { ~instrPanModeGui.value_(5)}.defer },
6, { ~gtrIn.set(\in, 0 ); ~instrPanMode=5; "DRY RaND {QUAD}".postln; { ~instrPanModeGui.value_(6)}.defer },
7, { ~gtrIn.set(\in, 0 ); ~instrPanMode=6; "DRY SENSOR {QUAD}".postln; { ~instrPanModeGui.value_(7)}.defer },
8, { ~gtrIn.set(\in, 0 ); ~instrPanMode=7; "DRY SENSOR {QUAD}".postln; { ~instrPanModeGui.value_(8)}.defer },
)
});
@ -396,42 +471,51 @@ p = OSCdef(\keys, { arg msg, time, addr, recvPort;
{
( ~btn12val = (~btn12val + 1) % 5 ) ;
switch(~btn12val,
0, { ~positionmode = 0; "POSITION MODE FIXED".postln; },
1, { ~positionmode = 1; "POSITION MODE LOOPING".postln; },
2, { ~positionmode = 2; "POSITION MODE RANDOM".postln; },
3, { ~positionmode = 3; "POSITION CONSTRAINED RND".postln; },
4, { ~positionmode = 4; "POSITION MODE SENSOR".postln; },
0, { ~positionmode = 0; "PLAYHEAD MODE FIXED".postln; { ~positionModeGui.value_(0) }.defer },
1, { ~positionmode = 1; "PLAYHEAD MODE LOOPING".postln; { ~positionModeGui.value_(1) }.defer },
2, { ~positionmode = 2; "PLAYHEAD MODE RANDOM".postln; { ~positionModeGui.value_(2) }.defer },
3, { ~positionmode = 3; "PLAYHEAD CONSTRAINED RND".postln; { ~positionModeGui.value_(3) }.defer },
4, { ~positionmode = 4; "PLAYHEAD MODE SENSOR".postln; { ~positionModeGui.value_(4) }.defer },
)
});
// BUTTON X ----- GRANULAR PITCH MODE
if (msg[14]==1,
{
( ~btn13val = (~btn13val + 1) % 8 ) ;
( ~btn13val = ((~btn13val + 1) % 9 ) ) ;
switch(~btn13val,
0, { ~pitchmode = 2; "pitch array 0".postln; },
1, { ~pitchmode = 3; "pitch array 1".postln; },
2, { ~pitchmode = 4; "pitch array 2".postln; },
3, { ~pitchmode = 5; "pitch array 3".postln; },
4, { ~pitchmode = 6; "pitch array 4".postln; },
5, { ~pitchmode = 7; ~g1.set(\rlow, -0.8 ); ~g1.set(\rhigh, 1.5); "PITCH MODE RANDOM 4".postln; },
6, { ~pitchmode = 7; ~g1.set(\rlow, -3 ); ~g1.set(\rhigh, 3); "PITCH MODE RANDOM 5".postln; },
7, { ~pitchmode = 7; ~g1.set(\rlow, -8 ); ~g1.set(\rhigh, 8); "PITCH MODE RANDOM 6".postln; },
0, { ~pitchmode = 0; "pitch array 0".postln; { ~pitchModeGui.value_(0) }.defer },
1, { ~pitchmode = 1; "pitch array 1".postln; { ~pitchModeGui.value_(1) }.defer },
2, { ~pitchmode = 2; "pitch array 0".postln; { ~pitchModeGui.value_(2) }.defer },
3, { ~pitchmode = 3; "pitch array 0".postln; { ~pitchModeGui.value_(3) }.defer },
4, { ~pitchmode = 4; "pitch array 2".postln; { ~pitchModeGui.value_(4) }.defer },
5, { ~pitchmode = 5; "pitch array 3".postln; { ~pitchModeGui.value_(5) }.defer },
6, { ~pitchmode = 6; "pitch array 4".postln; { ~pitchModeGui.value_(6) }.defer },
7, { ~pitchmode = 7; ~g1.set(\rlow, -0.8 ); ~g1.set(\rhigh, 1.5);
"PITCH MODE RANDOM 4".postln; { ~pitchModeGui.value_(7) }.defer },
8, { ~pitchmode = 7; ~g1.set(\rlow, -3 ); ~g1.set(\rhigh, 3);
"PITCH MODE RANDOM 5".postln; { ~pitchModeGui.value_(8) }.defer },
9, { ~pitchmode = 7; ~g1.set(\rlow, -8 ); ~g1.set(\rhigh, 8);
"PITCH MODE RANDOM 6".postln; { ~pitchModeGui.value_(9) }.defer },
)
});
//~durBtn = 1;
// BUTTON X ----- GRAIN DURATION MODE
if (msg[15]==1,
{
( ~btn14val = (~btn14val + 1) % 7 ) ;
( ~btn14val = (~btn14val + 1) % 8 ) ;
switch(~btn14val,
0, { ~gdurmode = 0; ~g1.set(\imp, 64); "DURATION MODE 0".postln; },
1, { ~gdurmode = 1; ~g1.set(\imp, 30); "DURATION MODE 1".postln; },
2, { ~gdurmode = 2; ~g1.set(\imp, 20); "DURATION MODE 2".postln; },
3, { ~gdurmode = 3; ~g1.set(\imp, 15); "DURATION MODE 3".postln; },
4, { ~gdurmode = 4; ~g1.set(\imp, 10); "DURATION MODE 4".postln; },
5, { ~gdurmode = 5; ~g1.set(\imp, 5); "DURATION MODE 5".postln; },
6, { ~gdurmode = 6; ~g1.set(\imp, 3); "DURATION MODE 6".postln; },
0, { ~gdurmode = 0; "DURATION MODE 0".postln; { ~durModeGui.value_(0) }.defer },
1, { ~gdurmode = 1; "DURATION MODE 1".postln; { ~durModeGui.value_(1) }.defer },
2, { ~gdurmode = 2; "DURATION MODE 2".postln; { ~durModeGui.value_(2) }.defer },
3, { ~gdurmode = 3; "DURATION MODE 3".postln; { ~durModeGui.value_(3) }.defer },
4, { ~gdurmode = 4; "DURATION MODE 4".postln; { ~durModeGui.value_(4) }.defer },
5, { ~gdurmode = 5; "DURATION MODE 5".postln; { ~durModeGui.value_(5) }.defer },
6, { ~gdurmode = 6; "DURATION MODE 6".postln; { ~durModeGui.value_(6) }.defer },
7, { ~gdurmode = 7; "DURATION MODE: SENSOR".postln; { ~durModeGui.value_(7) }.defer },
)
});
@ -440,9 +524,9 @@ p = OSCdef(\keys, { arg msg, time, addr, recvPort;
{
( ~btn15val = (~btn15val + 1) % 3 ) ;
switch( ~btn15val,
0, { ~g1.set(\impulsemodeindex, 0 ); "IMPULSE MODE FIXED".postln; },
1, { ~g1.set(\impulsemodeindex, 1 ); "IMPULSE MODE DUST".postln; },
2, { ~g1.set(\impulsemodeindex, 2 ); "IMPULSE MODE SENSOR".postln; },
0, { ~g1.set(\impulsemodeindex, 0 ); "IMPULSE MODE FIXED".postln; { ~impulseModeGui.value_(0) }.defer },
1, { ~g1.set(\impulsemodeindex, 1 ); "IMPULSE MODE DUST".postln; { ~impulseModeGui.value_(1) }.defer },
2, { ~g1.set(\impulsemodeindex, 2 ); "IMPULSE MODE SENSOR".postln; { ~impulseModeGui.value_(2) }.defer },
)
});
@ -452,61 +536,34 @@ p = OSCdef(\keys, { arg msg, time, addr, recvPort;
));
// ----------------------------------------------------
// PERFORMABLE PARAMETERS /////////////////////////////
// LIVE CODE / PERFORMABLE PARAMETERS /////////////////
// ----------------------------------------------------
thisProcess.platform.recordingsDir;// find where the recordings are written to
s.record(numChannels:4); // record
// set recorder loop and overdub modes ////////////
// start recording (without button)
r.set(\in, 0, \l, 0, \t_trig, 1);
r.set(\l, 1); // looping record on/off 0/1 - MAPPED TO SWITCH 3
r.set(\overdub, 0.9); // overdub mode 0 - 0.99 - MAPPED TO SWITCH 4
// set recorder loop and overdub modes
r.set(\l, 1); // looping record on - MAPPED TO SWITCH 3
r.set(\l, 0); // off
/////////////////////
~g1.set(\pitchmodeindex, 1); // pitchmode
~g1.set(\gdurmodeindex, 1); // grain duration mode
~g1.set(\imp,2); // grain impulse rate
~g1.set(\impulsemodeindex, 1); // 0 1 2 imp, dust, sensor
~g1.set(\positionmodeindex, 1); // playhead FIXED.RND.SENSOR 0 1 2
~g1.set(\gpanmodeindex, 1); // pan mode
~g1.set(\amp, 0); // amplitude
r.set(\overdub, 1); // overdub mode on - MAPPED TO SWITCH 4
r.set(\overdub, 0); // off
~ringMod.set(\modulator, 0); // 0 to disable
/// random pitch/rate low and high values
~g1.set(\rlow, 1);
~g1.set(\rlow, 0.2);
~g1.set(\rhigh, 2);
~g1.set(\rlow, 10); // APPLIES ONLY TO PITCH MODE 7
~g1.set(\rhigh, 1);
1.midiratio;
33.midiratio;
~impulsemode = 0; // impulse
~impulsemode = 1; // dust
~impulsemode = 2; // sensor
~pitchmode = 0; // no transpose
~pitchmode = 1; // sensor (pitch) input
~pitchmode = 2; // random2
~pitchmode = 3; // random3
~pitchmode = 4; // random4
~pitchmode = 5; // random5
~pitchmode = 6; //
~positionmode = 0; // middle of sample
~positionmode = 1; // random position
~positionmode = 2; // sensor (position) input
~gdurmode = 0 ; // random position
~gdurmode = 1 ; // random position
~gdurmode = 2 ; // random position
~gdurmode = 3 ; // random position
~gdurmode = 4 ; // random position
~gdurmode = 5 ; // random position
~gdurmode = 6 ; // random position
~gpanmode = 0 ; // random position
~gpanmode = 1 ; // random position
~gpanmode = 2 ; // random position
~gpanmode = 3 ; // random position
~dseqarrayIndex=0;
~g1.set(\dseqarrayIndex, 0);
@ -515,25 +572,31 @@ r.set(\overdub, 0); // off
~channelmode = 1;
~ringMod.set(\in, 9);
~gtrIn.set(\out, 0);
~gtrIn.set(\out, ~ringModBus);
~gtrIn.set(\out, ~reverbBus);
~gtrIn.set(\out, [~reverbBus, ~ringModBus]);
~ringMod.set(\modulator, 77, \mulrate, 0.1);
~ringMod.set(\modulator, 0, \mulrate, 0);
~ringMod.set(\mulrate, 0);
~gtrIn.set(\instrAmp, 1);
// set grain impulse rate
~g1.set(\imp, 10);
// fix doneaction
~g1.set(\gate, 1); // granulator on
~g1.set(\gate, 0); // granulator off
~g1.set(\amp, 0.5); // granulator off
~g1.set(\amp, 1); // granulator off
a = Scale.major;
/////////////////////////////////////////////////
// -----------------------------------------------
// -----------------------------------------------
// -----------------------------------------------
// -----------------------------------------------
// list all open ports
@ -543,8 +606,9 @@ a = Scale.major;
// switch to the custom env
//~g1.set(\envbuf, z);
//~g1.set(\envbuf, -1);
//n = NetAddr("127.0.0.1", NetAddr.langPort);
n = NetAddr("127.0.0.1", NetAddr.langPort);
//n = NetAddr.new("224.0.1.9", 6696);