2018-05-09 22:44:44 +00:00
|
|
|
///// // / / / / / / /
|
|
|
|
//
|
|
|
|
// supercollider tests
|
|
|
|
//
|
|
|
|
////// / /
|
|
|
|
|
|
|
|
|
|
|
|
"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;
|
|
|
|
|
|
|
|
"...".postln;
|
|
|
|
|
2018-05-11 19:12:44 +00:00
|
|
|
// time of day - see AppClock for scheduling
|
|
|
|
|
|
|
|
~now=Date.gmtime;
|
2018-05-11 19:14:40 +00:00
|
|
|
|
2018-05-11 19:12:44 +00:00
|
|
|
// dont trust the clock if it's n 1970 (not ntp synced)
|
|
|
|
if ( ~now.year == 1970,
|
|
|
|
{"previously".postln;},
|
|
|
|
{"post 1970".postln;}
|
2018-05-11 19:14:40 +00:00
|
|
|
);
|
|
|
|
|
2018-05-11 19:12:44 +00:00
|
|
|
~now.hour.postln;
|
|
|
|
|
|
|
|
|
2018-05-10 19:21:36 +00:00
|
|
|
~prefix = Platform.userHomeDir ++ "/snd/";
|
2018-05-09 22:44:44 +00:00
|
|
|
|
|
|
|
~background = {
|
|
|
|
|
|
|
|
"background >> ".post;
|
2018-05-10 19:21:36 +00:00
|
|
|
|
2018-05-09 22:44:44 +00:00
|
|
|
// list of soundfiles
|
|
|
|
~sources = [
|
2018-05-10 19:21:36 +00:00
|
|
|
"39-incomprehensible-restaurtant-chatter-02.wav",
|
|
|
|
"39-incomprehensible-restaurtant-chatter-03.wav",
|
|
|
|
"39-incomprehensible-restaurtant-chatter-04.wav",
|
|
|
|
"46-afternoon-chorus-02.wav",
|
|
|
|
"46-afternoon-chorus-03.wav",
|
|
|
|
"46-afternoon-chorus-04.wav",
|
2018-05-09 22:44:44 +00:00
|
|
|
];
|
2018-05-10 19:21:36 +00:00
|
|
|
|
2018-05-09 22:44:44 +00:00
|
|
|
// select random element from the list
|
|
|
|
~file = ~sources.choose;
|
|
|
|
~file.postln;
|
|
|
|
|
2018-05-14 10:15:50 +00:00
|
|
|
// cue file form disk then play
|
2018-05-14 10:31:15 +00:00
|
|
|
b=Buffer.cueSoundFile (s, ~prefix++~file); ~play1.value(b);
|
2018-05-09 22:44:44 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
~foreground = {
|
|
|
|
|
|
|
|
"foreground >> ".post;
|
2018-05-10 19:21:36 +00:00
|
|
|
|
2018-05-09 22:44:44 +00:00
|
|
|
// list of soundfiles
|
|
|
|
~sources = [
|
2018-05-10 19:21:36 +00:00
|
|
|
"26-multilayered-conversations-01.wav",
|
|
|
|
"26-multilayered-conversations-02.wav",
|
|
|
|
"39-incomprehensible-restaurtant-chatter-02.wav",
|
|
|
|
"39-incomprehensible-restaurtant-chatter-03.wav",
|
|
|
|
"39-incomprehensible-restaurtant-chatter-04.wav",
|
|
|
|
"26-party-chatter-02.wav",
|
|
|
|
"26-party-chatter-03.wav",
|
|
|
|
"26-party-chatter-04.wav",
|
|
|
|
"06-uw-pebbles-urchins-waves.wav",
|
|
|
|
"17-uw-waves-crashing-on-pebble-beach-slow.wav"
|
2018-05-09 22:44:44 +00:00
|
|
|
];
|
2018-05-10 19:21:36 +00:00
|
|
|
|
2018-05-09 22:44:44 +00:00
|
|
|
// select random element from the list
|
|
|
|
~file = ~sources.choose;
|
|
|
|
~file.postln;
|
|
|
|
|
|
|
|
// read file then play buffer
|
2018-05-10 19:21:36 +00:00
|
|
|
Buffer.read (server: s, path: ~prefix++~file, action: ~play2);
|
2018-05-09 22:44:44 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
~play1 = { arg b1;
|
|
|
|
Routine {
|
|
|
|
"~play [bg - ".post; b1.path.post; "]".postln;
|
|
|
|
|
2018-05-14 10:22:29 +00:00
|
|
|
{(DiskIn.ar(1, b1, loop: 0) * 0.1).dup }.play.waitForFree;
|
2018-05-09 22:44:44 +00:00
|
|
|
// free buffer once done?
|
2018-05-10 19:21:36 +00:00
|
|
|
|
2018-05-09 22:44:44 +00:00
|
|
|
"freed [bg - ".post; b1.path.post; "]".postln;
|
2018-05-10 14:18:53 +00:00
|
|
|
b1.free;
|
2018-05-10 19:21:36 +00:00
|
|
|
~background.value;
|
2018-05-09 22:44:44 +00:00
|
|
|
}.play;
|
|
|
|
};
|
|
|
|
|
|
|
|
~play2 = { arg b2;
|
|
|
|
Routine {
|
|
|
|
"~play [fg - ".post; b2.path.post; "]".postln;
|
|
|
|
|
|
|
|
{(PlayBuf.ar(1, b2, rate: 1, loop: 0, doneAction: 2) * 0.1).dup }.play.waitForFree;
|
|
|
|
// free buffer once done?
|
2018-05-10 19:21:36 +00:00
|
|
|
|
2018-05-09 22:44:44 +00:00
|
|
|
"freed [fg - ".post; b2.path.post; "]".postln;
|
2018-05-10 19:21:36 +00:00
|
|
|
b2.free;
|
|
|
|
~foreground.value;
|
2018-05-09 22:44:44 +00:00
|
|
|
}.play;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
s.waitForBoot {
|
|
|
|
"booted...".postln;
|
|
|
|
|
|
|
|
i = 0;
|
|
|
|
j = 0;
|
|
|
|
p = 2; // how many background layers?
|
|
|
|
q = 3; // how many foreground layers?
|
|
|
|
|
|
|
|
while ( { i < p }, { i = i + 1; ~background.value;});
|
|
|
|
while ( { j < q }, { j = j + 1; ~foreground.value;});
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
// 167/31 -> 175/31 -> 168/31
|
|
|
|
|