From f91f193fabffe5c88d747ae365cef6837500629a Mon Sep 17 00:00:00 2001 From: nik gaffney Date: Mon, 14 May 2018 12:15:50 +0200 Subject: [PATCH] diskio --- ephemera.sc | 30 +++--------------------------- 1 file changed, 3 insertions(+), 27 deletions(-) diff --git a/ephemera.sc b/ephemera.sc index eb025cd..a4561fb 100644 --- a/ephemera.sc +++ b/ephemera.sc @@ -52,8 +52,8 @@ if ( ~now.year == 1970, ~file = ~sources.choose; ~file.postln; - // read file then play buffer - Buffer.read (server: s, path: ~prefix++~file, action: ~play1); + // cue file form disk then play + Buffer.cueSoundFile (server: s, path: ~prefix++~file, action: ~play1); }; ~foreground = { @@ -86,7 +86,7 @@ if ( ~now.year == 1970, Routine { "~play [bg - ".post; b1.path.post; "]".postln; - {(PlayBuf.ar(1, b1, rate: 1, loop: 0, doneAction: 2) * 0.1).dup }.play.waitForFree; + {(Diskin.ar(1, b1, loop: 0) * 0.1).dup }.play.waitForFree; // free buffer once done? "freed [bg - ".post; b1.path.post; "]".postln; @@ -124,27 +124,3 @@ s.waitForBoot { // 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