From dfa7bdbf6e4d7923782fe55c3a780dea22c70d7d Mon Sep 17 00:00:00 2001 From: FoAM Date: Sat, 19 May 2018 19:36:07 +0000 Subject: [PATCH 1/3] sstteerreeoo --- ephemera-2CH.sc | 120 ++++++++++++++++++++++++++++++++++++++++++++++++ setup.sh | 2 +- 2 files changed, 121 insertions(+), 1 deletion(-) create mode 100644 ephemera-2CH.sc diff --git a/ephemera-2CH.sc b/ephemera-2CH.sc new file mode 100644 index 0000000..58e1066 --- /dev/null +++ b/ephemera-2CH.sc @@ -0,0 +1,120 @@ +///// // / / / / / / / +// +// 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; + +// 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.hour.postln; + + +~prefix = Platform.userHomeDir ++ "/snd/"; + +~background = { + + "background >> ".post; + + // list of soundfiles + ~sources = [ + "ephemera-20180516.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) * 0.1).dup }.play.waitForFree; + // free buffer once done? + + "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 diff --git a/setup.sh b/setup.sh index fed5900..97c7f38 100755 --- a/setup.sh +++ b/setup.sh @@ -21,6 +21,6 @@ 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' -/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..." From b72f1d397f2ae1880da4f2eec7ddbb922125b480 Mon Sep 17 00:00:00 2001 From: FoAM Date: Mon, 21 May 2018 07:18:36 +0000 Subject: [PATCH 2/3] nqsync --- crontab.txt | 6 ++---- ephemera-2CH.sc | 16 +++++++++++----- setup.sh | 6 +++--- 3 files changed, 16 insertions(+), 12 deletions(-) diff --git a/crontab.txt b/crontab.txt index 9e90deb..00c9bf0 100644 --- a/crontab.txt +++ b/crontab.txt @@ -25,9 +25,7 @@ # */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 -* 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 -# 0 4 * * * /sbin/shutdown -r now - - +# 0 4 * * * /sbin/shutdown -r +5 diff --git a/ephemera-2CH.sc b/ephemera-2CH.sc index 58e1066..b21482c 100644 --- a/ephemera-2CH.sc +++ b/ephemera-2CH.sc @@ -19,6 +19,13 @@ 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; @@ -29,8 +36,7 @@ if ( ~now.year == 1970, {"post 1970".postln;} ); -~now.hour.postln; - +~now.postln; ~prefix = Platform.userHomeDir ++ "/snd/"; @@ -40,7 +46,7 @@ if ( ~now.year == 1970, // list of soundfiles ~sources = [ - "ephemera-20180516.wav" + "ephemera-20180520-2ch-12.wav" ]; // select random element from the list @@ -81,8 +87,8 @@ if ( ~now.year == 1970, Routine { "~play [bg - ".post; b1.path.post; "]".postln; - {(DiskIn.ar(2, b1, loop: 0) * 0.1).dup }.play.waitForFree; - // free buffer once done? + {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; diff --git a/setup.sh b/setup.sh index 97c7f38..99b3f84 100755 --- a/setup.sh +++ b/setup.sh @@ -1,7 +1,5 @@ #!/bin/bash -# via -> http://sc3howto.blogspot.be/2015/04/how-to-keep-installation-running-on.html - export DISPLAY=:0 #export DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1001/bus #export XDG_RUNTIME_DIR=/run/user/1001 @@ -13,8 +11,10 @@ echo "ephemeral: ------------------------------------------------------------" echo "ephemeral: `/bin/date`" echo "ephemeral: as user `whoami`" #echo "ephemeral: with env -> `env`" -echo "ephemeral: waiting..." +echo "ephemeral: scythe..." + +killall sclang sleep 5 echo "ephemeral: sclang starting..." From 5b1e76138b3ccd6bddf65ca94a451501a9209538 Mon Sep 17 00:00:00 2001 From: FoAM Date: Mon, 21 May 2018 07:46:48 +0000 Subject: [PATCH 3/3] loop --- ephemera-loop.sc | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 ephemera-loop.sc diff --git a/ephemera-loop.sc b/ephemera-loop.sc new file mode 100644 index 0000000..59fc983 --- /dev/null +++ b/ephemera-loop.sc @@ -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