buffer~

List audio cue points

To set a list of cue points in an audio file and have them played in order, use either sfplay~ (with a set of cues established by preload messages to sfplay~ or to sflist~) or buffer~ (with start messages to play~, the parameters of which are stored in a coll).

Customize oscillator behavior

The canonical way to get cyclic "oscillator" behavior is, for every sample number (n), take a step of a certain size (increment) at a certain rate of speed (sample rate) wrapping around to stay within a specific range (length) such that you complete a certain number of cycles (frequency). What you get is an index (x) that you can use to look up values in a table, or as input to an equation, to get a result (y). What should the step size (the increment) be? It’s determined by the formula “increment = n * frequency * length/sample rate”.

Using A Loop to Set Master Tempo

The groove~ object can be used to record a loop on the fly and use the loop length to set a master tempo which can send MIDI clock messages to other machines. The groove~ object sends out its right outlet a signal that goes from 0. to 1. as the current playback location of groove~ goes from its ‘loopstart’ point to its ‘loopend’ point. By default, groove~’s ‘loopstart’ point is 0 and its ‘loopend’ point is the end of the associated buffer~.

Make a buffer larger than the sample it contains

To load a sample into a buffer~ when the sample is shorter than the desired length of the buffer~, use the clear, size, and read messages. You empty and resize the buffer to the size you want, then read in the sound file. For example, you would use this procedure if you wanted to load a three-second sample into a five-second buffer~. The sample will be placed in the first three seconds of buffer space, followed by two seconds of silence.  

Determine the length of a buffer~

This example shows how to retrieve the total duration in ms of a loaded file in a buffer~, using the info~ object. In fact, because the buffer~ object sends a bang out its right outlet whenever it loads in a sound file, you could use that bang to trigger info~, thus automatically obtaining the duration of any sound file you import.