(max) soundfile playback with playlist~

example patcher

playlist~

playlist~ is one of the new media players available in Max 7. You can load one or more soundfiles for playback, complete with play and loop controls, graphic waveform display, and the ability to select portions of the file for playback and/or looping.

You can insert a playlist~ object into a patcher simply by dragging a soundfile from the media bar (on the left side of the patcher) or the Finder into blank space in the patcher. Dragging a single file into the patcher creates a playlist~ with that file. Dragging multiple files creates a single playlist~ with all the files loaded.

You can drag and insert more files into a playlist~, remove files, and rearrange the order of files. When you drag in a new file, pay attention to the red insertion/replace indicator. If you see a red line, the file will insert between clips at that point. If you see a red rectangle, then the new file will replace the enclosed clip in the playlist~.

controlling playlist~

You can control and modify soundfile playback in playlist~ in all the same ways you can with [sfplay~]. However, since you have to target specific clips with control messages, you cannot use [attrui]. You have to use messages that specify the parameter being changed, the clip number it applies to, and the parameter value. The example patcher shows a number of these controls. Clip numbering starts with 1.

Sending a number to playlist~ causes that clip to start playing. Only one clip can play at a time, so sending another number while any clip is playing will stop the current clip and start the indicated clip. Sending a 0 stops any clip from playing.

Playback notifications likewise include clip-specific information. While [sfplay~] outputs a bang when a soundfile stops playback, playlist~ sends start and done messages. The format is start (or done) clip# filename. You could create random or algorithmic controls for cueing clips based on which clip has finished playing. You wouldn’t need to process the filename in any way. Instead, you can route messages using start or done and process according to the clip number.