Exercise 1

Exercise 1: Generative Music in Max

As an introduction to Max, we’ll work on a particular type of music-making “machine”: the generative patch. Turn it on, and the patch will generate a stream of notes on its own.


Our Max adventure begins with learning these basic concepts:

  • generation of timed pulses;
  • random and sequential selection of pitches from an ordered collection of pitches, in response to the timed pulses; and
  • playing the notes on the computer’s built-in MIDI synthesizer.

Aesthetic Background

Generative music is a term coined by British producer, Brian Eno, to describe music that is constructed by a system designed to yield continually varying and evolving content, usually generated by computer. This might be as simple as using a pseudorandom number generator to create a sequence of chords, or as complex as the style-modeling AI software developed by David Cope, whose system, Experiments in Musical Intelligence (EMI), was capable of creating somewhat plausible simulations of pieces in various styles of European art music, such as this “Bach” invention (more background).

We won’t be simulating musical styles, but you will discover what it’s like to turn over some of your decision-making — a product of your musical intellect and intuition — to software that you design and whose behaviors you can influence. One of the benefits of doing this is to discover sounds and textures that you might not encounter while making music in your normal way.

This example of Eno’s generative music iPhone app, Reflection gives you a good idea of how ambient generative music can sound.

This instructional video gives you a good basic introduction to some processes of making generative music — not using Max, but Ableton Live and Eurorack analog synthesizer modules.

Part of the generative process is abandoning, at least temporarily, the timeline-oriented way of making music that was a large part of our work last semester with fixed-media composition. Working without a timeline (or score) can make you think about your music in a new and liberating way.

What is Max?

Max is a graphical programming environment for time-based media. Originally designed to work with MIDI data, the capabilities of Max have grown to encompass audio and video. These three aspects of the environment have names: Max (for MIDI and other control messages), MSP (for audio signal processing), and Jitter (for video). Max is in wide use not only by musicians, but also by visual and multimedia artists. See the Cycling '74 web site for examples.

Max was designed at IRCAM in the late 1980’s by Miller Puckette, a musician and computer scientist now a professor at the University of California, San Diego. The program is named after Max Mathews, an important early computer music researcher. Eventually the program was further developed by Cycling '74, under the direction of David Zicarelli. Cycling '74 was bought in 2018 by Ableton, who for years have facilitated the incorporation of Max code into their Live sequencer, via Max for Live. (Some of the original features of Live were prototyped in Max before the 2001 release of the first version.)

How To Do This Exercise

Working on the assignment is a two-stage process.

  1. Download Exercise 1 Max Tips. This is a folder of Max patches that will give you enough of an introduction to make the patch described below. Open them in Max in order (part 1, then part 2, etc.), reading the comments and operating the patches.

    You will learn the program faster if you add objects and patch cords to these patches, according to the suggestions contained therein. (These begin with a bullet ('•') and are printed in blue.)

    One of the best ways to learn is to simply recreate patches, or parts of patches, in a new patch window. Although you’re just copying someone else’s work, creating and connecting the objects helps you understand the ideas and the workflow that are crucial for working in Max.

  2. Make a patch that generates many MIDI notes autonomously (by itself, after you turn on its metronome).

    Select pitches (MIDI note numbers) from a table (using the itable object). You can select them sequentially, in a loop, using counter. Or you can select them randomly, using random.

    Choose velocities and durations randomly within specific ranges that are not the full ranges available. In other words, use velocities that do not span the full 0-127 MIDI range (e.g., try a range between 40 and 110). Use durations that are not too short or too long (e.g., try a range between 200 and 2000 milliseconds). The key to doing this is to use the scale object.

    Make the notes come out at an even rate, but provide a way to adjust the speed of notes. If you like, set up your patch to allow random variation in the tempo of notes.

    Use a preset object to let you save various values, such as the table of pitches and the state of any number boxes or sliders (e.g., for adjusting the metronome interval).

You probably noticed that part 2 above doesn’t tell you exactly how to do anything. We’d like you to study the MaxTips patches and try to build your patch by thinking about what might be necessary, and then experimenting. If you get stuck, please email both instructors. You can send your patch as an attachment. It can help to put comments in the patch to ask questions (type ‘c’ to get a comment box).

But read the points in the Suggestions section below for some ideas that may help you write your patch.

Be sure you understand what each of these Max objects does:

  • metro
  • counter, random
  • +, -, *, /, scale
  • makenote, noteout
  • toggle, button, slider
  • itable
  • number (integer number box)
  • message box
  • preset


  • Here are two ways to use an itable:
    1. to hold pitches fixed in register across a wide range, or
    2. to hold pitch classes, which you then place in a register after the pitch class exits the itable. Use the + object to transpose the pitch class number into a specific register (e.g., add 60 to set middle C as the lowest pitch).

    The latter approach lets you use a table with a smaller number of entries vertically, which is easier to edit. To make the table smaller, change its range using the Inspector. There, you can also change its size, or the number of horizontal locations, so that it holds fewer than the default 128 values.

    It’s important to remember that the numbers in a table can be used for anything: velocities, MIDI cc values, days of the month, pennies in your bank account. The numbers are uninterpreted until the place in the flow of the patch that you use them for something specific.

  • What will happen if you randomly generate a velocity of zero? How can you avoid this?
  • If you’re comfortable with this kind of work, feel free to extend the patch in ways you find interesting, as long as you keep the required functionality. Extending the patch is not expected now, but it’s the best way to learn. Get in the habit of asking yourself, “what would be a cool addition to this patch that would make it more musically enjoyable?”

    For example, one possible addition to this patch would be to generate more than one simultaneous stream of notes, triggered either by a common metronome or by separate metronomes. Nothing requires the metronomes to run at the same speed.

  • If you tire of the blandness of the built-in synthesizer, route your MIDI notes into a different synthesizer. When you launch Max on a Mac, it creates two virtual MIDI ports: “from Max 1” and “from Max 2,” which are visible to virtual instruments in DAWs (such as the free Surge Synthesizer) running on the same computer. You just have to enable those ports in the sequencer program. (They probably are already.) Then, double-click the noteout object in your patch, while locked, and choose “from Max 1” from the popup menu.

    Windows doesn’t come with virtual MIDI ports, but you can install loopMIDI to get them, if you use Windows 10 or earlier. For Windows 11, try LoopBe1.


  • Please submit to Canvas one Max patch that satisfies the criteria above.

Grading Criteria

This exercise is graded pass/fail. You must submit the exercise by Thursday midnight to be eligible for a pass.

Your patch must

  • operate correctly and
  • implement the functionality described in item 2 of the “How To Do This Exercise” section above.