Z Music Format
| Format type | Music |
|---|---|
| Notation type | MIDI |
| Instruments | Driver-dependent (OPL in reference setup) |
| Max channel count | Unknown |
| Max track count | Unknown |
| Max pattern count | Unknown |
| Max order count | Unknown |
| Tags? | None |
| Games |
Music in Z uses Miles XMIDI sequences stored in IFF containers.
File format
Container chunk IDs and lengths follow IFF: four-byte IDs, UINT32BE lengths and even-byte padding. FORM, CAT and LIST containers carry a four-byte type. A FORM of type XMID can contain EVNT event data and a TIMB timbre list.
Events
Bytes below 0x80 add delay ticks. MIDI status bytes introduce events; program change and channel pressure have one data byte, other channel messages have two. Note-on messages append a variable-length duration; the reader schedules the corresponding note-off. Meta and system-exclusive payloads use variable-length lengths. The viewer uses 120 ticks per second.
TIMB has a little-endian entry count followed by patch/bank byte pairs, as consumed by the Miles driver. Resolve these against the timbre bank.
Notes
The viewer plays the first sequence for one traversal, capped at two minutes. It omits interactive branches and FOR/NEXT loops; its output is not evidence that those events are absent. Music synthesis is approximate.
Source code
From re-z, the open-source browser port:
- src/viewer/formats.js – inspectXmi and xmiEvents
- src/game/xmidi.js – original sequence service
- src/host/sbpro2.js – TIMB handling
Credits
The identification and implementation notes above were contributed by VorticonCmdr. If you find this information helpful in a project you're working on, please give credit where credit is due. (A link back to this wiki would be nice too!)