PlayBuf.ar plays back audio files loaded into server buffers; rate controls speed and direction
Buffer.read(s, ‘path’) loads a WAV/AIFF file into a server buffer. PlayBuf.ar(numChannels, bufnum) streams it back. The rate argument (default 1.0) controls playback speed: 2.0 = double speed (octave up), 0.5 = half speed (octave down), -1 = reverse. Setting loop:1 loops the file. MouseY.kr can control rate in real time. doneAction:2 auto-frees the synth when PlayBuf finishes. Dragging a file onto an SC document auto-inserts the full path in quotes.
Examples
~buf = Buffer.read(s,‘/path/to/file.wav’); {PlayBuf.ar(1,~buf,rate:0.5,loop:1)}.play; // half speed {PlayBuf.ar(1,~buf,-1,loop:1)}.play; // reverse
Assessment
Load a mono sound file and play it at three speeds (normal, half, double) simultaneously using multichannel expansion.