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

data Reference

A data buffer for holding audio (or potentially some other) data.

data

Examples

Arguments

name [symbol]

The first argument of buffer~ (and data) is required and is the name that other objects use to access the stored buffer data. A buffer~ with the same name in a rnbo~ object and a parent Max patcher can share data in either direction, whereas a data object cannot.

samples [number]

Optional

Set the size of the buffer in samples.The actual duration of the buffer is determined by the number of samples and the sample rate. (cr) It is important to note that large buffers can take time to allocate and may interrupt audio processing, so it is best not to use arbitrarily large buffers.

size [number]

Optional

Set the size of the buffer in samples.The actual duration of the buffer is determined by the number of samples and the sample rate. (cr) It is important to note that large buffers can take time to allocate and may interrupt audio processing, so it is best not to use arbitrarily large buffers.

channels [number]

Optional

Set the number of channels for the data buffer. Requires that the size be set. If buffer is referencing an external source using the file attribute, the number of channels is automatically determined by the source file."

samplerate [number]

Optional

Sets the sample rate for the buffer object (default = 44100). This can be set independently from the sample rate of the audio driver and other buffer objects.

Inlets

info [bang]

Sending a bang into the object's inlet will output the buffer data to the corresponding outlets. The reported data is the size of the buffer in samples, the number of channels, and the sample rate of the currently loaded buffer.

Outlets

sizeout [number]

The left outlet reports the total size of the buffer in samples whenever the buffer is instantiated, modified, or receives a bang. The actual duration of the buffer is determined by the number of samples and the sample rate.

chanout [number]

The middle outlet reports the current number of channels of the buffer whenever the buffer is instantiated, modified, or receives a bang *. _Needs a way to jump to the bang entry of the ref doc.

srout [number]

The right outlet reports the sample size of the buffer whenever the buffer is instantiated, modified, or receives a bang.

Fixed Attributes

These attributes must be set in the object box and determine the behavior of the object at runtime.

external [bool]

A buffer set to external (default = 1) will be addressable/fillable from outside the rnbo code. A buffer~ is always set to external. The data object supports @external 0, which hides the buffer from the external world. Note that any data object that uses the @file or @url attribute will automatically be set to @external 1.

file [symbol]

A valid URL of an audio file to load into the buffer. Loading a file will automatically set the size, channel count and sample rate based on the values of the associated file.

fill [symbol]

Allows you to fill a buffer using a constant or a simple function of x, where x is a value ranging from 0 to 1 over the length of the buffer. i.e., @fill .5 will set all values to .5; @fill sin(x*2*pi-1) creates a sin wave that goes between -1 and 1. Requires a fixed size .

name [symbol]

The first argument of buffer~ (and data) is required and is the name that other objects use to access the stored buffer data. A buffer~ with the same name in a rnbo~ object and a parent Max patcher can share data in either direction, whereas a data object cannot.

samplerate [number] (default: 0)

Sets the sample rate for the buffer object (default = 44100). This can be set independently from the sample rate of the audio driver and other buffer objects.

type [symbol]

Sets the data type of the buffer to float32 (default for buffer~) or float64 (default for data).

Dynamic Attributes

These attributes can be modified in the code during execution using the set object

channels [number] (default: 1)

Set the number of channels for the data buffer. Requires that the size be set. If buffer is referencing an external source using the file attribute, the number of channels is automatically determined by the source file."

clear [bang]

Clear the contents of the buffer

info [bang]

Sending a bang into the object's inlet will output the buffer data to the corresponding outlets. The reported data is the size of the buffer in samples, the number of channels, and the sample rate of the currently loaded buffer.

normalize [number] (default: 0.995)

Set the desired peak value, then find the maximum value in the buffer and normalize to that value.

size [number] (default: 0)

Set the size of the buffer in samples.The actual duration of the buffer is determined by the number of samples and the sample rate. (cr) It is important to note that large buffers can take time to allocate and may interrupt audio processing, so it is best not to use arbitrarily large buffers.

sizems [number] (default: 0)

Set the size of the data buffer in milliseconds. The total number of samples is determined by the samplerate. It is important to note that large buffers can take time to allocate and may interrupt audio processing, so it is best not to use arbitrarily large buffers.

See Also

Name Description
buffer~ Store audio samples
groove~ Variable-rate looping sample playback
buffer
groove~ Variable-rate looping sample playback of a sized buffer
peek Read values from a buffer object.
poke Write a sample into an audio buffer.