broken quadraphonic granular
parent
0c81b6db25
commit
199c07c246
168
gtr.scd
168
gtr.scd
|
@ -1,28 +1,4 @@
|
|||
|
||||
|
||||
////////////////////////////////////////////////////
|
||||
/* GRANULATING SAMPLER INSTRUMENT //////////////////
|
||||
////////////////////////////////////rc@kiben.net////
|
||||
////////////////////////////////////////////////////
|
||||
|
||||
| .-.
|
||||
| / \ .-.
|
||||
| / \ / \ .-. .-. _
|
||||
+--/-------\-----/-----\-----/---\---/---\---/-\-
|
||||
| / \ / \ / '-' '-'
|
||||
|/ '-' '-'
|
||||
|
||||
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{
|
||||
s.options.numBuffers = 1024 * 256; // increase this if you need to load more samples
|
||||
|
@ -36,12 +12,16 @@ s.reboot{
|
|||
} )
|
||||
|
||||
|
||||
|
||||
|
||||
// RUNME 0 =========================================
|
||||
s.boot();
|
||||
|
||||
// RUNME 1 =========================================
|
||||
// -------------------------------------------------
|
||||
|
||||
|
||||
|
||||
( // SETUP ----------------------------------------- -
|
||||
// ---------------------------------------------------
|
||||
// Allocate a 4 second mono buffer
|
||||
|
@ -111,20 +91,19 @@ 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,
|
||||
sndbuf, envbuf, pan=0, imp=30,
|
||||
pitchmodeindex=0, sensorpitch=1, sensorgdur=0.1, sensorgpan=0,
|
||||
positionmodeindex=0, gdurmodeindex=0, gpanmodeindex=0,
|
||||
sensorposition=0, impulsemodeindex=0, sensorimpulse=0,
|
||||
signalChannelIndex=1,
|
||||
signalChannelIndex=0, dseqarrayIndex=1,
|
||||
rlow= -1, rhigh=10 |
|
||||
|
||||
var signal, env, freqdev, pos,
|
||||
pitchmode0, pitchmode1, pitchmode2, pitch,
|
||||
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,
|
||||
stereosignal, quadsignalL, quadsignalR, quadsignal, signalchannels;
|
||||
impulsemode0, impulsemode1, impulse, dseq, 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;
|
||||
|
@ -147,14 +126,27 @@ SynthDef(\buf_grain, { | out, gate = 1, amp = 0.5,
|
|||
|
||||
// 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);
|
||||
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([1,-1, 2, 1, -1.5, 1, 1.33, 1, -0.5, 1, 3, 1, 2.37, 1, -0.33, 1], inf);
|
||||
dseq_array5 = Dseq([1,-1, -0.5, 1, 1.33, 1], inf);
|
||||
|
||||
|
||||
dseq = [dseq_array1, dseq_array2,dseq_array3, dseq_array4, dseq_array5];
|
||||
|
||||
dseqarrayIndex =1;
|
||||
|
||||
pitchmode0 = 1;
|
||||
pitchmode1 = Demand.kr(Impulse.kr(imp), 0, ~dseq);
|
||||
pitchmode2 = LFNoise1.kr(imp).range(rlow, rhigh);
|
||||
pitchmode1 = Demand.kr(Impulse.kr(imp), 0, dseq[0]);
|
||||
pitchmode2 = Demand.kr(Impulse.kr(imp), 0, dseq[1]);
|
||||
pitchmode3 = Demand.kr(Impulse.kr(imp), 0, dseq[2]);
|
||||
pitchmode4 = Demand.kr(Impulse.kr(imp), 0, dseq[3]);
|
||||
pitchmode5 = Demand.kr(Impulse.kr(imp), 0, dseq[4]);
|
||||
pitchmode6 = LFNoise1.kr(imp).range(rlow, rhigh);
|
||||
|
||||
pitch = Select.kr(pitchmodeindex,
|
||||
[pitchmode0, sensorpitch, pitchmode1, pitchmode2 ]);
|
||||
[pitchmode0, sensorpitch, pitchmode1, pitchmode2 ,pitchmode3, pitchmode4, pitchmode5, pitchmode6]);
|
||||
|
||||
|
||||
// granular playhead mode - fixed random or sensor controlled
|
||||
|
@ -169,6 +161,7 @@ SynthDef(\buf_grain, { | out, gate = 1, amp = 0.5,
|
|||
// 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]);
|
||||
|
||||
|
@ -176,20 +169,24 @@ SynthDef(\buf_grain, { | out, gate = 1, amp = 0.5,
|
|||
|
||||
signal = TGrains.ar(4, impulse, b, pitch, position, gdur, gpan, amp, 4) * env;
|
||||
|
||||
stereosignal = signal;
|
||||
////////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]);
|
||||
//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]);
|
||||
|
||||
signalchannels = Select.ar(signalChannelIndex, [stereosignal, quadsignal]);
|
||||
//signal = signalchannels;
|
||||
Out.ar(0, signalchannels);
|
||||
|
||||
Out.ar(0, signal);
|
||||
|
||||
}).add;
|
||||
);
|
||||
)
|
||||
|
||||
|
||||
|
||||
// RUNME 3 ==========================================
|
||||
// ----------------------------------------------------
|
||||
(( // START SYNTHS ---------------------------------
|
||||
|
@ -197,7 +194,7 @@ SynthDef(\buf_grain, { | out, gate = 1, amp = 0.5,
|
|||
// TODO NO EPRAND IN INSTR!
|
||||
|
||||
r = Synth(\recBuf, [\in, 0, \out, 0, \bufnum, b, \t_trig, 0]); // recorder
|
||||
~g1 = Synth(\buf_grain, [\sndbuf, b, \amp, exprand(0.4, 0.9), \envbuf, -1, \gate, 1, doneAction: 2]); // granulate
|
||||
~g1 = Synth(\buf_grain, [\sndbuf, b, \amp, 0.6, \envbuf, -1, \gate, 1, doneAction: 2]); // granulate
|
||||
~gtrIn = Synth(\dryIn); // dry audio signaL
|
||||
|
||||
));
|
||||
|
@ -205,10 +202,11 @@ SynthDef(\buf_grain, { | out, gate = 1, amp = 0.5,
|
|||
// RUNME 4 ==========================================
|
||||
// ----------------------------------------------------
|
||||
|
||||
|
||||
(( // OSC Receivers // ENABLE SENSOR AND SWITCH VALUES <--
|
||||
// ----------------------------------------------------
|
||||
~pitchmode = 0; ~positionmode = 0; ~impulsemode = 1;
|
||||
~gdurmode=0; ~gpanmode=0; ~channelmode=0;
|
||||
~gdurmode=0; ~gpanmode=1; ~channelmode=0;
|
||||
~instrPanMode =0;
|
||||
|
||||
~btnstate = [];
|
||||
|
@ -216,9 +214,15 @@ SynthDef(\buf_grain, { | out, gate = 1, amp = 0.5,
|
|||
~btnsB = [];
|
||||
~btnsC = [];
|
||||
|
||||
~btn0val = 0; ~btn1val = 0; ~btn2val = 0; ~btn3val = 0;
|
||||
~btn4val = 0; ~btn5val = 0; ~btn6val = 0; ~btn7val = 0;
|
||||
~btn8val = 0; // shift buttons
|
||||
~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
|
||||
|
@ -247,8 +251,8 @@ SynthDef(\buf_grain, { | out, gate = 1, amp = 0.5,
|
|||
~g1.set(\sensorgpan, msg[2]);
|
||||
~g1.set(\gpanmodeindex, ~gpanmode );
|
||||
|
||||
~g1.set(\sensorgpan, msg[2].linlin(-1, 1, -1, 1));
|
||||
~g1.set(\signalChannelIndex, ~channelmode );
|
||||
//~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);
|
||||
|
@ -295,8 +299,8 @@ p = OSCdef(\keys, { arg msg, time, addr, recvPort;
|
|||
// BUTTON X ----> LOOP RECORDING MODE ON/OFF
|
||||
if (msg[11]==1,
|
||||
{
|
||||
( ~btn4val = (~btn4val + 1) % 3 ) ;
|
||||
switch( ~btn4val,
|
||||
( ~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
|
||||
|
@ -306,8 +310,8 @@ p = OSCdef(\keys, { arg msg, time, addr, recvPort;
|
|||
// BUTTON X ----> OVERDUB RECORDING MODE ON/OFF
|
||||
if (msg[12]==1,
|
||||
{
|
||||
( ~btn2val = (~btn2val + 1) % 5 ) ;
|
||||
switch( ~btn2val,
|
||||
( ~btn3val = (~btn3val + 1) % 5 ) ;
|
||||
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; },
|
||||
|
@ -322,23 +326,22 @@ p = OSCdef(\keys, { arg msg, time, addr, recvPort;
|
|||
/////////////////// RESET RANDOM PITCH TO FIXED PITCH IN ONE TAP
|
||||
if (msg[14]==1,
|
||||
{
|
||||
( ~btn6val = (~btn6val + 1) % 2 ) ;
|
||||
( ~btn5val = (~btn5val + 1) % 2 ) ;
|
||||
|
||||
switch( ~btn6val,
|
||||
switch( ~btn5val,
|
||||
0, { ~pitchmode = 0; "PITCH RESET TO UNTRANSPOSED MODE".postln; },
|
||||
1, { ~pitchmode = 1; "PITCH IN SENSOR MODE".postln; }
|
||||
);
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
||||
// INCREASE IMPULSE RATE ---------------------------------------
|
||||
|
||||
if (msg[15]==1,
|
||||
{
|
||||
( ~btn7val = (~btn7val + 1) % 8 ) ;
|
||||
switch(~btn7val,
|
||||
0, { ~g1.set(\imp, 0); "IMPULSE = 0".postln; },
|
||||
( ~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; },
|
||||
|
@ -352,16 +355,15 @@ p = OSCdef(\keys, { arg msg, time, addr, recvPort;
|
|||
// BUTTON X ----- G PANNING MODE
|
||||
if (msg[16]==1,
|
||||
{
|
||||
( ~btn8val = (~btn8val + 1) % 3 ) ;
|
||||
switch( ~btn8val,
|
||||
0, { ~gpanmode = 0 ;"PAN STEREO".postln; },
|
||||
( ~btn7val = (~btn7val + 1) % 3 ) ;
|
||||
switch( ~btn7val,
|
||||
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 --------------------------------------------
|
||||
|
||||
{
|
||||
|
@ -371,8 +373,10 @@ p = OSCdef(\keys, { arg msg, time, addr, recvPort;
|
|||
// GTR INPUT =======================
|
||||
if (msg[11]==1,
|
||||
{
|
||||
( ~btn2val = (~btn2val + 1) % 7 ) ;
|
||||
switch(~btn2val,
|
||||
( ~btn10val = (~btn10val + 1) % 7 ) ;
|
||||
|
||||
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; },
|
||||
|
@ -391,8 +395,8 @@ p = OSCdef(\keys, { arg msg, time, addr, recvPort;
|
|||
// BUTTON X ----- GRANULAR POSITION MODE
|
||||
if (msg[13]==1,
|
||||
{
|
||||
( ~btn3val = (~btn3val + 1) % 5 ) ;
|
||||
switch(~btn3val,
|
||||
( ~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; },
|
||||
|
@ -404,24 +408,24 @@ p = OSCdef(\keys, { arg msg, time, addr, recvPort;
|
|||
// 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; },
|
||||
( ~btn13val = (~btn13val + 1) % 8 ) ;
|
||||
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; },
|
||||
)
|
||||
});
|
||||
|
||||
// BUTTON X ----- GRAIN DURATION MODE
|
||||
if (msg[15]==1,
|
||||
{
|
||||
( ~btn8val = (~btn8val + 1) % 7 ) ;
|
||||
switch(~btn8val,
|
||||
( ~btn14val = (~btn14val + 1) % 7 ) ;
|
||||
switch(~btn14val,
|
||||
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; },
|
||||
|
@ -435,8 +439,8 @@ p = OSCdef(\keys, { arg msg, time, addr, recvPort;
|
|||
// BUTTON X ----- GRANULAR IMPULSE MODE
|
||||
if (msg[16]==1,
|
||||
{
|
||||
( ~btn7val = (~btn7val + 1) % 3 ) ;
|
||||
switch( ~btn7val,
|
||||
( ~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; },
|
||||
|
@ -502,6 +506,12 @@ r.set(\overdub, 0); // off
|
|||
~gpanmode = 2 ; // random position
|
||||
~gpanmode = 3 ; // random position
|
||||
|
||||
|
||||
|
||||
~dseqarrayIndex=0;
|
||||
|
||||
~g1.set(\dseqarrayIndex, 0);
|
||||
|
||||
~g1.set(\gpan, -1 );
|
||||
|
||||
~channelmode = 1;
|
||||
|
|
Loading…
Reference in New Issue