Max & MIDI (I)

This week we started working with MIDI in the Max environment.

We discussed the different semantics of a MIDI note message vs a musical note (as we know it from standard Western music notation). While the former is a discrete instruction, the latter has a duration and is commonly embedded in a harmonic and metric context, i.e. it has a musical meaning. In MIDI, for example, the note number 61 would not specify whether this is a C sharp or a D flat. Likewise, in MIDI there is no information whether a note is a grace note, an ornament, is grouped as a tuplet, etc.

A very good overview/introduction is given in this primer by Peter Elsea.

In the programming part of the class we specifically looked at:

  • getting MIDI in and out of Max [midiin, midiout]
  • parsing and formatting of raw MIDI byte messages [midiparse, midi format]
  • the use of specific Max objects for specific MIDI events [notein, noteout, ctlin, etc.]
  • generation and manipulation of MIDI notes (e.g. transposition, canons, etc.)

We also looked at different possibilities for generating and triggering MIDI messages in Max using timing objects (such as [metro]) and user interfaces (such as [kslider, nslider], etc.). We also learned how to control timing (using [delay, pipe]) and route messages to different destinations, e.g. using [gate, route]. Please also have a look at the [route] object and its use in conjunction with [prepend]/[append].

We then implemented a real-world musical example: the Regola dell’Ottava, a baroque harmonization pattern for figured bass.

As we needed to be able to store and access data more flexibly and efficiently, we introduced a number of data-structures in Max, such as the [table]-object (array) and the [coll]-object (hash-table). I recommend taking a closer look at the [coll] object, a good start would be for example Tutorial 18.

NB: In addition to storing the [table]/[coll]’s data in a file (referenced by its first argument), it can also be stored as part of the patcher it is contained in: To do this, open the object inspector, click on the Basic tab (top) and check the box next to “Save Data With Patcher” (bottom) as in the picture below.


You can download the patches from last class in the Download section.

We also looked and discussed the probably first piece which uses MIDI to create an interactive “invisible” accompanist on an acoustic piano, a “duo” for a single pianist: J.C. Risset’s “Duo pour une pianiste”.

You can find texts on this in the Reading list.

We also looked at a performance:

And listened to a conference talk by J.C. Risset, explaining the concepts:

As the assignment for next week I would like you to program a simple MIDI-based performance patch in which you use subpatchers (‘MIDI modules’) to manipulate incoming MIDI-note data in various ways, similar to the examples we studied together in class. You can find a description of the assignment on myCourses. I’v also included a template in the patches which should help you getting started.

One part of this assignment involves the implementation of one of J.C. Risset’s transformations used in “Trois études en duo”, which are described here. J.C. Risset’s wrote an articled describing the making of this piece titled “Real-time performance and interaction with a computer-controlled acoustic piano” published in Computer Music Journal 1996 (issue 20, no.1). It can be found in the Download section.