This page contains links to explanations and example Max patches that are intended to give instruction on some basic concepts of interactive arts programming using Max/MSP and Jitter.
The examples were written for use by students in the Interactive Arts Programming course at UCI, and are made available on the WWW for all interested Max/MSP/Jitter users and instructors. If you use the text or examples provided here, please give due credit to the author, Christopher Dobrian.
There are also some examples from the previous year's class -- MSP examples and Jitter examples -- available on the Web.
[Click on an image below for a text version of the actual Max patch.]
This is the Max patch built in the first day of class (April 4, 2005). It demonstrates MIDI note input and output, transposition of MIDI notes, timed events using metro, and random note generation.
This is the Max patch built in the second day of class (April 6, 2005). It demonstrates two methods of automatically playing a chromatic scale from MIDI C3 to MIDI C4.
This shows how to map one range of values into another. The counter goes from 0 to 12 (a range of 12 with an offset of 0). We want the pitches to go from 60 to 72 (a range of 12 with an offset of 60), so all we have to do is add 60 to the number coming out of the counter. We want the velocities to go from 67 to 127 (a range of 60 with an offset of 67), so we need to multiply by 5 to expand the range from 12 to 60, then add an offset of 67.
This shows how to use the zmap object to map one range of values into another. The object needs to know the input minimum and maximum and the output minimum and maximum, and it will then convert input values into an equivalently-located output value. Here the MIDI input values are going from 0 to 127 (just short of the specified input maximum of 128), so once we tell zmap the duration of the video being accessed by jit.qt.movie, zmap will convert those numbers into corresponding locations in the video, leap to that place in the movie, and display it.
This patch shows how to trigger a timed series of events by looking them up in an array (a table), and it also shows how to use the line object to create a linear progression of numbers. The numbers coming from line can be used as a control of some parameter of the music (or visual effect), even over a long period of time. Here we use it to make a 15-second velocity crescendo. One can think of such a long-term shape as a serving a global control function, shaping events at a higher formal level.
To describe a non-linear shape, it's easiest to store the shape as a series of values in a table, then look them up in order. In this patch we use one table to describe a pattern of sixteen pitches over 2.4 seconds (we can think of it as a local shape), and we use a bigger table of 100 velocities to shape the dynamics over a period of fifteen seconds (a more global shape).
One frequently needs to use non-linear functions (shapes) in audio synthesis. This patch demonstrates the use of stored shapes at three formal levels of the audio signal: 1) at the microscopic level of the timbre of an audio wave, a short audio clip stored in memory and used as a transfer function for waveshaping synthesis, 2) at the note level, the 150 ms amplitude envelope of each note is described by a stored function made up of line segments, 3) at the more global level, a stored function made up of line segments is used to describe the over-all change in amplitude over fifteen seconds. You could even say that a fourth shape is used, because the pitches played by the synthesis patch are stored in an array of 16 MIDI pitch numbers, which get converted to frequency for use in MSP. (For an explanation of waveshaping synthesis, see MSP Tutorial 12).
This patch shows some basics of video playback in Jitter, and shows a few good tricks such as starting and stopping the movie at the same time as the metro that displays it, using the success signal of a read operation to trigger queries about the movie's attributes, and toggling fullscreen view on/off with a key command.
This shows using a MIDI controller to crossfade between two images, and also shows blurring by the technique of downsampling a matrix (putting it into a smaller matrix, thus losing lots of its information) followed by upsampling it to the original size with interpolation.
This patch shows adjustable pixelation by downsampling. The size of the desired "mosaic" tiles ("pixel size") is used to calculate the dimensions of the smaller (downsampling) matrix, and that matrix is then upsampled to the original size. Note that the upsampling takes effect in the jit.pwindow object, without interpolation. The interp attribute of the jit.pwindow object could be turned on, resulting in a blur effect similar to the preceding example. (Note also that the minimum acceptable value for "pixel size" is 1, and that the calculated values are rounded up to the nearest pixel by adding 0.5 to the calculation.)
This page was last modified May 16, 2005.
Christopher Dobrian firstname.lastname@example.org