13.07.2015 Views

Tutorials and Topics - Peabody Computer Music

Tutorials and Topics - Peabody Computer Music

Tutorials and Topics - Peabody Computer Music

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Tutorial 16Sampling:Record <strong>and</strong> play audio filesPlay audio files: sfplay~In the left part of the Patcher window there is a patch for playing audio files. The basicusage of sfplay~ requires only a few objects, as shown in the following example. To play afile, you just have to open it <strong>and</strong> start sfplay~. The audio output of sfplay~ can be sentdirectly to dac~ or ezdac~, <strong>and</strong>/or anywhere else in MSP.Simple implementation of audio file playback• Click on the open message box marked “Set the current file”, <strong>and</strong> open the audio fileyou have just recorded. Then (with audio on) click on the toggle marked “Play/Stop”to hear your file.Play excerpts on cueBecause sfplay~ does not need to load an entire audio file into memory, you can actuallyhave many files open in the same sfplay~ object, <strong>and</strong> play any of them (or any portion ofthem) on cue. The most recently opened file is considered by sfplay~ to be the “current”file, <strong>and</strong> that is the file it will play when it receives the message 1.• Click on the remaining open message boxes to open some other audio files, <strong>and</strong> thenclick on the message box marked “Define cues, 2 to 9”.The preload message to sfplay~ specifies an entire file or a portion of a file, <strong>and</strong> assigns it acue number. From then on, every time sfplay~ receives that number, it will play that cue.In the example patch, cues 2, 3, <strong>and</strong> 4 play entire files, cue 5 plays the first 270 millisecondsof sacre.aiff, <strong>and</strong> so on. Cue 1 is always reserved for playing the current (most recentlyopened) file, <strong>and</strong> cue 0 is reserved for stopping sfplay~.Whenever sfplay~ receives a cue, it stops whatever it is playing <strong>and</strong> immediately plays thenew cue. (You can also send sfplay~ a queue of cues, by sending it a list of numbers, <strong>and</strong> itwill play each cue in succession.) Each preload message actually creates a small buffercontaining the audio data for the beginning of the cue, so playback can start immediatelyupon receipt of the cue number.140

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!