(max) sfplay~ > soundfile playback

example patchers

sfplay~

[sfplay~] plays soundfiles from the hard disk. You can define cue regions, loops, adjust speed of playback, and with version 7, independently stretch/compress time and shift pitch.

sfplay1.maxpat shows some basic controls. The patcher is well-commented, but highlights include the open message to open the standard Mac/Windows file open dialog for file selection. A toggle can be used to play/stop a file, but the toggle doesn’t update itself when a file stops playing by reaching its end. [sfplay~] sends a bang when it stops playing, either by reaching the end of the file, or by being stopped. Using the gate, you can control the sending of the bang back to the toggle, so that it only happens when the file reaches its end.

dropfile

[dropfile] creates a rectangle that you can use as a target to drag and drop files from the desktop to a max patcher. The type of file dropped is output via the right outlet. The full path name of the file is sent to the left outlet, and with the [prepend open] object can be sent to [sfplay~] object to load that file.

playbar

The [playbar] is a QuickTime-style control bar. You can connect it to [sfplay~] to control playback and looping via a familiar tool.

controlling sfplay~

sfplay2.maxpat shows a number of ways that you can control playback parameters of [sfplay~]. You can change most parameters via messages (demonstrated with loop and speed) or with attribute inspectors [attrui] (demonstrated with timestretch, speed, pitchshift, and loop).

The are a few reasons why you would pick one or the other. Messages can receive input from other objects in a patcher, so they can be controlled by changing conditions in the patcher. [attrui] objects come with a label and UI control all in one, so they are more compact in a patcher and easier to create. [attrui] objects also must be connected to the object they control directly through a patch cord connection. They cannot use send/receive objects. An [attrui] object attached to a send object becomes an attribute inspector for that send object.