Audio in RAM — buffer~ and related objects

Preloading sound into random-access memory (RAM)—as opposed to reading it off of a hard disk—allows you more easily to access any point in the sound file instantaneously, read backwards as well as forwards, access different points in the sound simultaneously, etc. When reading from disk, you usually need to give the computer a tiny bit of advance notice to preload some of the sound into memory before you use it; that why, if you have the RAM available, it often makes most sense just to preload whatever sound you’ll need into memory.

The buffer~ object establishes a named location in RAM in which you can store audio data. You can preload a sound file (or a portion of a sound file) into that buffer~ with the message ‘read’ or ‘replace’. Other MSP objects can then refer to that memory location  by name, and can use the data in various ways.

You can find examples of different ways to use the sound data in a buffer~ in the following examples from previous classes:
Examples 15-21 from winter quarter 2012
Examples 6-13 from spring quarter 2012

The patch below doesn’t really do much of anything, but it gathers together many (not all!) of the objects that can refer to a buffer~. You can Option-click (Alt-click on Windows) on each object to learn more about how it works.

ways to use audio data in a buffer~