new phase pattern synth

master
Rob Canning 2023-10-20 01:54:56 +02:00
parent 3498265544
commit 45a8a85e1e
2 changed files with 95 additions and 52 deletions

View File

@ -35,7 +35,9 @@ do
# -H \"Authorization: Bearer $TOKEN\" \
# --output $data.zip
unzip $data.zip && mv all-data $data && rm $data.zip && cd $data
unzip $data.zip && mv all-data $data &&
#rm $data.zip &&
cd $data
# backup unfiltered / raw data
cp sensor_data.csv sensor_data_ORIG.csv

View File

@ -1,5 +1,7 @@
/*RUN*/
(
// initial settings .....................................
s.options.numInputBusChannels = 4;
s.options.numOutputBusChannels = 4;
@ -11,6 +13,7 @@ s.waitForBoot{
// create 8 control busses to pass data between synths
~ctrlBus = 8.collect({arg i; Bus.control(s,1); });
// initial settings .....................................
// define synths
SynthDef(\sgrain, { | out=0, atk=0.01, dcy=0.01, freq=100, pan=0, amp=1|
var sig, env;
@ -42,8 +45,11 @@ s.waitForBoot{
Out.ar(0, sig);
}).add;
// initial settings .....................................
// load and process the data source /////////////////////////////////
~csvFile=CSVFileReader.read(~dataPath ++ ~devices[0] ++ "/" ++ "sensor_data.csv",true,true);
// flatten ~data from 2D Array to regular array (per column);
~data = ( ~csvFile[0].size ).collect({ arg itt;
Array.fill( ~csvFile.size-1,{ arg i;
@ -77,9 +83,10 @@ s.waitForBoot{
~ce = Array.new(maxSize: 20);
// perform the data sonification /////////////////////
/* ( p = Pbind(\instrument, \sgrain,
// first synth test /////////////////////
/* ( p = Pbind(\instrument, \sgrain,
\freq, Pseq(~freq.round(30),1),
\atk, Pseq(~atk,1).poll,
\dcy, Pseq(~dcy,1),
@ -89,6 +96,10 @@ s.waitForBoot{
\date, Pseq(~date, 1 )
).collect{ arg i; i.postln; });*/
// initial settings .....................................
~gr = Group.new;
~pitchset = [20,40,60,80].midicps;
@ -99,7 +110,7 @@ s.waitForBoot{
// Pdefn (~ce[i],
Pbind( *[
\instrument, \sine,
\dur, Pseq(Array.geom(30, rrand(1,1.5), rrand(0.98,0.99)).mirror,1),
\dur, Pseq(Array.geom(30, rrand(1,1.5), rrand(0.98,0.99)).mirror,inf),
\freq, exprand(~pitchset[0],~pitchset[0]*100).round(~pitchset[0]),
\panfreq, rrand(0.1, 2.2),
\amp, 0.05,
@ -115,9 +126,7 @@ s.waitForBoot{
});
).play;
//Pdefn (\c, Pbind( \freq, exprand(~pitchset[0],~pitchset[0]*100).round(~pitchset[0])))
// initial settings .....................................
~dur = PatternProxy.new;
~deg = PatternProxy.new;
@ -135,6 +144,8 @@ s.waitForBoot{
~sca.source = Scale.harmonicMinor;
~rel.source = Pexprand(1.5,3.35, inf);
// initial settings .....................................
Pdef(\c, Pspawner({ | sp | 8.do { | i | sp.par(
Pbind( *[
\instrument, \sine,
@ -142,64 +153,94 @@ s.waitForBoot{
\scale, ~sca,
\degree, ~deg,
\octave, ~oct,
//\freq, exprand(~pitchset[0],~pitchset[0]*80).round(100),
//\freq, exprand(~pitchset[0],~pitchset[0]*80).round(100),
\panfreq, rrand(0.1, 2.2),
\amp, ~amp,
\panphase, rrand(-1.0,1.0),
\rel, ~rel,
//\rel, exprand(1.5,3.35),
\group, ~gr
]);
);
sp.wait(1);
};
});
).play;
); sp.wait(1); }}); ).play;
s.plotTreeView;
}; // closes s.waitForBoot
}; // closes s.waitForBoot .....................................
~dur.source = Pseq(Array.geom(30, rrand(1,1.5), rrand(0.98,0.99)).mirror,inf);
~dur.source = Pseq([1.5],inf);
// initial settings .....................................
//~voc.source = 1;
~oct.source = Prand([3,4],inf);
~deg.source = Prand([0,4,7,9,11],inf);
~dur.source = Pseq(Array.geom(30, rrand(1,1.5), rrand(0.96,0.97)).mirror,inf);
~oct.source = Prand([3,4,5],inf);
~deg.source = Prand([0,1,2,3,4,5],inf);
~sca.source = Scale.chromatic;
~rel.source = Pexprand(1.1,10.5, inf);
~amp.source = Pwhite(0.001, 0.00,inf);
~rel.source = Pexprand(1.1,4.5, inf);
~amp.source = Pwhite(0.001, 0.1,inf);
/////////////////////////////////////////////////////////
// temporal structure of wind controled layer ///////////
// .....................................
~temperature=~data[2];//.asFloat; //.normalize(0, 11);
(
r = Routine {
199.yield;
189.yield;
Routine { 100.do { |i| i.yield } }.idle(6);
199.yield;
189.yield;
};
fork {
loop {
r.value.postln;
1.wait;
}
}
r = Routine { arg inval;
var i = 0;
loop {
i = i + 1;
postln(~temperature[i]); postf("beats: % seconds: % time: % \n",
thisThread.beats, thisThread.seconds, Main.elapsedTime
);
~deg.source = Prand([0,1,2,3,5,8],inf); postln("line 1");
~oct.source = Prand([4,5],inf);
~dur.source = Pseq(Array.geom(30, rrand(2,4), rrand(0.96,0.97)).mirror,inf);
~rel.source = Pexprand(1.1,5.5, inf);
20.wait;
~deg.source = Prand([0,3,5,8],inf); postln("line 2");
~oct.source = Prand([3,4,5],inf);
~dur.source = Pseq(Array.geom(30, rrand(1,2.5), rrand(0.96,0.97)).mirror,inf);
20.wait;
~deg.source = Prand([6,7,8,9,10,11],inf);postln("line 3");
~oct.source = Prand([3,4,5,6],inf);
~rel.source = Pexprand(3,6, inf);
~dur.source = Pseq(Array.geom(30, rrand(1,1.5), rrand(0.96,0.97)).mirror,inf);
20.wait;
~deg.source = Prand([0,2,4,6,8,10],inf);postln("line 4");
~oct.source = Prand([2, 3,4,5],inf);
20.wait;
~deg.source = Prand([0,2,4,6,8,10],inf);postln("line 5");
~oct.source = Prand([3,4,5],inf);
~dur.source = Pseq(Array.geom(30, rrand(0.5,0.6), rrand(0.98,0.99)).mirror,inf);
~rel.source = Pexprand(0.5,6, inf);
20.wait;
~deg.source = Prand([0,7,5],inf);postln("line 6");
~oct.source = Prand([2,3],inf);
~dur.source = Pseq(Array.geom(30, rrand(0.5,1.6), rrand(0.98,0.99)).mirror,inf);
~rel.source = Pexprand(3,6, inf);
10.wait;
~deg.source = Prand([0,7,5],inf);postln("line 6");
~oct.source = Prand([2,3,4,5],inf);
~dur.source = Pseq(Array.geom(30, rrand(1,1.5), rrand(0.98,0.99)).mirror,inf);
~rel.source = Pexprand(6,10, inf);
20.wait;
};
}.play;
);
/*
c.set(\amp, 0.2);*/
//~gr.set(\amp, 0.001);
//~gr.set(\freq, exprand(~pitchset[0],~pitchset[0]*100).round(~pitchset[0]));
)
r.stop;