A newer version of Max is available. Click here to access the latest version of the documentation

seq Reference

Sequencer for recording and playing MIDI data



seq is a sequencer of raw MIDI bytes. You can control the speed of playback (only at the time you start it), read and write from files, and record from live MIDI input. See also midiparse and midiformat which you may need to get to and from raw MIDI.


Record and play back live performance, or play a pre-recorded sequence


filename [symbol]


Specifies the name of a file to be read into seq automatically when the patch is loaded.


Common Box Attributes



Starts playing the sequence stored in seq.



input [int]
When seq is recording, numbers received in its inlet are interpreted as bytes of MIDI messages (usually from midiformat or midiin). MIDI channel messages and system exclusive messages can be recorded by seq, but seq does not respond directly to MIDI real time messages such as start, stop, MIDI clock, etc.



input [float]
Converted to int.



onset-time (milliseconds) [float]
The word addeventdelay, followed by a number, adds to the delay onset time, in milliseconds, of the first event in the recorded sequence. All events in the sequence are shifted so that the first event occurs at the specified onset time.


Starts recording at the end of the stored sequence, without erasing the existing sequence.


Clears the sequence currently stored in the seq object.



onset-time (milliseconds) [int]
The word delay, followed by a number, sets the onset time, in milliseconds, of the first event in the recorded sequence. All events in the sequence are shifted so that the first event occurs at the specified onset time.


Opens a standard Open Document dialog box, to select a saved sequence or standard MIDI file. The selected file is opened as text in a new Untitled text window, which can be edited and saved.



event-time-multiplier [float]
The word hook, followed by a float, multiplies all the event times in the stored sequence by that number. For example, if the number is 2.0, all event times will be doubled, and the sequence will play back twice as slowly. Multiplications can even be performed while the sequence is playing.


Prints the first sixteen events of the recorded sequence in the Max Console.



filename [symbol]
With no arguments, read calls up the standard Open Document dialog box, so that a previously recorded sequence can be read into seq, replacing the current sequence. With a symbol as an argument, read searches for a file with the specified name to read into the seq object.

Note: The seq object reads and writes both single track (format 0) and multi-track (format 1) standard MIDI files. It can also read and write text files in which each line consists of a start time in milliseconds (the time elapsed since the beginning of the sequence) followed by the (space-separated) bytes of a MIDI message recorded at that start time. For example,

0 144 60 112;

1000 144 60 0;

1500 192 31;

1500 144 60 112;

2500 144 60 0;

plays the note middle C on channel 1 for one second, then half a second later changes to program number 31 and plays middle C again for one second.


Starts recording MIDI messages received in the inlet.



tempo-multiplier [int]
The word start by itself has the same effect as bang. The word start, followed by a number, plays the stored sequence at a tempo determined by the number. The message start 1024 indicates normal tempo. If the number is 512, seq plays the sequence at half the original recorded speed, start 2048 plays it back at twice the original speed, and so on.

The message start -1 starts the sequencer, but rather than follow Max's millisecond clock, seq waits for a tick message to advance its clock. See the tick message.


Stops the sequencer if it is recording or playing. A stop message need not be received when switching directly from playing to recording, or vice-versa.


After seq has received a start -1 message, it waits for tick messages to advance its clock. In order to play the sequence at its original recorded tempo, seq must receive 48 tick messages per second. This is equivalent to 24 tick s per quarter note (the standard for a MIDI Clock message) at a tempo of 120MM. By using tick messages to advance the sequencer, you can vary the tempo of playback or synchronize seq with another timing source (such as incoming MIDI Clock messages).



filename [symbol]
format [int]
Calls up the standard Save As dialog box, so that a recorded sequence can be saved as a separate file. If you want to edit the sequence with the text editor, check the Save As Text option in the dialog box. With a symbol as an argument, write will write a file with the specified name. A non-zero int argument (as a single argument, or following a filename argument) will cause the seq object to write a multi-track standard MIDI file (format 1).



Out right outlet: Indicates that seq has finished playing the current sequence. (The bang is sent out immediately before the final event of the sequence is played.)


Out left outlet: When bang or start is received in the inlet, the sequence stored in seq is sent out the outlet in the form of individual MIDI bytes, usually to be sent to midiparse or midiout.

See Also

Name Description
Max MIDI Tutorial 4: MIDI Basic Sequencing Max MIDI Tutorial 4: MIDI Basic Sequencing