Sample Accurate Messages

When Overdrive and Scheduler in Audio Interrupt are enabled, certain signal-rate objects can handle high-priority events without losing timing accuracy. In other words, these objects are sample-accurate when handling high-priority events.

As a reminder, high-priority or scheduled events come from MIDI objects, or from timing releted objects like metro, pipe, and delay. Most other objects generate low-priority events, including UI events like clicking on a button or dragging a slider.

Low-priority events never have any timing information to begin with, so it doesn't make sense to talk about handling them with sample accuracy.

Sample-accurate Events to Audio

With Scheduler in Audio Interrupt enabled, Max handles a chunk of message events before processing each signal vector. For example, when the signal vector size is 256 samples, the scheduler will handle all events scheduled within the next 5.8 milliseconds (equivalent to 256 samples at 44.1 kHz) before Max processes each signal vector.

This is what makes sample-accurate events possible. With SIAI on, signal-rate objects can handle high-priority events at the appropriate time within each audio processing block. As an example, consider a sig~ receiving the messages 0., 0.3, and 0.6. When SIAI is disabled, sig~ can only handle these messages once per audio block, which destroys the original timing information. With SIAI enabled, precise timing information is preserved, even when converting from message-rate to signal-rate.

On the left, Scheduler in Audio Interrupt is disabled, and sig~ must collapse together all the events received during the same audio block. On the right, SIAI is enabled, and sig~ can preserve timing information.

Objects that convert scheduled events to sample-accurate singals

  • sig~ will convert events to audio signals sample-accurately
  • click~ will start an impulse sample-accurately when it receives a scheduled bang
  • line~ and curve~ will start a function sample-accurately
  • vst~ receives MIDI events sample-accurately

Signals to Sample-accurate Events

Signal-rate objects that output events can generate sample-accurate, scheduled events when Scheduler in Audio Interrupt is enabled. For example, a snapshot~ object will output the value of an incoming signal at a specified rate. When SIAI is disabled, snapshot~ can only use the first audio sample in each signal vector, and the effective resolution is limited by the signal vector size. With SIAI enabled, snapshot~ can generate multiple events per signal vector, and those events maintain precise timing information.

With Scheduler in Audio Interrupt enabled, scheduled events are handled before each audio vector is processed. So, events generated by snapshot~ are always delayed by exactly one signal vector. However, their relative timing information is still preserved accurately.

On the left, SIAI is disabled, and snapshot~ and sig~ lose all of the information in the original signal. On the right, with SIAI enabled, snapshot~ and sig~ can actually work together to accurately downsample the signal.

Signal objects that support sample-accurate events

  • snapshot~ will sample incoming audio and generate events sample-accurately
  • peakamp~ will record peaks in the incoming signal and generate events sample-accurately
  • edge~ outputs the zero-to-non-zero signal transitions sample-accurately
  • line~ and curve~ output their "done" bang event sample-accurately
  • spike~ outputs the time between audio events sample-accurately
  • what~ outputs detected signal values sample-accurately
  • subdiv~ outputs step values sample-accurately