//Write to file dac => WvOut2 writer => blackhole; writer.wavFilename("/Users/catrian/Desktop/door1_loop.wav"); SndBuf buffy; "/Users/catrian/Desktop/" => string dataDir; "door.1.wav" => string dataFile; // delay DelayL delay => dac; delay => Gain g => delay; // max 1::second => delay.max; // load dataDir + dataFile => buffy.read; // silence it 0 => buffy.gain; while( true ) { // play it! play( buffy, delay, .5, .9, 1::second ); // advance time 1::second => now; } fun void play(SndBuf buf, DelayL delay, float gain, float attenuation, dur T ) { // connect buf => delay; // attenuation attenuation => g.gain; // sample rate second / samp => float SRATE; // set the playhead 0 => buf.pos; // set the gain gain => buf.gain; // advance T => now; // disconnect buf =< delay; }