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\" \ # -H \"Authorization: Bearer $TOKEN\" \
# --output $data.zip # --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 # backup unfiltered / raw data
cp sensor_data.csv sensor_data_ORIG.csv cp sensor_data.csv sensor_data_ORIG.csv

View File

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