Merge branch 'master' of repo.fo.am:foam/ephemeral-garden

This commit is contained in:
nik gaffney 2018-05-21 15:57:39 +02:00
commit 0ddce9d279
4 changed files with 177 additions and 8 deletions

View file

@ -25,9 +25,7 @@
# */5 * * * * /home/foam/ephemeral-garden/check.sh >> /home/foam/ephemeral-garden/test.log 2>&1 # */5 * * * * /home/foam/ephemeral-garden/check.sh >> /home/foam/ephemeral-garden/test.log 2>&1
* 07 * * * /home/foam/ephemeral-garden/morning.sh >> /home/foam/ephemeral-garden/test.log 2>&1 * 07 * * * /home/foam/ephemeral-garden/morning.sh >> /home/foam/ephemeral-garden/test.log 2>&1
* 22 * * * /home/foam/ephemeral-garden/evening.sh >> /home/foam/ephemeral-garden/test.log 2>&1 * 23 * * * /home/foam/ephemeral-garden/evening.sh >> /home/foam/ephemeral-garden/test.log 2>&1
# in root's crontab. check timing # in root's crontab. check timing
# 0 4 * * * /sbin/shutdown -r now # 0 4 * * * /sbin/shutdown -r +5

126
ephemera-2CH.sc Normal file
View file

@ -0,0 +1,126 @@
///// // / / / / / / /
//
// 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;
Routine {
// quantise to 10 second boundaries
("now -> " ++ Date.gmtime.second).postln;
(10-Date.gmtime.second.mod(10)).wait;
"sync?...".postln;
}.play;
// time of day - see AppClock for scheduling
~now=Date.gmtime;
// dont trust the clock if it's n 1970 (not ntp synced)
if ( ~now.year == 1970,
{"previously".postln;},
{"post 1970".postln;}
);
~now.postln;
~prefix = Platform.userHomeDir ++ "/snd/";
~background = {
"background >> ".post;
// list of soundfiles
~sources = [
"ephemera-20180520-2ch-12.wav"
];
// select random element from the list
~file = ~sources.choose;
~file.postln;
// cue stereo file from disk then play
b=Buffer.cueSoundFile (server: s, path: ~prefix++~file, numChannels: 2); ~play1.value(b);
};
~foreground = {
"foreground >> ".post;
// list of soundfiles
~sources = [
"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"
];
// select random element from the list
~file = ~sources.choose;
~file.postln;
// read file then play buffer
Buffer.read (server: s, path: ~prefix++~file, action: ~play2);
};
~play1 = { arg b1;
Routine {
"~play [bg - ".post; b1.path.post; "]".postln;
{DiskIn.ar(2, b1, loop: 0)}.play.waitForFree;
// free buffer once done? check diskin completion state
"freed [bg - ".post; b1.path.post; "]".postln;
b1.free;
~background.value;
}.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?
"freed [fg - ".post; b2.path.post; "]".postln;
b2.free;
~foreground.value;
}.play;
};
s.waitForBoot {
"booted...".postln;
i = 0;
j = 0;
p = 1; // how many background layers?
q = 0; // 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

45
ephemera-loop.sc Normal file
View file

@ -0,0 +1,45 @@
///// // / / / / / / /
//
// 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;
"...".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;
};
s.waitForBoot {
"booted...".postln;
~file = Platform.userHomeDir ++ "/snd/" ++ "ephemera-20180520-2ch-12.wav";
// 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

View file

@ -1,7 +1,5 @@
#!/bin/bash #!/bin/bash
# via -> http://sc3howto.blogspot.be/2015/04/how-to-keep-installation-running-on.html
export DISPLAY=:0 export DISPLAY=:0
#export DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1001/bus #export DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1001/bus
#export XDG_RUNTIME_DIR=/run/user/1001 #export XDG_RUNTIME_DIR=/run/user/1001
@ -13,14 +11,16 @@ echo "ephemeral: ------------------------------------------------------------"
echo "ephemeral: `/bin/date`" echo "ephemeral: `/bin/date`"
echo "ephemeral: as user `whoami`" echo "ephemeral: as user `whoami`"
#echo "ephemeral: with env -> `env`" #echo "ephemeral: with env -> `env`"
echo "ephemeral: waiting..."
echo "ephemeral: scythe..."
killall sclang
sleep 5 sleep 5
echo "ephemeral: sclang starting..." echo "ephemeral: sclang starting..."
#runuser -l foam -c 'screen -S test -m -d /usr/local/bin/sclang /home/foam/ephemeral-garden/sc3-test.sc >> /home/foam/ephemeral-garden/test.log 2>&1' #runuser -l foam -c 'screen -S test -m -d /usr/local/bin/sclang /home/foam/ephemeral-garden/sc3-test.sc >> /home/foam/ephemeral-garden/test.log 2>&1'
/usr/local/bin/sclang /home/foam/ephemeral-garden/sc3-test.sc 2>&1 >> /home/foam/ephemeral-garden/test.log /usr/local/bin/sclang /home/foam/ephemeral-garden/ephemera-2CH.sc 2>&1 >> /home/foam/ephemeral-garden/test.log
echo "ephemeral: sclang spawned..." echo "ephemeral: sclang spawned..."