spatialisation updates to SC and interface

master
Rob Canning 2022-09-12 08:46:12 +02:00
parent 156ebc1b2a
commit 0c81b6db25
4 changed files with 268 additions and 274 deletions

40
go.sh
View File

@ -1,19 +1,51 @@
#! /bin/bash
BTDEV=/dev/rfcomm0;
# kill any exsisting jack ghosts
killall -9 jackd qjackctl
#killall -9 jackd qjackctl
# turn on bluetooth device
blueman-manager;
## bind bluetooth to /dev/rfcomm0
## requires password / sudo
gnome-terminal --title=BLUDETOOTHBIND -- ./bind_bluetooth.sh;
if test -e $BTDEV ; then
echo "BLUETOOTH ALREADY BOUND!"
else gnome-terminal --title=BLUDETOOTHBIND -- ./bind_bluetooth.sh;
fi;
# start jackd
gnome-terminal --title=JACKD SERVER -- ./start_jackd.sh &&
if [ $(pidof jackd) ] ; then
echo "jackd ALREADY RUNNING"
else echo "starting jackd"; gnome-terminal --title=JACKD SERVER -- ./start_jackd.sh;
fi;
sleep 2;
# start node server
gnome-terminal --title=NODE SERVER -- node wavey-wind/server.js /dev/rfcomm0 &&
# start supercollider
scide gtr.scd &
#scide gtr.scd &
# start guitarix
if [ $(pidof guitarix) ] ; then
echo "GUITARIX ALREADY RUNNING"
else echo "starting guitarix"; guitarix;
fi;
sleep 4;
jack_connect system:capture_1 gx_head_amp:in_0 &&
jack_connect gx_head_fx:out_0 SuperCollider:in_1

498
gtr.scd
View File

