Use the buffer~ object as a buffer of memory in which samples are stored to be saved, edited, or referenced.
The buffer~ object is used in conjunction with many different objects, including play~ / groove~ (plays the buffer), record~ (records into the buffer), info~ (reports information about the buffer), peek~ (writes into/reads from the buffer like the table object), lookup~ (uses the buffer for waveshaping), cycle~ (specifies a 512-point waveform), and wave~ (specifies a waveform).
After the optional filename argument, a duration may be provided, in milliseconds, to set the size of the buffer~, which limits the amount of sound that will be stored in it. (A new duration can be specified as part of a message, however.) If no duration is typed in, the buffer~ has no sample memory. It does not, however, limit the size of an audio file that can be read in.
After the duration, an additional argument may be typed in to specify the number of audio channels to be stored in the buffer~. (This is to tell buffer~ how much memory to allocate initially; however, if an audio file with more channels is read in, buffer~ will allocate more memory for the additional channels.) buffer~ may have an arbitrary number of channels, only limited by the amount of RAM available. By default, buffer~ has one channel.
The length of the buffer~ expressed in samples.
The length of the buffer~ expressed in milliseconds.
Common Box Attributes
Sets the text that will be displayed in the Clue window when the user moves the mouse over the object.
background [int] (default: 0)
Adds or removes the object from the patcher's background layer.adds the object to the background layer, removes it. Objects in the background layer are shown behind all objects in the default foreground layer.
color [4 floats]
Sets the color for the object box outline.
Sets the type style used by the object. The options are:
0 = 'regular'
1 = 'bold'
2 = 'italic'
3 = 'bold italic'
Sets the object's font.
Sets the object's font size (in points).
hidden [int] (default: 0)
Toggles whether an object is hidden when the patcher is locked.
Sets the text that will be displayed in as a pop-up hint when the user moves the mouse over the object in a locked patcher.
ignoreclick [int] (default: 0)
Toggles whether an object ignores mouse clicks in a locked patcher.
patching_rect [4 floats] (default: 0. 0. 100. 0.)
Sets the position and size of the object in the patcher window.
position [2 floats]
Sets the object's x and y position in both patching and presentation modes (if the object belongs to its patcher's presentation), leaving its size unchanged.
presentation [int] (default: 0)
Sets whether an object belongs to the patcher's presentation.
presentation_rect [4 floats] (default: 0. 0. 0. 0.)
Sets the x and y position and width and height of the object in the patcher's presentation, leaving its patching position unchanged.
rect [4 floats]
Sets the x and y position and width and height of the object in both patching and presentation modes (if the object belongs to its patcher's presentation).
size [2 floats]
Sets the object's width and height in both patching and presentation modes (if the object belongs to its patcher's presentation), leaving its position unchanged.
Sets the color for the object's text in RGBA format.
Sets the justification for the object's text.
0 = 'left'
1 = 'center'
2 = 'right'
The word , followed by a single symbol that designates a windowing function, will apply that function to the current contents of the buffer~. Supported functions include triangle, hamming, hanning, blackman, welch, and kaiser. An additional second symbol argument of (e.g. ) will calculate the function and apply only the second half to the whole buffer~.
Note: The kaiser function requires a second floating point argument that specifies the beta parameter and precedes an optional argument (e.g. ).
The word , followed by the word and a floating-point number that specifies a gain value, will scale every sample by the gain coefficient. and a floating-point number that specifies a constant value that will be added to every sample in the buffer~.
The word , followed by the word , will replace every sample value with the a new value representing the difference from the previous sample.
- Apple Interchange File Format (default)
The word , followed by a single floating-point number, will set every sample in the buffer~ to that value.
The word , followed by a symbol that designates a function, will fill the buffer~ with one cycle of that function. Supported functions include sin (sine), cos, (cosine), and sinc. An optional second argument (e.g. ) can be used to define the number of cycles of the function used to fill the buffer~. An additional optional third argument defines a rational number of cycles with which to fill the buffer~ (e.g. will fill a buffer~ with a quarter cycle of the cosine function).
Note: the sinc function requires two arguments that specify the number of zero crossings and an additional flag that toggles starting the function at zero (e.g. ).
Numerical values are:
8 - 8-bit integer
16 - 16-bit integer
24 - 24-bit integer
32 - 32-bit integer
Symbol values used to set bit-depth or sample type are:
int8 - 8-bit integer
int16 - 16-bit integer
int24 - 24-bit integer
int32 - 32-bit integer
float32 - 32-bit floating-point
float64 - 64-bit floating-point
mulaw - 8-bit mu-law encoding
alaw - 8-bit a-law encoding
The buffer~ object uses QuickTime to convert a media file (including MP3 files) into the sample memory of a buffer~, and requires that QuickTime be installed on your system. If you are using Max on Windows, we recommend that you install QuickTime and choose a complete install of all optional components.
Since the message uses QuickTime, which specifies units of time for all files as 1/600 of a second rather than milliseconds, importing is not guaranteed to start at the specified offset with millisecond accuracy.
The starting time may be followed by a second argument - a floating point value that specifies the duration of sound, in milliseconds, to be read into buffer~. This duration overrides the current size of the object's sample memory. If the duration is specified by a negative value, buffer~ reads in the entire file and resizes its sample memory and adjusts the number of channels in the file accordingly.
The duration may be followed by a third argument that specifies the number of channels to be read in. If the number of channels is not specified (i.e., if the message includes only offset and duration information), buffer~ reads in the number of channels indicated in the header of the audio file.
If only two arguments are specified, buffer~ imports the number of channels indicated in the header of the audio file. If three arguments are specified, buffer~ imports the number of channels specified by the third argument. If the third argument is 0, buffer~ imports the number of channels indicated in the header of the audio file.
The starting time may be followed by a second argument - a floating point value that specifies the duration of sound, in milliseconds, to be read into buffer~. This duration does not override the current size of the object's sample memory. It clears the current buffer~ data, then fills the requested amount at the beginning of the buffer~. However, if the duration is specified by a negative value, buffer~ reads in the entire file and resizes its sample memory.
The duration may be followed by a third integer argument that specifies the number of channels to be read in.
If only two arguments are specified, buffer~ reads in only the number of channels that the buffer~ currently has. If the audio file has more channels than the buffer~ currently has, the audio from all channels will be summed. If three arguments are specified, buffer~ reads the number of channels specified by the third argument. If the third argument is 0, buffer~ reads in the number of channels indicated in the header of the audio file.
The following types of sample data are supported:
- 8-bit integer
- 16-bit integer
- 24-bit integer
- 32-bit integer
- 32-bit floating-point
- 64-bit floating-point
- 8-bit "mu"-law encoding
- 8-bit a-law encoding
|Working with Video in Jitter||Working with Video in Jitter|
|buffir~||buffer-based FIR filter|
|groove~||Variable-rate looping sample playback|
|info~||Report information about a sample|
|lookup~||Transfer function lookup table|
|peek~||Read and write sample values|
|play~||Position-based sample playback|
|poke~||Write sample values to a buffer by index|
|polybuffer~||Manage multiple buffer~ objects|
|record~||Record sound into a buffer|
|sfplay~||Play audio file from disk|
|sfrecord~||Record to audio file on disk|
|stretch~||Ztx-based pitch/time modification of an audio buffer|
|wave~||Variable size wavetable|
|MSP Basics Tutorial 3: Wavetable Oscillator||MSP Basics Tutorial 3: Wavetable Oscillator|
|Sampling Tutorial 5: Waveshaping||Sampling Tutorial 5: Waveshaping|
|MSP Sampling Tutorial 1: Recording and Playback||MSP Sampling Tutorial 1: Recording and Playback|
|MSP Sampling Tutorial 3: Playback with Loops||MSP Sampling Tutorial 3: Playback with Loops|
|MSP Sampling Tutorial 4: Variable-length Wavetable||MSP Sampling Tutorial 4: Variable-length Wavetable|
|MSP MIDI Tutorial 3: MIDI Sampler||MSP MIDI Tutorial 3: MIDI Sampler|
|MSP Analysis Tutorial 3: Using the FFT||MSP Analysis Tutorial 3: Using the FFT|