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

Using ReWire in Max

Max supports ReWire, a software protocol developed by Propellerheads that allows data transfer and remote control among audio software applications. In addition to being able to route audio between Max and ReWire compatible applications, ReWire supports sending synchronization, transport, and tempo information both to and from Max and the host application.

You can use Max as a ReWire client and route audio from Max into another application (such as Ableton Live or Digital Performer) using ad_rewire, a special audio driver.

You can also use Max as a ReWire mixer using the rewire~ object and route audio to Max from other applications.

You cannot use both the ad_rewire audio driver and the rewire~ object simultaneously; When you try to use them at the same time, you won’t get any audio output because each is waiting for the other: the ad_rewire driver is waiting for the rewire~ object to ask it for an audio stream, but the rewire~ object can't do anything unless given processing time by an audio driver.

You can also use the ad_rewire driver when creating standalone applications.

Using Max as a ReWire client

To use Max as a ReWire client and route audio to another application the Max ad_rewire driver is used.

Enabling the ad_rewire driver

  • Choose Audio Status from the Options menu to show the Audio Status window. Click in the Value column for the Driver setting and choose ad_rewire from the Driver pop-up window. The ReWire driver will be selected, and you will see Max listed as a ReWire device the next time you launch your host application.

With ad_rewire selected as the audio driver for Max, there are three MSP objects you can use to provide this information and to control the host’s transport:

  • The hostcontrol~ object allows you to send commands to the ReWire host to start and stop the transport, set the transport position, change the tempo, change the time signature, and set loop points.
  • The hostphasor~ object will output a beat-synchronized ramp (like the phasor~ object) when the host's transport is playing,. You can use this ramp output to drive your synthesizer in a beat-synchronous fashion or to trigger events on the beat.
  • The hostsync~ object provides synchronization, transport, and tempo information about the current state of the ReWire host.

Connecting from Max to a host application using ReWire

  • If you have not already done so, enable the ad_rewire driver as described above.
  • Start the application you want to send Max audio output to.
  • Create a channel in the host application to accept input from Max
  • Open your Max patch and turn on the DSP

Hosting a ReWire client

The rewire~ object is used when Max is used as a ReWire host, routing audio from other host applications to Max. The rewire~ object allows you to select a ReWire client, use the available audio outputs, send and receive MIDI messages and control the connected device’s transport controls.

Creating a connection from a ReWire client to Max

  • Add a rewire~ object to your Max patch, connect the second outlet from the right to a umenu object, and add a second connection from the middle outlet of the umenu object to the rewire~ object. You will also need to add a button or loadbang object to send a bang message to the rewire~ object to populate the menu.

  • Close the patch and click on the button. The umenu will be automatically populated with a listing of all available ReWire clients which can send audio to Max. Click on the umenu and select the client you want from the pop-up menu. You will see the message rewire~: opened device XXX in the Max Console.


Routing ReWire client audio outputs to Max outputs

  • Connect the rightmost outlet of the rewire~ object in your Max patch to each of a pair of umenu and message box objects which are connected back to the rewire~ object.

  • Close the patch and click on the button. The umenu objects will be automatically populated with a listing of all the ReWire audio outputs from the client application. Click on both umenu objects and select the clients you want from the pop-up menu.
  • Clicking on a umenu selection will send the message map 1|2 <client output> to the rewire~ object, routing the audio from the client application to the rewire~ object’s audio outlets for use in your Max patch.

In addition to routing audio from other applications through Max, the rewire~ object also lets you control the transport mechanism of any client application to which it is connected, and to send and receive MIDI messages. See the rewire~ help file and the rewire~ object Reference page for more information.

ReWire and MIDI

Rewire 2 also supports MIDI communication to and from ReWire Devices. Currently both the rewire~ object and the ad_rewire~ driver support MIDI, although they work in different ways.

When you use the ad_rewire driver, Max MIDI ports are automatically created so you can use the standard Max MIDI objects to send and receive MIDI. After you choose the ad_rewire driver in the Audio Status Window, MIDI ports will appear in the MIDI Setup window the next time it is opened.

Using MIDI with the ad_rewire driver

By default, the ad_rewire driver has two MIDI input channels and two MIDI output channels available for your use.

Setting up MIDI ports with the ad_rewire driver

  • If you have not already done so, enable the ad_rewire driver as described above. Add a midiin object to your Max patch and Command-double-click (Macintosh) or Alt-double-click (Windows) on the midiin object to show the MIDI sources pop-up menu. The ReWire MIDI ports will be shown and you can choose them.

You can use the same procedure to set up an output port using the midiout object.


Adding MIDI ports to ReWire

  • Choose Audio Status from the Options menu to show the Audio Status window. Double-click in the Value column for the Input Channels or Output Channels setting in the Audio Status window to get a text cursor, Type in the number of input or output channels you want followed by a carriage return. The new values will appear in the Value column, and the new number of MIDI input or output channels will be available via Max MIDI objects.

Using MIDI with the rewire~ object

When you use Max as a ReWire host using the rewire~ object, MIDI messages are automatically sent and received using the rewire~ object—it includes a dedicated outlet for MIDI messages, and you can use the midi message to the rewire~ object to send MIDI data to the ReWire clients. For more information about the format that the rewire~ object understands, see the rewire~ object Help file or the rewire~ object Reference page.

See Also

Name Description
Sharing Max Patchers Sharing Max Patchers
Using Max with other applications Using Max with other applications
MIDI MIDI