FastTracker 2 ends its files with the data of the last sample, and its readers ignore any bytes after it. ModPlug Tracker 1.16 and OpenMPT use them for what the format has no place for: the song message, the MIDI macros, names for patterns and channels, the mix plug-ins and OpenMPT's own properties. Each part is a chunk: a four-letter name, a 32-bit size and the data, apart from the last two, which are runs of fields. A reader that does not know them can stop at the end of the last sample. The loaders read the chunks in the order below, and stop at the first name they do not know.
The chunks
| Name | Layout | Holds |
|---|---|---|
text | u32 size, then the text | The song message. Lines end with a carriage return (0D). |
MIDI | u32 size, then 153 macros of 32 bytes (4,896 bytes) | OpenMPT's MIDI macro configuration: 9 global macros, 16 parametered macros (SF0 to SFF) and 128 fixed macros (Z00 to Z7F), each a text of up to 31 characters with a zero at the end. |
PNAM | u32 size, then 32 bytes for each pattern | The pattern names. |
CNAM | u32 size, then 20 bytes for each channel | The channel names. |
CHFX | u32 size, then a u32 for each channel | The mix plug-in each channel is routed to (0 for none). |
FX00 to FX99, F100 to F255 | u32 size, then a plug-in record | One mix plug-in: 128 bytes of routing and names, then a u32 size and its saved state, then OpenMPT’s extra chunks (DWRT the dry/wet ratio as a float and PROG the default program, neither with a size; MCRO macros, which the wiki page read does not describe). |
XTPM | no size: fields follow | OpenMPT's extended instrument properties; its "MPTX" backwards. |
STPM | no size: fields follow | OpenMPT's extended song properties; its "MPTS" backwards. |
Source for this section: the OpenMPT wiki page “Development: OpenMPT Format Extensions”, read in full this session. The chunk header is a 4-byte magic and a uint32 size excluding the header; the wiki says the chunks are always written in the order below, but a reader should not expect an order, and all chunks are optional. Pattern and channel names are not necessarily null-terminated and their encoding is unspecified (the Windows code page); the number of names is the chunk size divided by 32 or 20. The MIDI chunk is “in the same format as in the IT format”; the wiki does not give the macro layout, so the 153 × 32 bytes above come from the IT documentation of OpenMPT, which was not read here.
The plug-in record’s first 128 bytes are: two 32-bit plug-in IDs (the type, for example PtsV for VST plug-ins and OMXD for DMO plug-ins, and the unique
ID), a routing flags byte (1 apply to master, 2 bypass, 4 dry mix, 8 expand mix [0%,100%] to [−100%,100%], 16 auto
suspend on silence), a mix mode byte (0 default, 1 wet subtract, 2 dry subtract, 3 mix subtract, 4 middle subtract, 5 L/R balance, 6 instrument; before OpenMPT 1.32.00.11 instrument plug-ins always behaved like mode 6), a gain byte (gain × 10: 10 is 100%, and 0 is read as 10), a reserved byte, a 32-bit output
routing (0 is the master, 0x80 plus x is plug-in x), a 32-bit shell plug-in ID (0 when not a shell plug-in), 12 bytes
of reserved bytes, a 32-byte name (Windows code page) and a 64-byte library name (UTF-8 since OpenMPT 1.22.07.01, the Windows code page before). Then a uint32 size of the plug-in data and that data: if its first four bytes are all 0 the parameters follow as float32 values, otherwise it is an opaque plug-in chunk (VST effGetChunk data starts with fEvN). OpenMPT then may add chunks: DWRT (float32 dry/wet ratio) and PROG (uint32 default program) are the two legacy ones that do not store a size; any chunk added later has a four-letter name and a 32-bit size.
The explorer lists each chunk and its parts in the tree, shows the song message as text, the names as tables and the extension fields' values in a table.
Extension fields
After XTPM or STPM each field is a four-byte code, a 16-bit size and the
value. In XTPM the value is repeated once for every instrument of the module, in
order, all of the same size. The run ends at STPM (for the instruments), or at
a code that is not text, or when the file ends. OpenMPT writes the code as a 32-bit
number, so most codes appear reversed in the file: the code FO.. is the
bytes 2E 2E 4F 46. A few (DTFR, RSMP, CCOL,
AUTH, CUES, SWNG, PTTF) are stored as written.
The tables give OpenMPT's name for each code and what it holds.
0000057F 58 54 50 4D 53 54 50 4D 2E 42 50 52 04 00 04 00 XTPMSTPM.BPR....
0000058F 00 00 2E 4D 50 52 04 00 10 00 00 00 2E 2E 4D 54 ...MPR........MT
0000059F 01 00 00 2E 4D 4D 50 04 00 04 00 00 00 2E 56 57 .....MMP.......VW
000005AF 43 04 00 00 07 31 01 56 57 53 4C 04 00 00 07 31 C....1.VWSL....1
000005BF 01 2E 41 50 53 04 00 30 00 00 00 56 54 53 56 04 ..APS..0...VTSV.
000005CF 00 30 00 00 00 2E 46 53 4D 0F 00 01 07 02 00 00 .0....FSM........
000005DF 01 F8 FF FF 1F 40 27 04 00 01 41 55 54 48 08 00 .....@'...AUTH..
000005EF 4C 61 63 68 65 73 69 73 43 43 4F 4C 10 00 FF A8 LachesisCCOL....
XTPM is followed straight away by STPM. The fields are rows per beat 4, rows per measure 16, tempo mode 0, mix levels 4, created with and last saved with version 0x01310700 (OpenMPT 1.31.07.00), sample pre-amp 48, VST volume 48, the playback behaviour flags, the artist "Lachesis" and the channel colours.Instrument fields (XTPM)
| Code | Name | Code | Name |
|---|---|---|---|
FO.. | Volume fade-out | VP[. | Volume envelope tick positions |
GV.. | Global volume | PP[. | Panning envelope tick positions |
P... | Panning | PiP[ | Pitch envelope tick positions |
VLS. VLE. | Volume envelope loop start and end | VE[. | Volume envelope values |
VSB. VSE. | Volume envelope sustain start and end | PE[. | Panning envelope values |
PLS. PLE. | Panning envelope loop start and end | PiE[ | Pitch envelope values |
PSB. PSE. | Panning envelope sustain start and end | VE.. PE.. PiE. | Volume, panning and pitch envelope lengths |
PiLS PiLE | Pitch envelope loop start and end | VFLG AFLG PFLG | Volume, panning and pitch envelope flags |
PiSB PiSE | Pitch envelope sustain start and end | VERN AERN PERN | Volume, panning and pitch envelope release node |
NNA. DCT. DNA. | New note action, duplicate check and action | dF.. | Instrument flags |
PS.. VS.. | Panning and volume swing | NM[. | Note map (the note each key plays) |
IFC. IFR. | Default filter cutoff and resonance | n[.. fn[. | Name and file name (longer than XM's 22) |
CS.. RS.. FM.. | Cutoff swing, resonance swing, filter mode | R... | Resampling mode |
MB.. MP.. MC.. | MIDI bank, program, channel | PTTL PTTF | Pitch/tempo lock, integer and fractional part |
MiP. PVEH PVOH MPWD | Mix plug-in, velocity and volume handling, MIDI pitch wheel depth | PPS. PPC. VR.. | Pitch/pan separation and centre, volume ramp up |
Song fields (STPM)
| Code | Name | Code | Name |
|---|---|---|---|
DT.. DTFR | Default tempo, whole part and fraction (for tempos above 255) | CWV. LSWV | Created with and last saved with version (OpenMPT version number) |
RPB. RPM. | Rows per beat, rows per measure | SPA. VSTV DGV. | Sample pre-amp, VST instrument volume, default global volume |
C... | Channel count | RP.. | Restart position (not used for XM) |
TM.. | Tempo mode | RSMP | Resampling mode |
PMM. | Mix level mode | MIMA CCOL | MIDI mapping, channel colours (4 bytes a channel) |
AUTH | Artist (UTF-8) | ChnS | Channel settings for channels 65 and up (IT) |
CUES | Sample cue points | SWNG | Tempo swing |
MSF. | Playback behaviour flags: a bit set for each compatibility behaviour OpenMPT should use for this module (the FT2 behaviours listed in its source). These make OpenMPT play the module as the version that wrote it did. | ||
What the values mean
Every value is a little-endian whole number of the size the field gives; OpenMPT reads a field of any
size and uses as much as fits (ReadSizedIntLE), so a field written wider or narrower than today's
still reads. The meanings below are from OpenMPT 0.8.9's InstrumentExtensions.cpp
(ReadInstrumentHeaderField), Load_it.cpp (LoadExtendedSongProperties),
Snd_defs.h, SoundFilePlayConfig.h, ModInstrument.h,
version.h and Sndfile.cpp; the explorer shows them in this form.
Instrument fields
| Field | Value |
|---|---|
| NNA. | New note action: 0 note cut, 1 continue, 2 note off, 3 note fade |
| DCT. | Duplicate check: 0 none, 1 note, 2 sample, 3 instrument, 4 plug-in |
| DNA. | Duplicate note action: 0 note cut, 1 note off, 2 note fade |
| FM.. | Filter mode: 0 low-pass, 1 high-pass, 255 unchanged |
| PVEH | Plug-in velocity handling: 0 channel volume, 1 note volume |
| PVOH | Plug-in volume handling: 0 MIDI volume, 1 dry/wet ratio, 2 ignored, 3 custom |
| R... | Resampling: 0 nearest neighbour, 1 linear, 2 cubic spline, 3 8-tap polyphase with anti-aliasing, 4 8-tap sinc, 5 the module's default (255 is Amiga and not selectable) |
| dF.. | Instrument flags, bit by bit: 0x0001 volume envelope on, 0x0002 volume sustain, 0x0004 volume loop, 0x0008 panning envelope on, 0x0010 panning sustain, 0x0020 panning loop, 0x0040 pitch envelope on, 0x0080 pitch sustain, 0x0100 pitch loop, 0x0200 the instrument sets the panning, 0x0400 the pitch envelope is the filter envelope, 0x0800 / 0x1000 / 0x2000 carry for the volume / panning / pitch envelope, 0x4000 muted |
| VFLG AFLG PFLG | One envelope's flags: 0x01 on, 0x02 loop, 0x04 sustain, 0x08 carry, 0x10 filter (pitch envelope only) |
| VE.. PE.. PiE. | The number of points of the volume, panning and pitch envelope (at most 12 in an XM) |
| VP[. PP[. PiP[ | A u16 tick for every point; VE[. PE[. PiE[ a byte (0 to 64) for every point |
| VLS. VLE. VSB. VSE. (and PLS. … PSE., PiLS … PiSE) | The point numbers of the loop and the sustain range |
| VERN AERN PERN | The release node of an envelope, 255 for none (OpenMPT's own MPTM format uses it; an XM ignores it) |
| FO.. | Fade-out speed. GV..: instrument global volume 0 to 64. P...: panning 0 to 256. PS.. VS.. CS.. RS..: random swing of panning, volume, cutoff and resonance, 0 to 64 |
| IFC. IFR. | Default filter cutoff and resonance: bit 7 switches it on, bits 0 to 6 are the value (0 to 127) |
| MB.. MP.. MC.. MPWD | MIDI bank, program, channel (0 none, 1 to 16, above 16 a plug-in channel) and pitch wheel depth in semitones |
| PPS. PPC. | Pitch/pan separation, a signed byte (-32 to 32), and centre, the zero-based note (60 is C-5 in OpenMPT's numbering) |
| MiP. | The mix plug-in number, 0 for none |
| VR.. | Volume ramp up in samples, 0 for the module's default |
| PTTL PTTF | Pitch/tempo lock: the whole part and the fraction in 1/10000 of a beat per minute at which the instrument's samples loop correctly (0 for unset) |
| NM[. | A note map: one byte for each of 128 notes, the note it plays instead |
| n[.. fn[. | The instrument's name and file name |
Song fields
| Field | Value |
|---|---|
| DT.. DTFR | Default tempo: whole beats per minute, and the fraction in 1/10000 |
| TM.. | Tempo mode: 0 classic, 1 alternative, 2 modern |
| PMM. | Mix level mode: 0 original, 1 to 3 the 1.17 release candidates, 4 compatible, 5 compatible for FT2 |
| CWV. LSWV | A version number: four bytes, each two decimal digits written as hex, so 0x01310700 is OpenMPT 1.31.07.00 |
| DGV. | Default global volume, 0 to 256 (256 is full) |
| RSMP | Resampling mode, as R... above |
| CCOL | Four bytes for each channel: red, green, blue, and a non-zero byte when the channel has no colour |
| SWNG | Tempo swing: a u16 count, then a u32 for each row, a row's length in 1/16,777,216 of a row |
| CUES | A u16 sample number and then the u32 positions of the sample's cue points |
| MSF. | Playback behaviour: bit number n is the n-th switch of OpenMPT's PlayBehaviour list (138 of them in 0.8.9, from MSF_COMPATIBLE_PLAY to kITCompatGxxCarryPortaWithIns); the explorer names every bit that is set |
| MIMA | OpenMPT's MIDI-to-plug-in-parameter mapping; its layout is OpenMPT's own serialisation and it has no part in playback |
Mix plug-in records
The plug-in data after a record's 128 bytes is the plug-in's own saved state. OpenMPT's own layout, used
for every plug-in it hosts itself (its DirectX Media Object copies, the DigiBooster Pro and SymMOD echoes, the LFO), is a
u32 of 0 and then a 32-bit float between 0 and 1 for every parameter (IMixPlugin::SaveAllParameters);
the explorer shows the parameter list that way and names these plug-ins by their two ids. A VST plug-in's data is
whatever the plug-in saved and has no layout this page can give.
How readers find them
The explorer reads the chunks from the first byte after the last sample's data. libxmp does the
same and stops at XTPM; OpenMPT reads text, MIDI,
PNAM, CNAM, the plug-in chunks, then XTPM (only if
the module has instruments) and then STPM. A chunk whose size runs past the end of
the file is the last thing in a truncated file and the explorer says so. When a module with
the tracker name FastTracker v2.00 has one of these chunks, it was written by
ModPlug Tracker 1.16 or OpenMPT with the name copied (libxmp and OpenMPT both use that to
recognise ModPlug Tracker).