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

seq

Sequencer for recording and playing MIDI data

Description

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.

Arguments

Name Type Opt Description
filename symbol opt Specifies the name of a file to be read into seq automatically when the patch is loaded.

Messages

bang Starts playing the sequence stored in seq.
int 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.
float input [float]
Converted to int.
append Starts recording at the end of the stored sequence, without erasing the existing sequence.
delay 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.
dump 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.
hook 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.
print Prints the first sixteen events of the recorded sequence in the Max window.
start 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.
read 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 single track (format 0) 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.
tick 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).
stop 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.
record Starts recording MIDI messages received in the inlet.
write filename [symbol]
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.

Information for box attributes common to all objects

Output

bang: 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.)
int: 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.

Examples

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

See Also

Name Description
coll Store and edit a collection of different messages
follow Compare a live performance to a recorded performance
mtr Multi-track sequencer
Max MIDI Tutorial 4: MIDI Basic Sequencing Max MIDI Tutorial 4: MIDI Basic Sequencing