A newer version of Max is available. Click here to access the latest version of this document.

play~

Position-based sample playback

Description

play~ is a playback interface for buffer~ that plays back samples based on an offset within the buffer. See groove~ for another sample playback interface. play~ is typically used with line~, but can be used with any signal that generates a changing position value in milliseconds.

Arguments

Name Type Opt Description
buffer-object-name symbol Obligatory. Names the buffer~ object whose sample memory is used by play~ for playback.
number-of-output-channels int opt Specifies the number of output channels: 1, 2, or 4. The default number of channels is one. If the buffer~ being played has fewer channels than the number of play~ output channels, the extra channels output a zero signal. If the buffer~ has more channels, channels are mixed.

Messages

int start-position [int]
The behavior of a play~ object - it's direction and speed of playback - is set using integer messages. These messages come in pairs - an initial integer that specifies the position in the buffer (in milliseconds) at which to start, followed by a second pair of numbers that specify the ending position in the buffer and the time (in milliseconds) over which the playback will occur. These messages are often sent as messages separated by a comma. Here are some examples:

0, 2000 2000- Starting at the beginning of the buffer, play 2 seconds of audio at normal speed
500, 0 500- Play the first half second of a buffer backwards at normal speed.
0, 1000 500- Play the first second of a buffer at double speed (i.e. transpose it up an octave)
(mouse) Double-clicking on buffer~ opens a display window where you can view the contents of the buffer~. object that the play~ object references.
set buffer-object-name [symbol]
The word set, followed by the name of a buffer~ object, uses that buffer~ for playback.
signal In left inlet: The position (in milliseconds) into the sample memory of a buffer~ object from which to play. If the signal is increasing over time, play~ will play the sample forward. If it is decreasing, play~ will play the sample backward. If it remains the same, play~ outputs the same sample repeatedly, which is equivalent to a DC offset of the sample value.

Information for box attributes common to all objects

Output

signal: Sample output read from a buffer~. If play~ has two or four output channels, the left outlet's signal contains the left channel of the sample, and the other outlets' signals contain the samples from the additional channels.

Examples

play~ is usually driven by a ramp signal from line~ but other signals create novel effects

See Also

Name Description
2d.wave~ Two-dimensional wavetable
buffer~ Store audio samples
buffir~ buffer-based FIR filter
groove~ Variable-rate looping sample playback
record~ Record sound into a buffer
MSP Tutorial 13: Recording and Playback MSP Tutorial 13: Recording and Playback