logo_jazz jp


maxstepA

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



maxstepA_what

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.



maxstepA_interface


To create the sequence (row) of data with the Lemur we'll use an interface containing a MultiSlider (with 16 sliders) and a group of Switches. The MultiSlider will tell our Max patch (don't worry, we'll get to it soon) what note each step should play. The Switches will tell Max what velocity to use for each note. To complement the MultiSlider, we'll use a bank of nine Switches to be able to switch octaves and reach a wider range of notes than would be practical to handle with the MultiSlider on its own.

To finish our Lemur interface we'll need a lemur menu containing four items (1/4, 1/8, 1/16 and 1/16) to tell the timing engine within Max, how often to advance to the next step of our sequence.

  • Notes MultiSlider

    Create a MultiSlider with the following properties and behavior:

  • multislider

    multislider

    Now create your own User-defined variable within the MultiSlider, name it notes and define it with the following expression:


    multislider
    multislider
    multislider
    multislider


  • Accent/velocity switches

    Create a bank of Switches named velocity with the following properties and OSC settings:

  • Accent

    Accent

    Notice how the output is scaled to 65-120. This lets the Lemur handle accent settings and sending a list of velocities that are instantly transferable to midi messages. 65 for a normal note and 120 for an accented one.


  • Octave Switches

    Create a bank of Switches with the following properties:

  • Octave

    Then create a User-defined variable within the object, name it octave and define it as follows:

    Octave
    Octave
    Octave
    Octave


  • LemurMenu for grid division

    Create a LemurMenu object with the following properties:

  • LemurMenu

    Make sure you set the project OSC target to Osc 0.

    Now our interface is complete and should look something like this. It's quite dull now, but you can spice it up later at your own will!


    interface



maxstepA_patch



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.

    Max

    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.

    Max

    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.

    Max

    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.

    Max

    In the Max menu Options, choose DSP Status and select the ad_rewire driver.

    Max

    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 !

    Max

    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



    Max

    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.

    Max

    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.

    Max

    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.

    Max

    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.

    Max

    Then create a MIDI track and drag an instrument onto it.

    Max

    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.


  • Credits

    Mikaël Björk - www.lofimassakhah.net


Download this example
Go back to workshops


© Copyright JazzMutant 2014 04-23-2014