@ -1,3 +1,5 @@
////////////////////////////////////////////////////
/* GRANULATING SAMPLER INSTRUMENT //////////////////
////////////////////////////////////rc@kiben.net////
@ -12,6 +14,14 @@
Ljudmila OTF Hackathon, Maribor 1-6 March 2022 */
// GTR MAC address: 10:97:BD:36:D6:4E
// DUMP ALL OSC MESSAGES (for debugging) ////////
OSCFunc.trace(true);
OSCFunc.trace(false);
thisProcess.openPorts;
(
s.reboot{
@ -25,13 +35,13 @@ s.reboot{
s.options.numOutputBusChannels = 4;
} )
// RUNME 0 =========================================
s.boot();
// RUNME 1 =========================================
// -------------------------------------------------
( // SETUP ----------------------------------------- -
// ---------------------------------------------------
// Allocate a 4 second mono buffer
@ -46,18 +56,26 @@ thisProcess.openUDPPort(57121);
// RUNME 2 ==========================================
// -------------------------------------------------
( // DEFINE SYNTHS --------------------------------- <--
// -------------------------------------------------
( // direct signal + reverb -------------------------
SynthDef("dryIn", { arg in=0, instrPanModeIndex=0, out=0, sensorInstrPan=0;
var signal, dry, wet, instrPan, instrPanMode0, instrPanMode1, instrPanMode2, instrPanMode3, instrPanMode4, instrPanMode5;
SynthDef("dryIn", { arg in=0, out=0;
var signal, dry, wet;
dry = SoundIn.ar(in);
wet = FreeVerb.ar(dry, mix:0.4, room:0.55, damp:0);
signal = Pan2.ar(wet, 0);
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);
//wet = FreeVerb.ar(dry, mix:0.4, room:0.55, damp:0);
signal = PanAz.ar(4, signal, instrPan);
signal = signal * 0.9;
Out.ar(0, signal);
}).add;
@ -93,58 +111,60 @@ SynthDef("recBuf",{
// ~rndpos = LFNoise2.kr(0.1).range(0, 1);
SynthDef(\buf_grain, { | out, gate = 1, amp = 0.5,
sndbuf, envbuf, pan=0, imp=50,
pitchmodeindex=0, sensorpitch=1, sensorgdur=0.1, sensorgpan=0,
positionmodeindex=1, gdurmodeindex=0, gpanmodeindex=0,
positionmodeindex=0, gdurmodeindex=0, gpanmodeindex=0,
sensorposition=0, impulsemodeindex=0, sensorimpulse=0,
signalChannelIndex=1,
rlow= -1, rhigh=10 |
var signal, env, freqdev, pos,
pitchmode0, pitchmode1, pitch,
pitchmode0, pitchmode1, pitchmode2, pitch,
gdurmode0, gdurmode1, gdurmode2, gdurmode3, gdurmode4, gdurmode5, gdurmode6, gdur,
gpanmode0, gpanmode1, gpan,
positionmode0, positionmode1, positionmode2, position,
gpanmode0, gpanmode1, gpanmode2, gpan,
positionmode0, positionmode1, positionmode2, positionmode3, position,
impulsemode0, impulsemode1, impulse,
stereosignal, quadsignalL, quadsignalR, quadsignal, signalchannels;
// grain duration mode -untransposed, random, or sensor controlled
gdurmode0 = 0.05;
gdurmode1 = 0.1;
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(1, 2);
gdurmode6 = LFNoise1.kr.range(0.01, 4);
gdur = Select.kr(gdurmodeindex,
[gdurmode0, gdurmode1, gdurmode2, gdurmode3, gdurmode4, gdurmode5, gdurmode6, sensorgdur]);
// grain pan mode -untransposed, random, or sensor controlled
gpanmode0 = 0;
gpanmode1 = LFNoise1.kr(100).range(-1, 1);
// grain pan mode STEREO, QUAD, ROTATING
gpanmode0 = LFNoise1.kr(100).range(-0.2, 0.2);
gpanmode1 = LFSaw.kr(0.33).bipolar.range(-1,1);
gpanmode2 = LFNoise1.kr(100).range(-1, 1);
gpan = Select.kr(gpanmodeindex,
[gpanmode0, gpanmode1, sensorgpan]);
[gpanmode0, gpanmode1, gpanmode2, sensorgpan]);
// grain pitch mode -untransposed, random, or sensor controlled
~dseq = Dseq([1,-1, 2, 1, -1.5, 1, 1.75, 1, -0.5, 1, 3, 1, 2.25, 1 -0.125, 1], inf);
pitchmode0 = 1;
pitchmode1 = LFNoise1.kr.range(rlow, rhigh);
pitchmode1 = Demand.kr(Impulse.kr(imp), 0, ~dseq);
pitchmode2 = LFNoise1.kr(imp).range(rlow, rhigh);
pitch = Select.kr(pitchmodeindex,
[pitchmode0, sensorpitch, pitchmode1 ]);
[pitchmode0, sensorpitch, pitchmode1, pitchmode2 ]);
// granular playhead mode - fixed random or sensor controlled
positionmode0 = 0.1;
positionmode0 = (Phasor.ar(0, 1 * BufRateScale.ir(b), 0, BufSamples.ir(b)-1) + LFNoise1.ar(100).bipolar(0.1 * SampleRate.ir) ) / BufSamples.ir(b);
positionmode1 = LFNoise1.kr.range(0.05, 0.98);
positionmode2 = LFNoise1.kr.range(0.1, 0.2);
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);
positionmode2 = LFNoise1.kr.range(0.05, (BufSamples.ir(b)-1) - 1000 );
positionmode3 = LFNoise1.kr.range(0.1, 3.8 );
position = Select.kr(positionmodeindex,
[positionmode0, positionmode1, positionmode2, sensorposition]);
[positionmode0, positionmode1, positionmode2, positionmode3, sensorposition]);
// grain impulse frequency mode - random, metric or sensor based impulse modes
impulsemode0 = Impulse.kr(imp);
@ -152,206 +172,102 @@ SynthDef(\buf_grain, { | out, gate = 1, amp = 0.5,
impulse = Select.kr(impulsemodeindex,
[impulsemode0, impulsemode1, sensorimpulse]);
env = EnvGen.kr(~gpanmode=1;
Env([0, 1, 0], [1, 1], \sin, 1), gate, levelScale: amp, doneAction: 2);
env = EnvGen.kr( Env([0, 1, 0], [1, 1], \sin, 1), gate, levelScale: amp, doneAction: 2);
//signal = GrainBuf.ar(2,
//impulse, // selectable between impulse.kr and dust.kr
//gdur, sndbuf, pitch, position, 2, gpan, envbuf);
//signal = FreeVerb2.ar(signal[0], signal[1], mix:0.4, room:0.5, damp:0);
signal = TGrains.ar(4, impulse, b, pitch, position, gdur, gpan, amp, 4) * env;
signal = TGrains.ar(4, impulse, b, pitch, position, gdur, gpan, amp, 4);
stereosignal = signal* env;
stereosignal = signal;
quadsignalL = PanAz.ar(4, signal[0], MouseX.kr(0,2));
quadsignalR = PanAz.ar(4, signal[1], MouseX.kr(0,2).range(2,0));
quadsignal = signal; //Mix.ar([quadsignalL, quadsignalR]);
signalchannels = Select.ar(signalChannelIndex, [stereosignal, quadsignal]);
//signal = signalchannels;
Out.ar(0, signalchannels);
}).add;
);
SynthDef(\buf_tgrain, { | out, gate = 1, amp = 0.5,
sndbuf, envbuf, pan=0, imp=50,
pitchmodeindex=0, sensorpitch=1, sensorgdur=0.1, sensorgpan=0,
positionmodeindex=1, gdurmodeindex=0, gpanmodeindex=0,
sensorposition=0, impulsemodeindex=0, sensorimpulse=0,
signalChannelIndex=1,
rlow= -1, rhigh=10 |
var signal, env, freqdev, pos,
pitchmode0, pitchmode1, pitch,
gdurmode0, gdurmode1, gdurmode2, gdurmode3, gdurmode4, gdurmode5, gdurmode6, gdur,
gpanmode0, gpanmode1, gpan,
positionmode0, positionmode1, positionmode2, position,
impulsemode0, impulsemode1, impulse,
stereosignal, quadsignalL, quadsignalR, quadsignal, signalchannels;
// grain duration mode -untransposed, random, or sensor controlled
gdurmode0 = 0.05;
gdurmode1 = 0.1;
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(1, 2);
gdur = Select.kr(gdurmodeindex,
[gdurmode0, gdurmode1, gdurmode2, gdurmode3, gdurmode4, gdurmode5, gdurmode6, sensorgdur]);
// grain pan mode -untransposed, random, or sensor controlled
gpanmode0 = 0;
gpanmode1 = LFNoise1.kr(100).range(-1, 1);
gpan = Select.kr(gpanmodeindex,
[gpanmode0, gpanmode1, sensorgpan]);
// grain pitch mode -untransposed, random, or sensor controlled
pitchmode0 = 1;
pitchmode1 = LFNoise1.kr.range(rlow, rhigh);
pitch = Select.kr(pitchmodeindex,
[pitchmode0, sensorpitch, pitchmode1 ]);
// granular playhead mode - fixed random or sensor controlled
positionmode0 = 0.1;
positionmode0 = (Phasor.ar(0, 1 * BufRateScale.ir(b), 0, BufSamples.ir(b)-1) + LFNoise1.ar(100).bipolar(0.1 * SampleRate.ir) ) / BufSamples.ir(b);
positionmode1 = LFNoise1.kr.range(0.05, 0.98);
positionmode2 = LFNoise1.kr.range(0.1, 0.2);
position = Select.kr(positionmodeindex,
[positionmode0, positionmode1, positionmode2, sensorposition]);
// grain impulse frequency mode - random, metric or sensor based impulse modes
impulsemode0 = Impulse.kr(imp);
impulsemode1 = Dust.kr(imp);
impulse = Select.kr(impulsemodeindex,
[impulsemode0, impulsemode1, sensorimpulse]);
env = EnvGen.kr(~gpanmode=1;
Env([0, 1, 0], [1, 1], \sin, 1), gate, levelScale: amp, doneAction: 2);
signal = GrainBuf.ar(2, impulse, // selectable between impulse.kr and dust.kr
gdur, sndbuf, pitch, position, 2, gpan, envbuf);
signal = TGrains.ar(4, impulse, b, pitch, position, gdur, gpan, amp, 4);
//signal = FreeVerb2.ar(signal[0], signal[1], mix:0.4, room:0.5, damp:0);
stereosignal = signal* env;
quadsignalL = PanAz.ar(4, signal[0], MouseX.kr(0,2));
quadsignalR = PanAz.ar(4, signal[1], MouseX.kr(0,2).range(2,0));
quadsignal = signal; //Mix.ar([quadsignalL, quadsignalR]);
signalchannels = Select.ar(signalChannelIndex, [stereosignal, quadsignal]);
//signal = signalchannels;
Out.ar(0, signalchannels);
}).add;
);
)
// RUNME 3 ==========================================
// ----------------------------------------------------
(( // START SYNTHS ---------------------------------
// ----------------------------------------------------
// TODO NO EPRAND IN INSTR!
r = Synth(\recBuf, [\in, 0, \out, 0, \bufnum, b, \t_trig, 0]); // recorder
~granulator1 = Synth(\buf_grain, [\sndbuf, b, \envbuf, -1]); // granulate
~g1 = Synth(\buf_grain, [\sndbuf, b, \amp, exprand(0.4, 0.9), \envbuf, -1, \gate, 1, doneAction: 2]); // granulate
~gtrIn = Synth(\dryIn); // dry audio signaL
));
~gtrIn.free;
// RUNME 4 ==========================================
// ----------------------------------------------------
(( // OSC Receivers // ENABLE SENSOR AND SWITCH VALUES <--
// ----------------------------------------------------
~pitchmode = 0; ~positionmode = 0; ~impulsemode = 0; ~gdurmode=0; ~gpanmode=1; ~channelmode=0;
~pitchmode = 0; ~positionmode = 0; ~impulsemode = 1;
~gdurmode=0; ~gpanmode=0; ~channelmode=0;
~instrPanMode =0;
~btnstate = [];
~btnsA = [];
~btnsB = [];
~btnsC = [];
~btn0val = 0; ~btn1val = 0; ~btn2val = 0; ~btn3val = 0;
~btn4val = 0; ~btn5val = 0; ~btn6val = 0; ~btn7val = 0;
~btn8val = 0; // shift buttons
( // 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;
// PAN ------- X Roll
~g1.set(\pan, msg[1].linlin(-0.3, 0.3, -1, 1));
~g1.set(\gpanmodeindex, ~gpanmode );
( // accel gyro quaternion mapping ///////////////////
// msg[1] msg[2] msg[3] X Y Z ==> ROLL, PITCH, YAW
// PITCH ------- Y Pitch
~g1.set(\sensorpitch, ( msg[3] * 5 ) + 1 );
~g1.set(\pitchmodeindex, ~pitchmode );
o = OSCdef(\test, { arg msg, time, addr, recvPort, rlow, rhigh;
// POSITION ------- Z Yaw
~g1.set(\sensorposition, msg[2].linlin(-1, 1, 0.05, 3.99));
~g1.set(\positionmodeindex, ~positionmode );
// PAN ------- X Roll
~granulator1.set(\pan, msg[1].linlin(-0.3, 0.3, -1, 1));
~granulator1.set(\panmodeindex, ~panmode );
// RATE ------- X (roll [with PAN])
// PITCH ------- Y Pitch
~granulator1.set(\sensorpitch, msg[3].linlin(-1, 1, 0, 4));
~granulator1.set(\pitchmodeindex, ~pitchmode );
~g1.set(\sensorimpulse, msg[2].linlin(-1, 1, 5, 50));
~g1.set(\impulsemodeindex, ~impulsemode );
// POSITION ------- Z Yaw
~granulator1.set(\sensorposition, msg[2].linlin(-1, 1, 0.05, 3.99));
~granulator1.set(\positionmodeindex, ~positionmode );
~g1.set(\sensorgdur, msg[2].linlin(-1, 1, 0.1, 1));
~g1.set(\gdurmodeindex, ~gdurmode );
// RATE ------- X (roll [with PAN])
~granulator1.set(\sensorimpulse, msg[2].linlin(-1, 1, 5, 50));
~granulator1.set(\impulsemodeindex, ~impulsemode );
~granulator1.set(\sensorgdur, msg[2].linlin(-1, 1, 0.1, 1));
~granulator1.set(\gdurmodeindex, ~gdurmode );
~granulator1.set(\sensorgpan, msg[2].linlin(-1, 1, -1, 1));
~granulator1.set(\gpanmodeindex, ~gpanmode );
~granulator1.set(\sensorgpan, msg[2].linlin(-1, 1, -1, 1));
~granulator1.set(\signalChannelIndex, ~channelmode );
~g1.set(\sensorgpan, msg[2]);
~g1.set(\gpanmodeindex, ~gpanmode );
~g1.set(\sensorgpan, msg[2].linlin(-1, 1, -1, 1));
~g1.set(\signalChannelIndex, ~channelmode );
~gtrIn.set(\instrPan, msg[2].linlin(-1, 1, -1, 1));
~gtrIn.set(\instrPanModeIndex, ~instrPanMode);
//msg.postln;
}; , '/euler');
}; , '/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 ///////////////////////////////
// ----------------------------------------------------
// send message back to nodejs
m = NetAddr("127.0.0.1", 57100);
m.sendMsg("/xyzc", 1);
m.sendMsg("/xyzc", 0);
p = OSCdef(\keys, { arg msg, time, addr, recvPort;
~btnsA[~btn2val, ~btn3val];
@ -362,8 +278,6 @@ p = OSCdef(\keys, { arg msg, time, addr, recvPort;
if (msg[9] == 1 && msg[10] == 1, {~btnstate.postln;});
//msg.println;
// ==============================
// BUTTON MAPPING
@ -376,7 +290,7 @@ 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 }, {});
// BUTTON X ----> LOOP RECORDING MODE ON/OFF
if (msg[11]==1,
@ -392,76 +306,80 @@ p = OSCdef(\keys, { arg msg, time, addr, recvPort;
// BUTTON X ----> OVERDUB RECORDING MODE ON/OFF
if (msg[12]==1,
{
( ~btn2val = (~btn2val + 1) % 2 ) ;
( ~btn2val = (~btn2val + 1) % 5 ) ;
switch( ~btn2val,
0, { r.set(\overdub, 0); "SAMPLE OVERDUB OFF".postln; },
1, { r.set(\overdub, 1); "SAMPLE OVERDUB ON".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; },
)
});
}, /// SHIFT 0 LOGIC ENDS HERE
//TODO btn7 repeated counter fix
/////////////////// RESET RANDOM PITCH TO FIXED PITCH IN ONE TAP
if (msg[14]==1,
{
( ~btn6val = (~btn6val + 1) % 2 ) ;
switch( ~btn6val,
0, { ~pitchmode = 0; "PITCH RESET TO UNTRANSPOSED MODE".postln; },
1, { ~pitchmode = 1; "PITCH IN SENSOR MODE".postln; }
);
});
if (msg[15]==1,
{
( ~btn7val = (~btn7val + 1) % 8 ) ;
switch(~btn7val,
0, { ~g1.set(\imp, 0); "IMPULSE = 0".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; },
)
});
// BUTTON X ----- G PANNING MODE
if (msg[16]==1,
{
( ~btn8val = (~btn8val + 1) % 3 ) ;
switch( ~btn8val,
0, { ~gpanmode = 0 ;"PAN STEREO".postln; },
1, { ~gpanmode = 1 ; "PAN QUAD ROTATIONS".postln; },
2, { ~gpanmode = 2 ; "PAN RANDOM QUAD".postln; },
)
});
}, /// SHIFT 0 LOGIC ENDS HERE --------------------------------------------
{
// SHIFT IN STATE 1 ======================= ..........................
// SHIFT IN STATE 1 =======================
// BUTTON X ----- GRAIN DURATION MODE
if (msg[15]==1,
// GTR INPUT =======================
if (msg[11]==1,
{
( ~btn8val = (~btn8val + 1) % 7 ) ;
switch(~btn8val,
0, { ~gdurmode = 0; ~granulator1.set(\imp, 40); "DURATION MODE 0".postln; },
1, { ~gdurmode = 1; ~granulator1.set(\imp, 0); "DURATION MODE 1".postln; },
2, { ~gdurmode = 2; ~granulator1.set(\imp, 20); "DURATION MODE 2".postln; },
3, { ~gdurmode = 3; ~granulator1.set(\imp, 15); "DURATION MODE 3".postln; },
4, { ~gdurmode = 4; ~granulator1.set(\imp, 10); "DURATION MODE 4".postln; },
5, { ~gdurmode = 5; ~granulator1.set(\imp, 5); "DURATION MODE 5".postln; },
6, { ~gdurmode = 6; ~granulator1.set(\imp, 3); "DURATION MODE 6".postln; },
)
});
// BUTTON X ----- GRANULAR POSITION MODE
if (msg[13]==1,
{
( ~btn3val = (~btn3val + 1) % 3 ) ;
switch(~btn3val,
0, { ~positionmode = 0; "POSITION MODE FIXED".postln; },
1, { ~positionmode = 1; "POSITION MODE RANDOM".postln; },
2, { ~positionmode = 2; "POSITION MODE SENSOR".postln; },
)
});
// BUTTON X ----- GRANULAR PITCH MODE
if (msg[14]==1,
{
( ~btn6val = (~btn6val + 1) % 7 ) ;
switch(~btn6val,
0, { ~pitchmode = 0; "PITCH MODE FIXED".postln; },
1, { ~pitchmode = 1; "PITCH MODE SENSOR".postln; },
2, { ~pitchmode = 2; ~granulator1.set(\rlow, 0.8); ~granulator1.set(\rhigh, 1.2); "PITCH RANDOM 1".postln; },
3, { ~pitchmode = 2; ~granulator1.set(\rlow, 0); ~granulator1.set(\rhigh, 1.5); "PITCH MODE RANDOM 2".postln; },
4, { ~pitchmode = 2; ~granulator1.set(\rlow, -1.5 ); ~granulator1.set(\rhigh, 0); "PITCH MODE RANDOM 3".postln; },
5, { ~pitchmode = 2; ~granulator1.set(\rlow, -5 ); ~granulator1.set(\rhigh, 5); "PITCH MODE RANDOM 4".postln; },
6, { ~pitchmode = 2; ~granulator1.set(\rlow, -30 ); ~granulator1.set(\rhigh, 30); "PITCH MODE RANDOM 5".postln; },
7, { ~pitchmode = 2; ~granulator1.set(\rlow, -100 ); ~granulator1.set(\rhigh, 100); "PITCH MODE RANDOM 6".postln; },
~granulator1.set(\rhigh, 2);
2, { },
)
});
// BUTTON X ----- GRANULAR IMPULSE MODE
if (msg[16]==1,
{
( ~btn7val = (~btn7val + 1) % 3 ) ;
switch( ~btn7val,
0, { ~granulator1.set(\impulsemodeindex, 0 ); "IMPULSE MODE FIXED".postln; },
1, { ~granulator1.set(\impulsemodeindex, 1 ); "IMPULSE MODE DUST".postln; },
2, { ~granulator1.set(\impulsemodeindex, 2 ); "IMPULSE MODE SENSOR".postln; },
( ~btn2val = (~btn2val + 1) % 7 ) ;
switch(~btn2val,
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; },
)
});
@ -470,28 +388,69 @@ p = OSCdef(\keys, { arg msg, time, addr, recvPort;
if (msg[12] == 1, { " ===== EULER ZEROED! =====".postln }, {});
// GTR INPUT =======================
if (msg[11]==1,
// BUTTON X ----- GRANULAR POSITION MODE
if (msg[13]==1,
{
( ~btn2val = (~btn2val + 1) % 3 ) ;
switch(~btn2val,
0, { ~gtrIn.set(\in, 1 ); "DRY SIGNAL OFF".postln; },
1, { ~gtrIn.set(\in, 0 ); "DRY SIGNAL ON".postln; },
2, { ~gtrIn.set(\in, 1 ); "DRY + REVERB ON".postln; },
( ~btn3val = (~btn3val + 1) % 5 ) ;
switch(~btn3val,
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; },
)
});
} // SHIFT ONE LOGIC ENDS HERE ================
); /// closes SHIFT 1
// BUTTON X ----- GRANULAR PITCH MODE
if (msg[14]==1,
{
( ~btn6val = (~btn6val + 1) % 7 ) ;
switch(~btn6val,
0, { ~pitchmode = 2; "mode 2".postln; },
1, { ~pitchmode = 2; "mode 2 reserve".postln; },
2, { ~pitchmode = 3; ~g1.set(\rlow, 0.8); ~g1.set(\rhigh, 1.2); "PITCH RANDOM 1".postln; },
3, { ~pitchmode = 3; ~g1.set(\rlow, 0.01); ~g1.set(\rhigh, 1.5); "PITCH MODE RANDOM 2".postln; },
4, { ~pitchmode = 3; ~g1.set(\rlow, -1.5 ); ~g1.set(\rhigh, 1.5); "PITCH MODE RANDOM 3".postln; },
5, { ~pitchmode = 3; ~g1.set(\rlow, -5 ); ~g1.set(\rhigh, 5); "PITCH MODE RANDOM 4".postln; },
6, { ~pitchmode = 3; ~g1.set(\rlow, -10 ); ~g1.set(\rhigh, 10); "PITCH MODE RANDOM 5".postln; },
7, { ~pitchmode = 3; ~g1.set(\rlow, -30 ); ~g1.set(\rhigh, 30); "PITCH MODE RANDOM 6".postln; },
)
});
// BUTTON X ----- GRAIN DURATION MODE
if (msg[15]==1,
{
( ~btn8val = (~btn8val + 1) % 7 ) ;
switch(~btn8val,
0, { ~gdurmode = 0; ~g1.set(\imp, 40); "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; },
)
});
// BUTTON X ----- GRANULAR IMPULSE MODE
if (msg[16]==1,
{
( ~btn7val = (~btn7val + 1) % 3 ) ;
switch( ~btn7val,
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; },
)
});
}); // SHIFT ONE LOGIC ENDS HERE ================
} , '/keys');
));
);
);
// ----------------------------------------------------
// ----------------------------------------------------
// PERFORMABLE PARAMETERS /////////////////////////////
// ----------------------------------------------------
// ----------------------------------------------------
// start recording (without button)
r.set(\in, 0, \l, 0, \t_trig, 1);
@ -504,10 +463,15 @@ r.set(\overdub, 1); // overdub mode on - MAPPED TO SWITCH 4
r.set(\overdub, 0); // off
/// random pitch/rate low and high values
~granulator1.set(\rlow, -1);
~granulator1.set(\rlow, 0.2);
~granulator1.set(\rhigh, 2);
~granulator1.set(\rhigh, 1.2);
~g1.set(\rlow, 1);
~g1.set(\rlow, 0.2);
~g1.set(\rhigh, 2);
~g1.set(\rhigh, 1);
1.midiratio;
33.midiratio;
~impulsemode = 0; // impulse
~impulsemode = 1; // dust
@ -536,17 +500,19 @@ r.set(\overdub, 0); // off
~gpanmode = 0 ; // random position
~gpanmode = 1 ; // random position
~gpanmode = 2 ; // random position
~gpanmode = 3 ; // random position
~g1.set(\gpan, -1 );
~channelmode = 1;
// set grain impulse rate
~granulator1.set(\imp, 10);
~g1.set(\imp, 10);
// fix doneaction
~granulator1.set(\gate, 1); // granulator on
~granulator1.set(\gate, 0); // granulator off
~g1.set(\gate, 1); // granulator on
~g1.set(\gate, 0); // granulator off
a = Scale.major;
@ -557,18 +523,14 @@ a = Scale.major;
// -----------------------------------------------
// -----------------------------------------------
// DUMP ALL OSC MESSAGES (for debugging) ////////
OSCFunc.trace(true);
OSCFunc.trace(false);
thisProcess.openPorts; // list all open ports
// list all open ports
// -----------------------------------------------
// CODE DUMP ZONE ///////////////////////////////
// switch to the custom env
//~granulator1.set(\envbuf, z);
//~granulator1.set(\envbuf, -1);
//~g1.set(\envbuf, z);
//~g1.set(\envbuf, -1);
//n = NetAddr("127.0.0.1", NetAddr.langPort);
//n = NetAddr.new("224.0.1.9", 6696);

View File

@ -1,2 +1,3 @@
# /usr/bin/jackd -u -dalsa -dhw:USB -r44100 -p512 -n3 -S
/usr/bin/jackd -u -dalsa -r44100 -p128 -n3 -D -Chw:U192k -Phw:U192k
/usr/bin/jackd -u -dalsa -r44100 -p256 -n3 -D -Chw:U192k -Phw:U192k

View File

@ -42,7 +42,6 @@ let switchHeld = [false, false, false, false]
let switchValue = [false, false, false, false]
function openSerial() {
console.log('opening ', tty, baudrate)