this tutorial walks you trough the various steps involved in the creation of a basic step sequencer unit in max 5, controlled from the Lemur and connected to ableton live as a rewire client
In this context a step sequencer is a row of data fed to a virtual instrument at a specific rate. Each step of the row contains two values - one for pitch and one for velocity. In order to feed this data to our instrument, we'll need a timing engine to keep track of the current step within the row is and how often to switch to the next step.
In this project Cycling 74's Max 5 will handle all data, timing and midi information going to our software synth. The Lemur interface is just (and only) that - a graphical user interface for the actual sequencing program in Max.
- Virtual MIDI cables
Before we dig into the Max patch well need to set up a virtual MIDI cable to enable MIDI communication between Max and the software synth. On OSX, we recommend using the built in IAC drivers available within Utilities / Audio-Midi settings. Set up one port and call it something like "plain midi". On Windows you can use the free utility MidiYoke (www.midiox.com).
- Making contact
For this tutorial we're going to use Ableton Live as our Rewire and soft synth host. If you don't own it you can download a demo from www.ableton.com.
For Rewire sync to work it's important that Live is loaded before Max - so start the application, don't worry about the synths just yet. We'll get there.
Once you have Live loaded, open Max and the patch step_seq_tutorial.maxpat. First we'll have a look at the components assuring communication between our three players: Lemur, Max and Live. I recommend you switch frequently between the patch in Max and this tutorial. Whenever you need more information on something - right click an object within the Max patch and bring up the help files.
The two textedit objects (number fields) expect you to type the IP address of your Lemur and the port you use for OSC communication. These two strings gets fed into the lemur_com sub patch. Cmd/ctrl-click the sub patch to look inside it.
The two inlets make sure your IP address and port number are sent to the udpsend and udpreceive objects. Anytime we use s to_lemur or r from_lemur we send data to this sub patch or receive data from it and make communication to and from the Lemur possible.
When the patch is loaded the midiinfo object sees to that the umenu is filled with the physical and virtual MIDI ports available on your system. Then send the chosen (in our case plain midi) one to the noteout object within the sequencer sub patch.
In the Max menu Options, choose DSP Status and select the ad_rewire driver.
Tick the toggle to turn audio on. The audio engine within Max needs to be on to enable Rewire timing and sync with Live.
- Tick tock, you don't stop !
Within the tik_tok sub patch we will use the hostsync~ object to extract timing information from Live. The 7th outlet will output ticks from song start. We'll use some clever math to convert this information to a simple counter going from 0 to 15 in different tempi. If you press play in Live, you'll se how the integer boxes start counting.
By multiplying the output (which goes between whole numbers in a quarter note) by one - we get the amount of quarter notes passed since song start. The modulo operand takes two numbers, divides one by the other (16 in our case) and outputs the remainder of the division. The change object passes data only when it changes to make sure we don't clog up the data streams with unnecessary information being sent back and forth. Lastly we use the send object to send this counter to any receive object setup to welcome 4n data.
This process is repeated with different multipliers within this sub patch to cater for eighth, sixteenth and thirty-second notes being sent to the sequencer.
- The heart of the sequencer
The first thing that happens within the sequencer is the data from the Lemur being taken care of. The route object sorts out the relevant data from the OSC stream, 1) passes note and velocity data to message boxes and 2) passes octave data onto a multiplier object further down in the patch.
The zl lookup object together with the output from the ticks_coming_through sub patch (explained in a bit) extracts the current note and velocity values and passes them to the makenote and then noteout object. To make certain only notes within the note range is let through, we use the split object. The octave data is multiplied by 12 (to make semi tones) and then added to the current note value.
Within the ticks_coming_through sub patch the output from the LemurMenu is controlling a Switch object, deciding which inlet is let through. The different counters from the tik_tok sub patch are all fed to the Switch object, but only one can be passed on to the sequencer (through the outlet). The counter passed on is also sent to the metro_color sub patch via the s color_tick object.
- Blinking lights
To give a visual indication on the Lemur what step is playing, we're using the fabulous multicolor property of the MultiSlider. Nicely controlled from Max via OSC.
This sub patch (metro_color) builds upon the magic of Nicholas Bougaieff's lightmono object (see User Area) but uses colors instead of light properties. The current step is received top left and a list is compiled using RGB codes for red and grey. A list of 16 is assembled and sent to the colors attribute of the MultiSlider.
- Getting sound
In Live, go to Preferences and the MIDI/sync tab. Make certain your virtual midi port is set to track.
Then create a MIDI track and drag an instrument onto it.
Choose the virtual MIDI cable as your input and set the track monitor to in. Now press play in Live and the sequencer lights on your lemur should start flashing a beautifully, deep red. Make some noise.
- What now ?
Play around. Mess up. Change. Construct and de-construct. Share what you discover, and most importantly: have fun.
Mikaël Björk - www.lofimassakhah.net