Playing a sample with groove~

The groove~ object plays sound from a buffer~, using two important pieces of information: a rate provided as a MSP signal and a starting point provided as a float or int message. For normal playback, the rate should be a signal with a constant value of 1. (The sig~ object is a good way to get a constant signal value.) A rate of 2 will play at double speed, a rate of 0.5 will play at half speed, and so on. Negative rate values will play backward.

DJ-like sample scrubbing

Although playback is normally achieved by progressing linearly through a stored sound, other ways of traversing the sound can give interesting results. Moving quickly back and forth in the sound is analogous to the type of "scrubbing" achieved by rocking the reels of a tape recorder back and forth by hand, or by "scratching" an LP back and forth by hand. In this example, we use a cycle~ object to simulate this sort of scrubbing.

Playing a sample from RAM

You can use the play~ object to play the contents of a buffer~, simply by sending it a start message. By default it starts from the beginning of the buffer~. You can specify a different starting time, in milliseconds, as an argument to the start message, or you can specify both a starting time and a stopping time (in ms) as two arguments to the start message. In the patch, you can see two examples of the use of ‘starttime’ and ‘stoptime’ arguments.

Getting a sound sample from RAM

The buffer~ object holds audio data in RAM as an array of 32-bit floating point numbers (floats). The fact that the sound is loaded into RAM, rather than read continuously off the hard drive as the sfplay~ object does, means that it can be accessed quickly and in various ways, for diverse audio effects (including normal playback).

Live capture in buffer~

This shows how to record into a RAM (random-access memory) buffer, and how to play back the contents of the buffer at any rate (even backward by using a negative rate) starting at any point in the buffer. A timer is used to keep track of the duration of the recording. The example also demonstrates how one might use a quick fade-in and fade-out to avoid clicks when doing realtime capture during a performance.