From 5b1e76138b3ccd6bddf65ca94a451501a9209538 Mon Sep 17 00:00:00 2001 From: FoAM Date: Mon, 21 May 2018 07:46:48 +0000 Subject: [PATCH] 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