The following is a collection/consolidation of netnews articles describing MIDI data formats for various sequencers/interfaces. ========================== MPU-401 ========================== Some folks have asked about the "MPU-401 data format". It is straightforward, and really too simple to deserve the name of "data format". It is straight MIDI spec, with a few additions: All MIDI messages except those >= $F0 are time-stamped with a single prefix byte. This byte registers how many ticks of the MPU's internal clock (rate set via software) have passed since the last MIDI message. This byte can take values from $00 to $EF (0 to 239). Whenever the counter hits $F0 (240), a single-byte MPU-401 message (not a MIDI message!) is generated: $F8. This is the MPU "clock overflow" message. You can record data straight from the MPU-401 MIDI OUT, and play the same stuff back to the MPU-401 MIDI IN with no hitches. Processing the received data takes some translation, and Don Swearingen's article in the June 1986 is a very good place to start, especially if you have Turbo Pascal. Personal opinion: the MPU-401 is a small, loathesome box with execrable documentation. The perfect (indeed, the only) mate for an IBM computer. UUCP: ...hplabs!well!csz ======================= Opcode MIDI files ======================= I'm surprised that nobody has mentioned the MIDI files. MIDI files are a format which Opcode started on their sequencer to use in addition to their own internal format starting with their Sequencer 2.5. I qoute from the back of the Sequencer 2.5 manual: "A MIDI file contains one MIDI stream with time information for each event. Tempo information is also supported. The stream may contain up to 16 channels of MIDI data: currently this is the way multiple tracks are represented in a single file. Future versions of this format will support multiple tracks and multiple sequences so that if the user of a program which supports multiple tracks intends to move a file to another one, this format can allow that to happen. There is no special header structure -- header type data appears at the beginning of the file as events. In this format, numbers representing time are stored as variable length quantities. Variable lengths quantities are represented 7 bits per byte, most significant bit first. All bytes except the last have bit 7 set, and the last byte has bit 7 clear. If the number is between 0 and 127, it is thus represented exactly as one byte. ... As mentioned above, a MIDI file consists soley of a stream of MIDI events. ... = + (+ means one or more midi file events) = is stored as a variable length quantitiy which represents an amount of time. Delta times are always present, even if the value is 0. Delta time is in 96th of a beat, unless otherwise specified by a time base eent. ... = | | is any midi channel voice or system common message. Running status is allowed for these events. ... DElta time is not considered an event itself: notice that running status occurs across delta-times. is any MIDI system exclusive message. The number of data bytes is inserted after the F0 as a variable length quantity: The F7 is omitted. Running status may not be used. What is this bizarre format used and not just F0 data F7 like in MIDI? Because in a file format, it is more convienient if the length of each thing is located at the beginning of the thing, so you can skip over it if you aren't interested in it. If you are reading a file, you can fine out in advance how big the sysex event is so you can tell if you have buffer space for it or not. If you store tracks in memory using this format, having the length at the beginning allows skipping it if you are looking for an event or something. Length is stored as a variable length quantity so that small events (which often occur in large groups) take up less space, but large events (such as bulk dumps) can be accomodated. specified non MIDI information useful to this format or to sequencers. All meta events begin with FF, then have the event type byte, and then have the length stored as a variable length quantity, and then the data. Running status is not allowed. Event types are always between 0 and 7F. ... ..." [about a page on meta events not qouted] I'm not sure how many programs support this format. I know that Sequencer 2.5 from Opcode, M and Jam Session from whoever also support it. Christopher Chow /-------------------------------------------------------------------------\ | ARPA: chow@batcomputer.tn.cornell.edu (128.84.253.35) | | UUCP: ...{uw-beaver|ihnp4|decvax|vax135}!bullwinkle!batcomputer!chow | | Phone: 1-607-253-6699, USPS: 7122 N Campus 7, Ithaca, NY 14853 | | PAN: chow Delphi: chow | \-------------------------------------------------------------------------/