Introduction
XM is the module format of FastTracker 2, a tracker for MS-DOS made by the group Triton. The format description, xm.txt, is signed by Fredrik Huss, Mr.H of Triton, 1994, and its title says it is for “XM files version $0104” (elsewhere in the same file it says the current format is version $0103). It extends the Amiga MOD idea with up to 32 channels, instruments that hold several samples spread across the keyboard, volume and panning envelopes, automatic vibrato, 16-bit samples and patterns of up to 256 rows, and it keeps a note, an instrument, a volume column, an effect and an effect parameter in every cell.
XM was one of the main formats of the PC demo and tracker music scene, and modern trackers and players still read and write it. ModPlug Tracker and OpenMPT added stereo samples, ADPCM-packed samples, more channels and a block of extension chunks at the end of the file; the separate OggMod tool converts the samples to Ogg Vorbis.
A .xm file dropped on any page of this site opens in the explorer. It
shows the structure byte by byte, the song information and the program that wrote it,
the order list, every instrument with its envelopes drawn and its keyboard map, every
sample as a waveform you can play, every pattern as a grid with each cell's note,
instrument, volume column, effect and parameter named, and plays the whole song with a
FastTracker 2 replayer.
Structure
An XM file starts with the text Extended Module: , the module name, the
byte 1A, the tracker name and a version number, usually
0x0104. A header follows, whose size is stored first, with the song
length, restart position, channel count, pattern count, instrument count, flags,
default speed and BPM, and the pattern order table. Numbers are little-endian.
Each pattern has its own header (size, packing type, row count and packed data size) and then its cells. The cells are packed: a byte with its top bit set says which of the five fields (note, instrument, volume column, effect, effect parameter) follow, so an empty cell takes one byte. Instruments come last. Each has a header with its name and sample count, a keyboard map and envelopes, then its sample headers and its sample data. Sample data is stored as the difference between neighbouring values, which packs well.
0ID text Extended Module:, name, 1A, tracker name, version60 bytes60Header size, counts, flags, speed, BPM, order table276 bytes in FT2's files…Patterns pattern header, then packed cellsrepeated…Instruments header, keyboard map, envelopes, sample headers, sample datarepeated…Extension chunks song message, MIDI macros, names, OpenMPT propertiesModPlug Tracker and OpenMPT only
Versions 1.02 and 1.03 put the instruments before the patterns and all the sample data after them; see versions and trackers.
The reference pages give every field: the header, patterns, instruments and samples, effects and volume column commands, the chunks after the samples, the versions and the programs that write XM files, and how FastTracker 2 plays them.
Not described
Known, not yet covered
- Viewer: OggMod samples, the Ogg Vorbis streams the OggMod tool stores in an XM, are named and framed in the tree (instruments) but not decoded: they are silent in the song and their waveform cannot be shown. The Vorbis I specification is public and libopenmpt and libxmp decode them.
- Viewer: the values of OpenMPT's extension fields are listed with their names but numbers such as flag sets and enumerations are shown raw (chunks after the samples); a mix plug-in's saved state is shown as bytes.
- Viewer: stereo samples (MilkyTracker and OpenMPT) play as the mean of their two channels, as the FT2 clone plays them; OpenMPT and libxmp keep them stereo.
- Viewer: OpenMPT-only playback behaviour is not applied: the Zxx MIDI macros and plug-ins, the pitch envelope, NNA and the other extension fields (playback).
Unknown
- Reference and viewer: FastTracker 2's own behaviour where the FT2 clone's source is the only description. The clone says it matches FT2 2.08 and 2.09 to the bit, but no copy of FT2 was run here to check it; the replayer was compared with libopenmpt instead, which differs from FT2 in some quirks (playback).
- Reference: the tracker-name conventions of converters and trackers that neither OpenMPT nor libxmp recognise.
Links
Software
- OpenMPT – free tracker that plays, edits and saves XM modules (Windows)
- FastTracker 2 clone – faithful remake of FastTracker 2, the tracker XM comes from (Windows, macOS, Linux)
- MilkyTracker – FT2-style tracker for many systems; saves stereo samples
- XMPlay – small audio player with strong tracker module support (Windows)
- VLC media player – free player for almost any audio or video file, modules included (Windows, macOS, Linux, mobile)
Developers
- libopenmpt – module playback library from OpenMPT (C, C++)
- libxmp – module player library for XM, MOD, S3M, IT and more (C)
Reference
- The XM module format description – by Mr.H of Triton, 1994: the original, for version 1.04
- The "Complete" XM module format specification – Matti Hamalainen's notes, kept with MilkyTracker's source
- libxmp's tracker notes – XM file format anomalies, section 7
- FastTracker 2 clone source – the exact replayer behaviour (C)
- OpenMPT's soundlib source –
Load_xm.cpp,XMTools.cpp,InstrumentExtensions.cpp(the extension chunks)