ReWire and Reason

From Cycling '74 Wiki
Revision as of 05:42, 30 November 2012 by ddgcycling74com (Talk | contribs)

Jump to: navigation, search


Existing Material on ReWire

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.


Send MIDI Messages to Reason

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 note-playing patch will look something like this:


In order to virtually "play" any of the Kong's pads, just click on one of the message boxes (numbered 1-16).

Sequencing in Max, Playing in Reason

The next step is to create some way to do an interesting sequencing system in Max. Let's start by making a simple drum matrix sequencer that is run off the transport:


In this case, we have a transport-based timing system that uses a counter to output a step position. This goes into a live.grid object (set to matrix mode), then the output is split apart and sent to our input keys. These keys are used to send the MIDI messages from the previous patch to the Kong drum machine. This creates a basic grid-style drum sequencer that can play back Kong without having to mess around with pad programming.

But why program the grid at all. By watching for the first step of the sequence and randomizing the grid, we can have Max do the hard work for us! In this updated patch, I have a compound message that is activated whenever the first step is seen:


At that first step, the message will clear and randomly place one note in each column. But I also want a four-on-the-floor kick drum, so I'm using the setcell message to force the kick to fire on every downbeat. While this is really simple generative stuff, it also is surprisingly good-sounding. In fact, some of the patterns are so good that I don't want an immediate change to the next pattern, so I placed a switch at the output of the generator to allow me to "hold" a pattern until I'm sick of it.

Here it is as a copy-compressed patch:


Adding a Second Instrument

Jumping back to Reason, I've now added a second instrument: a SubTractor analog-ish synth. When you create a new instrument, it makes a new track in the sequencing area of application:


If you start our grid-based sequencer, you will hear that the MIDI stream is not routed; rather, the MIDI input is used by whichever track is currently selected. This isn't optimal, so we want to find a way to force our sequence to be routed to a chosen instrument. Performing this sort of routing magic will require two things: MIDI routing setup within Reason, and manipulation of the midi message that we are sending to the rewire~ object.

Let's start with the Reason MIDI routing setup. If we go to the top of our instrument rack, our basic Hardware Interface display doesn't even have anything related to MIDI showing. Clicking on the Advanced MIDI will reveal a MIDI router, which is where we do our dirty work.


In this case, the MIDI Interface shows "No MIDI Input" (because I didn't set it up in Reason's preferences), but that doesn't matter - we will access these devices directly. For the first channel, we set the MIDI routing to the Kong 1 Input; for the second channel, we set the MIDI routing to the Subtractor 1 In (make sure you are selecting the In option as opposed to the Mixer connection). Now, within Max, if we can access the MIDI Bus A device, we should be able to send MIDI to the individual devices - either individually or simultaneously.

Next up is the changes to our Max patch. We need to change the contents of our midi message to route the message to the correct MIDI channel of Reason's interface device. Luckily, the changes are pretty simple using a few extra inputs and some message formatting.


We now use the bus number value of the midi message to choose a MIDI bus: #1 is Bus A (in the Reason Advanced MIDI interface), #2 is Bus B, #3 is Bus C and #4 is Bus D. We also have to adjust the MIDI channel by changing the message number (144 in the earlier example) to the range from 144-159; we do this using a "+ 143" after a channel input to set the channel number. Now, if we select a device number of 1 and switch between midi channels 1 and 2, we can switch the MIDI output between the Kong and Subtractor devices.

This is a work in progress...

Adding a Second Sequencer

Modulation of Reason Parameters

Wrapping it Up