Introduction
MPTM is the module format of OpenMPT (Open ModPlug Tracker), the format it saves when a song uses what the Impulse Tracker module cannot hold: more channels and patterns, instruments with more than 255 samples, tunings other than twelve notes to the octave, FM instruments and samples kept in files of their own. It is an IT file with additions, and every IT reader that ignores unknown bytes can read the IT part.
Structure
The file begins like an IT module: the 192-byte header starts with IMPM
(the first OpenMPT builds that saved .mptm, 1.17.02.4x, wrote tpm. instead), and the made-with field is above
0888h (an .mptm saved by a 1.2x release has 0891h). The order list, parapointers, edit history, MIDI block, chunks
(PNAM, CNAM, CHFX, FXnn), instruments, samples, patterns and the
XTPM and STPM field runs are those of an IT file.
- The end of the file. The last four bytes are the offset of OpenMPT's own block (at least
100h, inside the file). At that offset are the three characters228, then data written by OpenMPT's serialiser: the tunings (a flag “UTF8Tuning”, then items named0and1), the old order list (2), the patterns and the sequences (all orders, with names). Source: libopenmptsoundlib/Load_it.cpp,LoadMPTMProperties. A file whose version number is at or above a limit written in the loader is refused by OpenMPT. - Instruments may be 674 bytes: the 554 bytes of an IT instrument, whose last four padding bytes read
MPTXorXTPM, then 120 bytes holding the high byte of the sample number of every note, so an instrument can use samples above 255 (ITInstrumentEx). - Samples use two more convert values:
40his an FM instrument (the data is a 12-byte OPL patch) and80ha sample kept in a file of its own (the data is a number, written seven bits at a time with the high group first and bit 7 set while more follow, then that many bytes of file name). - Extension fields (
XTPM,STPM) hold what the IT instrument and header have no place for; see the IT header page.
Not described
The explorer reads the IT part of an .mptm file as it reads an IT file (including the 674-byte instruments and the two sample kinds above) and shows the serialised block as raw bytes.
Known, not yet covered
- Reference and viewer: the layout of OpenMPT's serialised block (its header, the named items and each item's contents: tuning
collections, sequences, patterns with their effect extensions) is in libopenmpt's
soundlib/Load_it.cppand the serialisation sources (common/Serialization*.cpp); it is not yet written up or decoded. - Viewer: the playback ignores everything the block holds: sequences other than the first, tunings, FM instruments and the extra pattern data.
Links
Software
- OpenMPT – the tracker that writes and edits .mptm modules (Windows, and Linux and macOS through Wine)
- libopenmpt – playback library that reads .mptm (C, C++)
Reference
- Impulse Tracker module – the format the first part of an .mptm file follows, with the header and extension chunks
- OpenMPT source code – the loader (soundlib/Load_it.cpp) and the serialiser that define the format (C++)