The music of the Doom engine games is in MUS, the DMX sound library’s own format: a
compact form of MIDI with one stream of events for all channels. Doom’s songs are the
lumps named D_ and the map, such as D_E1M1; Heretic’s start
MUS_. Numbers are little-endian.
Header
| Offset | Size | Type | Name | Description |
|---|---|---|---|---|
| 0 | 4 | ASCII | id | MUS and the byte 1A. |
| 4 | 2 | u16 | score length | The bytes of the score. |
| 6 | 2 | u16 | score start | Where the score starts, from the start of the lump. |
| 8 | 2 | u16 | primary channels | The number of channels the song uses, not counting percussion. |
| 10 | 2 | u16 | secondary channels | Channels beyond those; usually 0. |
| 12 | 2 | u16 | instrument count | The number of instrument numbers that follow. |
| 14 | 2 | u16 | reserved | 0. |
| 16 | 2 each | u16 | instruments | The instruments the song uses, for the game to load before it plays: General MIDI programs 0 to 127, and 135 to 181 for percussion notes 35 to 81. |
The score usually starts straight after the instrument list, at 16 + 2 × the instrument count.
Events
Each event starts with a descriptor byte, then its data, then, when bit 7 of the descriptor is set, a delay before the next event.
| Bits of the descriptor | Meaning |
|---|---|
| 0 to 3 | The channel, 0 to 15; 15 is percussion |
| 4 to 6 | The event, below |
| 7 | Last: a delay follows |
| Event | Name | Data |
|---|---|---|
| 0 | Release note | The note, 0 to 127. |
| 1 | Play note | The note in bits 0 to 6; bit 7 set when a second byte follows with the volume, 0 to 127. Without it, the channel’s last volume is used. |
| 2 | Pitch bend | One byte, 0 to 255; 128 is no bend. |
| 3 | System event | One byte, a controller from 10 to 14, below. |
| 4 | Change controller | Two bytes: the controller, below, and its value. |
| 5 | End of measure | None. |
| 6 | End of score | None. The song loops back to its start if the game says so. |
| 7 | Not used |
The delay is a count of ticks of 1/140 of a second, written 7 bits a byte, highest bits first, with bit 7 set on every byte but the last.
| Controller | Meaning | MIDI |
|---|---|---|
| 0 | Instrument | Program change |
| 1 | Bank select | Controller 0 |
| 2 | Modulation | 1 |
| 3 | Volume | 7 |
| 4 | Pan | 10 |
| 5 | Expression | 11 |
| 6 | Reverb depth | 91 |
| 7 | Chorus depth | 93 |
| 8 | Sustain pedal | 64 |
| 9 | Soft pedal | 67 |
| 10 | All sounds off | 120 |
| 11 | All notes off | 123 |
| 12 | Mono | 126 |
| 13 | Poly | 127 |
| 14 | Reset all controllers | 121 |
0Change controller40 00 1E: channel 0, instrument 303 bytes3Play note90 BC 64 46: channel 0, note 60 at volume 100, then wait 70 ticks4 bytes7Release note00 3C: channel 0, note 602 bytes9End of score601 byte
As a MIDI file
A MUS score maps closely onto a standard MIDI file of one track. The explorer converts it the way Chocolate Doom’s converter does: 70 ticks to a quarter note at 120 beats a minute, which is 140 ticks a second; MUS channel 15 becomes MIDI channel 10, and the other channels take MIDI channels in the order they are first used, passing over channel 10; the pitch bend is multiplied by 64; and the controllers become the MIDI controllers in the table. The MIDI file opens as a file of its own, and the explorer shows the song’s notes and plays them.