fixed spatialisation and tuned pitch transpositions Dseq

master
Rob Canning 2022-09-13 13:00:57 +02:00
parent 199c07c246
commit 69fc075715
1 changed files with 37 additions and 34 deletions

61
gtr.scd
View File

@ -1,4 +1,5 @@
( (
s.reboot{ s.reboot{
s.options.numBuffers = 1024 * 256; // increase this if you need to load more samples s.options.numBuffers = 1024 * 256; // increase this if you need to load more samples
@ -36,6 +37,7 @@ thisProcess.openUDPPort(57121);
// RUNME 2 ========================================== // RUNME 2 ==========================================
// ------------------------------------------------- // -------------------------------------------------
( // DEFINE SYNTHS --------------------------------- <-- ( // DEFINE SYNTHS --------------------------------- <--
// ------------------------------------------------- // -------------------------------------------------
( // direct signal + reverb ------------------------- ( // direct signal + reverb -------------------------
@ -49,7 +51,6 @@ SynthDef("dryIn", { arg in=0, instrPanModeIndex=0, out=0, sensorInstrPan=0;
instrPanMode4 = LFSaw.kr(0.33).bipolar.range(-1,1); instrPanMode4 = LFSaw.kr(0.33).bipolar.range(-1,1);
instrPanMode5 = LFNoise1.kr(10).range(-1, 1); instrPanMode5 = LFNoise1.kr(10).range(-1, 1);
instrPan = Select.kr(instrPanModeIndex, instrPan = Select.kr(instrPanModeIndex,
[instrPanMode0, instrPanMode1, instrPanMode2, instrPanMode3, instrPanMode4, instrPanMode5, sensorInstrPan]); [instrPanMode0, instrPanMode1, instrPanMode2, instrPanMode3, instrPanMode4, instrPanMode5, sensorInstrPan]);
@ -91,19 +92,20 @@ SynthDef("recBuf",{
// ~rndpos = LFNoise2.kr(0.1).range(0, 1); // ~rndpos = LFNoise2.kr(0.1).range(0, 1);
SynthDef(\buf_grain, { | out, gate = 1, amp = 0.5, SynthDef(\buf_grain, { | out, gate = 1, amp = 0.5,
sndbuf, envbuf, pan=0, imp=30, sndbuf, envbuf, pan=0, imp=50,
pitchmodeindex=0, sensorpitch=1, sensorgdur=0.1, sensorgpan=0, pitchmodeindex=0, sensorpitch=1, sensorgdur=0.1, sensorgpan=0,
positionmodeindex=0, gdurmodeindex=0, gpanmodeindex=0, positionmodeindex=0, gdurmodeindex=0, gpanmodeindex=0,
sensorposition=0, impulsemodeindex=0, sensorimpulse=0, sensorposition=0, impulsemodeindex=0, sensorimpulse=0,
signalChannelIndex=0, dseqarrayIndex=1, signalChannelIndex=1, dseqarrayIndex=1,
rlow= -1, rhigh=10 | rlow= -1, rhigh=10 |
var signal, env, freqdev, pos, var signal, env, freqdev, pos,
pitchmode0, pitchmode1, pitchmode2,pitchmode3,pitchmode4,pitchmode5, pitchmode6, pitch, pitchmode0, pitchmode1, pitchmode2,pitchmode3,pitchmode4,pitchmode5, pitchmode6, pitch,
gdurmode0, gdurmode1, gdurmode2, gdurmode3, gdurmode4, gdurmode5, gdurmode6, gdur, gdurmode0, gdurmode1, gdurmode2, gdurmode3, gdurmode4, gdurmode5, gdurmode6, gdur,
gpanmode0, gpanmode1, gpanmode2, gpan, gpanmode0, gpanmode1, gpanmode2, gpan,
positionmode0, positionmode1, positionmode2, positionmode3, position, positionmode0, positionmode1, positionmode2, positionmode3, position,
impulsemode0, impulsemode1, impulse, dseq, 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 // grain duration mode -untransposed, random, or sensor controlled
gdurmode0 = 0.2; gdurmode0 = 0.2;
@ -126,29 +128,33 @@ SynthDef(\buf_grain, { | out, gate = 1, amp = 0.5,
// grain pitch mode -untransposed, random, or sensor controlled // grain pitch mode -untransposed, random, or sensor controlled
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_array2 = Dseq([1,-1, -0.5, 1, 1.33, 1], inf);
dseq_array3 = Drand([(1..5).mirror.midiratio], 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_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);
//
//
dseq = [dseq_array1, dseq_array2,dseq_array3, dseq_array4, dseq_array5]; // xdseq = [dseq_array1, dseq_array2,dseq_array3, dseq_array4, dseq_array5];
dseqarrayIndex =1; dseqarrayIndex =1;
pitchmode0 = 1; pitchmode0 = 1;
pitchmode1 = Demand.kr(Impulse.kr(imp), 0, dseq[0]); 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));
pitchmode2 = Demand.kr(Impulse.kr(imp), 0, dseq[1]); 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[2]); pitchmode3 = Demand.kr(Impulse.kr(imp), 0, Dseq([1,-1, -0.5, 1, 1.33, 1], inf));
pitchmode4 = Demand.kr(Impulse.kr(imp), 0, dseq[3]); pitchmode4 = Demand.kr(Impulse.kr(imp), 0, Drand([0.5, 0.25,1,2], inf));
pitchmode5 = Demand.kr(Impulse.kr(imp), 0, dseq[4]); pitchmode5 = Demand.kr(Impulse.kr(imp), 0, Drand(Scale.diminished.degrees.midiratio, inf));
pitchmode6 = LFNoise1.kr(imp).range(rlow, rhigh); pitchmode6 = LFNoise1.kr(imp).range(rlow, rhigh);
pitch = Select.kr(pitchmodeindex, pitch = Select.kr(pitchmodeindex,
[pitchmode0, sensorpitch, pitchmode1, pitchmode2 ,pitchmode3, pitchmode4, pitchmode5, pitchmode6]); [pitchmode0, sensorpitch, pitchmode1, pitchmode2 ,pitchmode3, pitchmode4, pitchmode5, pitchmode6]);
// granular playhead mode - fixed random or sensor controlled // granular playhead mode - fixed random or sensor controlled
positionmode0 = 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); positionmode1 = (Phasor.ar(0.01, 1 * BufRateScale.ir(b), 0, BufSamples.ir(b)) + LFNoise1.ar(100).bipolar(0.1 * SampleRate.ir) ) / BufSamples.ir(b);
@ -161,7 +167,6 @@ SynthDef(\buf_grain, { | out, gate = 1, amp = 0.5,
// grain impulse frequency mode - random, metric or sensor based impulse modes // grain impulse frequency mode - random, metric or sensor based impulse modes
impulsemode0 = Impulse.kr(imp); impulsemode0 = Impulse.kr(imp);
impulsemode1 = Dust.kr(imp); impulsemode1 = Dust.kr(imp);
impulse = Select.kr(impulsemodeindex, impulse = Select.kr(impulsemodeindex,
[impulsemode0, impulsemode1, sensorimpulse]); [impulsemode0, impulsemode1, sensorimpulse]);
@ -169,16 +174,6 @@ SynthDef(\buf_grain, { | out, gate = 1, amp = 0.5,
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) * 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, signal); Out.ar(0, signal);
}).add; }).add;
@ -194,7 +189,7 @@ SynthDef(\buf_grain, { | out, gate = 1, amp = 0.5,
// TODO NO EPRAND IN INSTR! // TODO NO EPRAND IN INSTR!
r = Synth(\recBuf, [\in, 0, \out, 0, \bufnum, b, \t_trig, 0]); // recorder r = Synth(\recBuf, [\in, 0, \out, 0, \bufnum, b, \t_trig, 0]); // recorder
~g1 = Synth(\buf_grain, [\sndbuf, b, \amp, 0.6, \envbuf, -1, \gate, 1, doneAction: 2]); // granulate ~g1 = Synth(\buf_grain, [\sndbuf, b, \amp, 0.5, \envbuf, -1, \gate, 1, doneAction: 2]); // granulate
~gtrIn = Synth(\dryIn); // dry audio signaL ~gtrIn = Synth(\dryIn); // dry audio signaL
)); ));
@ -203,10 +198,11 @@ SynthDef(\buf_grain, { | out, gate = 1, amp = 0.5,
// ---------------------------------------------------- // ----------------------------------------------------
(( // OSC Receivers // ENABLE SENSOR AND SWITCH VALUES <-- (( // OSC Receivers // ENABLE SENSOR AND SWITCH VALUES <--
// ---------------------------------------------------- // ----------------------------------------------------
~pitchmode = 0; ~positionmode = 0; ~impulsemode = 1; ~pitchmode = 0; ~positionmode = 0; ~impulsemode = 1;
~gdurmode=0; ~gpanmode=1; ~channelmode=0; ~gdurmode=0; ~gpanmode=0; ~channelmode=0;
~instrPanMode=0; ~instrPanMode=0;
~btnstate = []; ~btnstate = [];
@ -254,7 +250,7 @@ SynthDef(\buf_grain, { | out, gate = 1, amp = 0.5,
//~g1.set(\sensorgpan, msg[2].linlin(-1, 1, -1, 1)); //~g1.set(\sensorgpan, msg[2].linlin(-1, 1, -1, 1));
//~g1.set(\signalChannelIndex, ~channelmode ); //~g1.set(\signalChannelIndex, ~channelmode );
~gtrIn.set(\instrPan, msg[2].linlin(-1, 1, -1, 1)); ~gtrIn.set(\sensorInstrPan, msg[2].wrap(0, 5).linlin(0, 5, -1, 1));
~gtrIn.set(\instrPanModeIndex, ~instrPanMode); ~gtrIn.set(\instrPanModeIndex, ~instrPanMode);
//msg.postln; //msg.postln;
@ -373,7 +369,7 @@ p = OSCdef(\keys, { arg msg, time, addr, recvPort;
// GTR INPUT ======================= // GTR INPUT =======================
if (msg[11]==1, if (msg[11]==1,
{ {
( ~btn10val = (~btn10val + 1) % 7 ) ; ( ~btn10val = (~btn10val + 1) % 9 ) ;
switch(~btn10val, switch(~btn10val,
@ -384,6 +380,9 @@ p = OSCdef(\keys, { arg msg, time, addr, recvPort;
4, { ~gtrIn.set(\in, 0 ); ~instrPanMode=3; "DRY L/R PAN {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; }, 5, { ~gtrIn.set(\in, 0 ); ~instrPanMode=4; "DRY ROTATE {QUAD}".postln; },
6, { ~gtrIn.set(\in, 0 ); ~instrPanMode=5; "DRY RaND {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; },
) )
}); });
@ -426,7 +425,7 @@ p = OSCdef(\keys, { arg msg, time, addr, recvPort;
{ {
( ~btn14val = (~btn14val + 1) % 7 ) ; ( ~btn14val = (~btn14val + 1) % 7 ) ;
switch(~btn14val, switch(~btn14val,
0, { ~gdurmode = 0; ~g1.set(\imp, 40); "DURATION MODE 0".postln; }, 0, { ~gdurmode = 0; ~g1.set(\imp, 64); "DURATION MODE 0".postln; },
1, { ~gdurmode = 1; ~g1.set(\imp, 30); "DURATION MODE 1".postln; }, 1, { ~gdurmode = 1; ~g1.set(\imp, 30); "DURATION MODE 1".postln; },
2, { ~gdurmode = 2; ~g1.set(\imp, 20); "DURATION MODE 2".postln; }, 2, { ~gdurmode = 2; ~g1.set(\imp, 20); "DURATION MODE 2".postln; },
3, { ~gdurmode = 3; ~g1.set(\imp, 15); "DURATION MODE 3".postln; }, 3, { ~gdurmode = 3; ~g1.set(\imp, 15); "DURATION MODE 3".postln; },
@ -524,6 +523,9 @@ r.set(\overdub, 0); // off
~g1.set(\gate, 1); // granulator on ~g1.set(\gate, 1); // granulator on
~g1.set(\gate, 0); // granulator off ~g1.set(\gate, 0); // granulator off
~g1.set(\amp, 0.5); // granulator off
a = Scale.major; a = Scale.major;
@ -545,3 +547,4 @@ a = Scale.major;
//n = NetAddr.new("224.0.1.9", 6696); //n = NetAddr.new("224.0.1.9", 6696);