(max) playing audio from memory, buffer~, groove~

example video and patcher

buffer~

To play sound from memory (RAM) instead of the hard drive, you have to create a space for it in memory. You use the [buffer~] object for that purpose, defining a name for the buffer, length, and number of channels. Other objects that access the buffer~ for playback or other manipulations will use the buffer name to make a logical connection.

groove~

[groove~] allows for ratio-based playback of audio from a buffer~, with looping and continuously variable speed control. Some things to keep in mind:

  • playback ratio has to be sent as a signal to groove~. The usual method is either a float sent to sig~, or a [number~] in signal output mode. Unity playback is 1. You can also reverse audio with negative ratios.
  • The default mode is that playback speed (ratio) affects pitch.
  • if no loop points are sent to groove~, the entire buffer will be looped.
  • a float sent to the left inlet sets the time of the playback head. You have to set the playback head before initial playback, as well as after reaching the end of the buffer if looping is not enabled.

new features in version 7

Like playback from disk, version 7 of Max allows you to change playback speed independently of pitch, and vice versa. All of these messages/attributes work the same as they do with [sfplay~].