(maxmsp) MIDI, metro, and table

The example patcher from Wednesday is uploaded (cleaned up a little bit). Here are some notes about it.

Basic MIDI note input and output

First, the patcher has a toggle/gate added so that MIDI input isn’t always passed to the Apple Synth (or anything else). The red box is a toggle to turn MIDI note output for this part of the patcher on. You’ll see the button light up at the bottom of the section if notes are being passed to the output. You can ignore the grayed out area and imagine that the outputs of the number boxes are going directly to the noteout object. Be sure to turn it off when you work with the other patchers.

Play Random Notes with Adjustable Duration and Velocity

The random object with an argument of 128 will randomly play all 128 possible MIDI notes. You can adjust the time of the metro with the integer box input, and you can control velocity of the notes with either the slider or a MIDI controller Mod Wheel. The makenote object accepts (from right-to-left) arguments for duration and velocity. It’s inlets (also right-to-left) accept duration, velocity, and note number. Note number triggers makenote to generate a noteon message, followed by a noteoff message after the appropriate duration. At a minimum, note number and velocity output need to be connected to noteout.

Play Notes from a Chord, in Random Order and Transposed Based on MIDI Note Input

The table object is new. Double-click the object in a locked patcher to open (or CMD-double-click in an unlocked patcher). Values (y) are stored at memory locations (x). The random object is now sending memory locations (0 – 4, 5 total) to the table, and the table sends y values (in this case, Dom9 chord tones) accordingly. You can drag values around in the table to change to chord into anything. If you go beyond 5 chord tones you will need to increase the range of the random object to correspond. The y output of the table gets added to a MIDI note that you play from a controller. If you play nothing, middle C will be used. You should know that if you played anything using the first part of the patcher (the basic input), it will also get sent to this add object. Unless specified, notein objects are always listening for input.

Select the table object and open it’s Inspector. (There are many ways to do this. The quickest is to control-click on the object and choose Inspector from the popup menu.) You’ll notice that you can set the object to save the table data with your patcher (turned on), and you can set the range of the table (y values) and the size of the table (x values). Close the inspector window when you’re done.

Right below the notein object is a stripnote object. Stripnote looks at the note number and velocity, and only passes through noteon messages (note numbers accompanied by non-zero velocities). It “strips,” or blocks noteoff messages. The purpose of stripnote is to block noteoff messages from creating extra data for your patcher.

To work, you have to connect note number and velocity from a notein object to stripnote. Without a velocity connection all notes will have zero velocity and nothing will get through. Not connecting the velocity inlet is one of the most common mistakes when using stripnote.

Choose Between Playing Chord Tones in Random Order, Ascending Order, or Descending Order

The new additions to this patcher are a gswitch2 object (graphic switch with 2 outputs) and a counter object. You can switch outputs (which you will see graphically) by clicking on the gswitch2 or by clicking the toggle that goes in its left inlet. Its right inlet has the data to pass through, and the left inlet controls the output destination (the left inlet still makes the object “do its thing”). The counter is mostly self explanatory. The toggle can switch the direction of the counter (0 = up; 1 = down). The counter counts any event in its left inlet, and outputs the current count.

“Steve Reich Phase Generator”

This last patcher is cleaned up from class. It takes the counter output and splits it in two. One output passes directly to the table object, and the other output goes to an addition object for offsetting the count (the phase of the pattern). The output of the add object goes to a modulo object (%), which divides the input by the argument and outputs the remainder. It keeps the output between 0 and 1-less-than-the-argument (or right-inlet input).

The problem with the class patcher was that I used two counters, and I didn’t bother to synchronize their starting counts when I added the second. Using and add offset keeps the two iterations of the pattern in synchronization.

You can experiment with the table values and the number of notes in the pattern, and of course the offset. Reich’s phase pieces work by having two instruments play the same pattern. After a number of repetitions, one of the performers shifts their pattern relative to the other performer, creating a “phase” difference, or phasing. With each change in note offset you get a different combination pattern.

Happy Max’ing!


Comments

Leave a Reply