Jump to content
Setting up an AI agent? ReverseEngineering.wiki skill (works from the command line, no configuration): https://reverseengineering.wiki/skill/rewiki/SKILL.md · setup for every client, including MCP: https://reverseengineering.wiki/llms.txt · REWiki:Connect

Format:FastTracker 2 module (XM)

From ReverseEngineering.wiki
Format
Magic "Extended Module: " at 0
Extensions .xm
Endianness little
On this wiki Facts · Code · Notes · Topics

FastTracker 2 Extended Module (.xm): little-endian, starts with the 17 characters "Extended Module: ", a 20-byte title, 0x1A, a 20-byte tracker name, a version word (normally 0x0104) and a header size; patterns use a flag-byte packing scheme, instruments carry up to 16 samples with envelopes, and samples are delta-coded.

Overview

XM is the module format of Triton's FastTracker 2 (DOS, 1994) and of later trackers that export it (MilkyTracker, OpenMPT, many game and demo tools). It has up to 32 channels in FT2 (libxmp accepts more), instruments with volume and panning envelopes, and a linear or Amiga frequency table.

Identification

"Extended Module: " (17 bytes, with the trailing space) at offset 0; libxmp xm_test checks nothing more (xm_load.c lines 56-60). The 16-bit version at offset 58 is 0x0104 for files written by FT2 and compatible programs; see Fact:FastTracker 2 module (XM)/struct/XM file header.

Order of data

In versions 0x0104 and later the file holds all patterns, then all instruments. In versions up to 0x0103 the instruments come first, then the patterns (libxmp xm_load.c lines 906-921). Version 0x0102 and older also have an 8-byte pattern header with an 8-bit row count (minus one): see Fact:FastTracker 2 module (XM)/behavior/Pattern packing and header.

Instruments and samples

See Fact:FastTracker 2 module (XM)/struct/XM sample header. The instrument header size field at +0 of each instrument is followed by the name (22), type (1, always 0), sample count (u16) and the sample-header size (u32, at +29). All sample headers of an instrument come first, then all sample data (delta-coded 8 or 16 bit, per type flags). libxmp rejects more than XM_MAX_SAMPLES_PER_INST samples or a sample-header size above 0x100 (lines 470-485).

Pitfalls

  • Use the header-size field (offset 60) to find the order table and the first pattern: the table is headersz - 0x14 bytes at offset 80, and libxmp rejects a value above 256 + 0x14 (lines 819-822).
  • Tempo (offset 76, called speed) must be below 32 and BPM 32 to 1000 in libxmp, except for files made by MED2XM (lines 811-816).
  • Unverified: some tools write an XM with the empty instrument size 0x107 and zero samples; libxmp special-cases that (line 490).

Code & repositories

libxmp (MIT) src/loaders/xm_load.c and xm.h; OpenMPT soundlib/Load_xm.cpp (Unverified: not read).

  • https://github.com/libxmp/libxmp @ 5d4f6aa2c7dcdf8e9cd8129fe579d45b36a302da · license: MIT (declared by the contributor; GitHub's detector did not recognize a license file)
    Extended Module Player library: loaders for MOD, Soundtracker, S3M, XM, IT and dozens of other tracker formats (src/loaders), with tracker detection heuristics.
    Tested on: source read, not run: read only, source files at the pinned commit · checked 2026-10-19; last activity 2026-10-10