ReWire and Reason
Using Max with Reason
In the ReWire Essentials tutorials (linked above), we used Max as both a mixer (hosting application) and "device" (controlled application). These are the two sides of the ReWire connectivity equation, and Max can work equally in both modes. In order to dive into ReWire at a deeper level, let's look at a connection to one of the most-used ReWire packages there is: Propellerheads Reason.
In order to have the most fun with our Max/Reason combination, we are going to do some sequencing and audio processing in Max, and use Reason as a synth/sampling and mixing device. What we *won't* do is run the Reason sequencer or use its recording capabilities. In this way, we'll get to do goofy and interesting Max sequencing and processing (something Max is really good at...), and let Reason handle the synthesis (something Reason is damned good at).
Let's start by creating a very basic connection between Max and Reason. Here's the patch that I created:
Unlike what you see in most of the ReWire help files, I'm using the rewire~ object with a named device. This allows me to state explicitly that this is a connection to Reason, and I don't have to mess around with application selection or other confusing UI elements. I connect the outputs of the rewire~ object to an audio chain (live.gain and ezdac~), and I create two message for the input: "openpanel" and "closepanel".
Different ReWire clients work differently, and even the same application not work the same on Windows vs. Mac. In my case (Max OS X, Reason 6.5), clicking on the "openpanel" message will actually launch the Reason application in ReWire client mode, and will be completely active with no other interaction. If I create a Reason instrument (Kong, in this case), I can play that instrument and receive the audio within my Max patch.
The next thing we want to do is to fire notes into the Kong instrument using MIDI messages from Max. To do this, we have to send a specially formatted message into the rewire~ object. The format of the message is:
midi <timestamp> <bus number> <MIDI message> <note value> <velocity value>
Since we don't care about sequence timing or routing, our timestamp and bus number are always 0. Since we are sending notes, our MIDI message is always 144. The note number and velocity information is created by a makenote object, which will take our incoming note information and turn in to MIDI note pairs (noteon and noteoff messages).
The basic patch will look something like this: