diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..b25c15b --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +*~ diff --git a/README.md b/README.md index 619fa67..5dda0af 100644 --- a/README.md +++ b/README.md @@ -3,4 +3,3 @@ "The Ephemeral Garden evokes the sense of convivial gatherings under a pergola. The murmur of conversation, complemented with the sound of animate matter. Growing plants, crackling wood, expanding rocks, crawling insects and the invisible signals emanating from all-pervasive electronic devices. Human and non-human voices intermingle. An ambience that is thick and alive, filled with liminal whispers otherwise unheard. Field recordings and synthetic sounds combine to create a continuously changing atmosphere. Beings come and go, the noise rises and subsides. The garden awakens with daylight, buzzes with activity throughout the day, then quietens at dusk. Its character adapting to the changing of seasons..." https://fo.am/pergola/ - diff --git a/crontab.txt b/crontab.txt new file mode 100644 index 0000000..9e90deb --- /dev/null +++ b/crontab.txt @@ -0,0 +1,33 @@ +# Edit this file to introduce tasks to be run by cron. +# +# Each task to run has to be defined through a single line +# indicating with different fields when the task will be run +# and what command to run for the task +# +# To define the time you can provide concrete values for +# minute (m), hour (h), day of month (dom), month (mon), +# and day of week (dow) or use '*' in these fields (for 'any').# +# Notice that tasks will be started based on the cron's system +# daemon's notion of time and timezones. +# +# Output of the crontab jobs (including errors) is sent through +# email to the user the crontab file belongs to (unless redirected). +# +# For example, you can run a backup of all your user accounts +# at 5 a.m every week with: +# 0 5 * * 1 tar -zcf /var/backups/home.tgz /home/ +# +# For more information see the manual pages of crontab(5) and cron(8) +# +# m h dom mon dow command + +# in foam's crontab. check timezone and clock sync + +# */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 + +# in root's crontab. check timing +# 0 4 * * * /sbin/shutdown -r now + + diff --git a/ephemera.sc b/ephemera.sc new file mode 100644 index 0000000..0c23a95 --- /dev/null +++ b/ephemera.sc @@ -0,0 +1,136 @@ +///// // / / / / / / / +// +// 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; + + +~background = { + + "background >> ".post; + + // list of soundfiles + ~sources = [ + "/home/foam/snd/39-incomprehensible-restaurtant-chatter-02.wav", + "/home/foam/snd/39-incomprehensible-restaurtant-chatter-03.wav", + "/home/foam/snd/39-incomprehensible-restaurtant-chatter-04.wav", + "/home/foam/snd/46-afternoon-chorus-02.wav", + "/home/foam/snd/46-afternoon-chorus-03.wav", + "/home/foam/snd/46-afternoon-chorus-04.wav", + ]; + + // select random element from the list + ~file = ~sources.choose; + ~file.postln; + + // read file then play buffer + Buffer.read (server: s, path: ~file, action: ~play1); +}; + +~foreground = { + + "foreground >> ".post; + + // list of soundfiles + ~sources = [ + "/home/foam/snd/26-multilayered-conversations-01.wav", + "/home/foam/snd/26-multilayered-conversations-02.wav", + "/home/foam/snd/39-incomprehensible-restaurtant-chatter-02.wav", + "/home/foam/snd/39-incomprehensible-restaurtant-chatter-03.wav", + "/home/foam/snd/39-incomprehensible-restaurtant-chatter-04.wav", + "/home/foam/snd/26-party-chatter-02.wav", + "/home/foam/snd/26-party-chatter-03.wav", + "/home/foam/snd/26-party-chatter-04.wav", + "/home/foam/snd/06-uw-pebbles-urchins-waves.wav", + "/home/foam/snd/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: ~file, action: ~play2); +}; + +~play1 = { arg b1; + Routine { + "~play [bg - ".post; b1.path.post; "]".postln; + + {(PlayBuf.ar(1, b1, rate: 1, loop: 0, doneAction: 2) * 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 = 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 + + +// via http://danielnouri.org/docs/SuperColliderHelp/Tutorials/Getting-Started/Buffers.html +// Streaming a File in From Disk + + +// In some cases, for instance when working with very large files, you might not want to load a sound completely into memory. Instead, you can stream it in from disk a bit at a time, using the UGen DiskIn, and Buffer's 'cueSoundFile' method: + + // ( + // SynthDef("tutorial-Buffer-cue",{ arg out=0,bufnum; + // Out.ar(out, + // DiskIn.ar( 1, bufnum ) + // ) + + // }).send(s); + // ) + + + // b = Buffer.cueSoundFile(s,"sounds/a11wlk01-44_1.aiff", 0, 1); + // y = Synth.new("tutorial-Buffer-cue", [\bufnum,b.bufnum], s); + + // b.free; y.free; + + +// This is not as flexible as PlayBuf (no rate control), but can save memory. \ No newline at end of file diff --git a/evening.sh b/evening.sh new file mode 100644 index 0000000..5cd4a75 --- /dev/null +++ b/evening.sh @@ -0,0 +1,5 @@ +#!/bin/bash + +# evening. clean up and stop processes + +echo "evening: `date`" diff --git a/morning.sh b/morning.sh new file mode 100644 index 0000000..acda7b4 --- /dev/null +++ b/morning.sh @@ -0,0 +1,5 @@ +#!/bin/bash + +# morning. set up and start processes + +echo "morning: `date`" diff --git a/pergola.service b/pergola.service new file mode 100644 index 0000000..c0253e2 --- /dev/null +++ b/pergola.service @@ -0,0 +1,15 @@ +[Unit] +Description=Supercollisions under a pergola +After=multi-user.target sound.target + +[Service] +Type=simple +User=foam +Group=audio +ExecStart=/home/foam/ephemeral-garden/pre-setup.sh +StandardOutput=syslog+console +StandardError=syslog+console + +[Install] +Alias=cloud-pergola.service +Requires=sound.target diff --git a/pre-setup.sh b/pre-setup.sh new file mode 100755 index 0000000..cc549b8 --- /dev/null +++ b/pre-setup.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +# to be run as root to setup/start/sclang +#runuser -l foam -c 'screen -S test -m -d /home/foam/ephemeral-garden/setup.sh' + +# to be run from user 'foam' crontab +screen -S test -m -d /home/foam/ephemeral-garden/setup.sh diff --git a/sample-player.rb b/sample-player.rb index 29c0b17..e2537ed 100644 --- a/sample-player.rb +++ b/sample-player.rb @@ -1,9 +1,8 @@ # -*- mode: enh-ruby; coding: utf-8; -*- -play 72 -sleep 1 - -snd = "~/snd/" -sample snd, "29", rrand_i(1,2), amp: 1.5 -sample snd, "31", rrand_i(1,2), lpf: 70, amp: 1.5 +snd = "/home/foam/snd/" +loop do + sample snd, "29", rrand_i(1,2), amp: 1.5 + #sample snd, "29", rrand_i(1,2), lpf: 70, amp: 1.5 +end diff --git a/setup.sh b/setup.sh new file mode 100755 index 0000000..fed5900 --- /dev/null +++ b/setup.sh @@ -0,0 +1,26 @@ +#!/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 +export JACK_NO_AUDIO_RESERVATION=1 + +port=57110 + +echo "ephemeral: ------------------------------------------------------------" +echo "ephemeral: `/bin/date`" +echo "ephemeral: as user `whoami`" +#echo "ephemeral: with env -> `env`" +echo "ephemeral: waiting..." + +sleep 5 + +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 + +echo "ephemeral: sclang spawned..."