ephemeral-garden/ephemera-loop.sc
2018-05-22 17:20:33 +00:00

70 lines
1.9 KiB
Python

///// // / / / / / / /
//
// basic soundfile looper
//
////// / /
"e p h e m e r a l g a r d e n".postln;
// sc server
s = Server.local;
//s.options.memSize = 1024 * 1024;
//s.options.maxNodes = 1024 * 1024;
//s.options.numBuffers = 1024 * 1024 * 1024;
//s.latency = 0.05;
s.options.sampleRate = 44100;
s.boot;
m = NetAddr.new("192.168.1.1", 10024); // XR16 X-AIR on local netowrk
"...".postln;
~play1 = { arg b1;
Routine {
// quantise to 10 second boundaries
("now -> " ++ Date.gmtime ++ " -> " ++ Date.gmtime.second).postln;
(10-Date.gmtime.second.mod(10)).wait;
"sync?...".postln;
"~play [bg - ".post; b1.path.post; "]".postln;
{DiskIn.ar(2, b1, loop: 1)}.play.waitForFree;
// free buffer once done? check diskin completion state
"freed [bg - ".post; b1.path.post; "]".postln;
b1.free;
}.play;
};
SynthDef(\pulse, {
SendTrig.kr(Impulse.kr(0.1), 0,
LinLin.ar(LinCongC.ar(freq: 0.5, a: 1.1, c: 0.13, m: 1, xi: 0), -1, 1, 0, 0.3);
//LinLin.ar(FSinOsc(0.5), -1, 1, 0, 0.75);
);
}).add;
OSCFunc({ arg msg, time;
// fx1 levels (0 .. ~0.25)
m.sendMsg("/ch/01/mix/07/level/", msg[3]);
m.sendMsg("/ch/02/mix/07/level/", msg[3]);
m.sendMsg("/ch/03/mix/07/level/", msg[3]);
m.sendMsg("/ch/04/mix/07/level/", msg[3]);
// fx2 levels (0 .. ~0.275)
m.sendMsg("/ch/01/mix/08/level/", 0.1.rand(0.275));
m.sendMsg("/ch/02/mix/08/level/", 0.1.rand(0.275));
m.sendMsg("/ch/03/mix/08/level/", 0.1.rand(0.275));
m.sendMsg("/ch/04/mix/08/level/", 0.1.rand(0.275));
//"osc -> " ++ msg[3].postln;
},'/tr', s.addr);
s.waitForBoot {
"booted...".postln;
~file = Platform.userHomeDir ++ "/snd/" ++ "ephemera1-20180521-12.wav";
"fx...".postln;
Synth(\pulse);
// cue stereo file from disk then play
b=Buffer.cueSoundFile (server: s, path: ~file, numChannels: 2); ~play1.value(b);
};
// 167/31 -> 175/31 -> 168/31