Commit f91f193f authored by nik gaffney's avatar nik gaffney

diskio

parent 6547ef0a
......@@ -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
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment