//Write to file dac => WvOut2 writer => blackhole; writer.wavFilename("/Users/catrian/Desktop/writing_filtered.wav"); SndBuf buffy; "/Users/catrian/Desktop/" => string dataDir; "writing.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, 55, .5, 1.5::second ); // advance time .8::second => now; } fun void play( SndBuf buf, DelayL delay, float gain, float pitch, float attenuation, dur T ) { // connect buf => delay; // attenuation attenuation => g.gain; // freq pitch => Std.mtof => float freq; // sample rate second / samp => float SRATE; // delay in samples (SRATE / freq)::samp => delay.delay; // set the playhead 0 => buf.pos; // set the gain gain => buf.gain; // advance T => now; // disconnect buf =< delay; }