An S3M module starts with a 96-byte header, followed by the order list, parapointers and
an optional panning table. The format is little-endian. Offsets are hexadecimal. It is
defined in TECH.DOC, the technical notes that come with Scream Tracker 3.
Layout
| Offset | Size | Type | Name | Description |
|---|---|---|---|---|
| 00 | 28 | text | song name | Terminated by a zero byte. |
| 1C | 1 | u8 | marker | Always 1A. |
| 1D | 1 | u8 | type | 16 (10) for an S3M module. |
| 1E | 2 | – | reserved | |
| 20 | 2 | u16 | OrdNum | Number of orders. Should be even. |
| 22 | 2 | u16 | InsNum | Number of instruments. |
| 24 | 2 | u16 | PatNum | Number of patterns. |
| 26 | 2 | u16 | Flags | Song options. |
| 28 | 2 | u16 | Cwt/v | The tracker that wrote the file: high four bits the tracker, low twelve bits the version. |
| 2A | 2 | u16 | Ffi | Sample format: 1 for the very old signed samples, 2 for unsigned samples. |
| 2C | 4 | ASCII | signature | SCRM. |
| 30 | 1 | u8 | GV | Global volume, 0 to 64. |
| 31 | 1 | u8 | IS | Initial speed (command A). The MultimediaWiki says 0 and 255 are ignored and the speed of the song loaded before stays; libopenmpt plays 6 for 0, and for 255 in a file Scream Tracker wrote. |
| 32 | 1 | u8 | IT | Initial tempo (command T). Values below 33 are ignored. |
| 33 | 1 | u8 | MV | Master volume, low seven bits, 16 to 127. Bit 7 set means stereo. |
| 34 | 1 | u8 | UC | Ultra-click removal, for the Gravis Ultrasound: 8, 12 or 16. Scream Tracker’s order screen shows half the value. |
| 35 | 1 | u8 | DP | 252 (FC) if a panning table follows the header; anything else means there is none. |
| 36 | 2 | u16 | reserved | Scream Tracker 3.21 never reads it. Schism Tracker and OpenMPT keep their version here (libopenmpt’s Load_s3m.cpp). |
| 38 | 4 | u32 | reserved | Not read by Scream Tracker 3.21. Impulse Tracker 2.07 and later, Schism Tracker and OpenMPT keep the editing time here, in ticks of 1/18.2 second (Load_s3m.cpp); one program writes “SCLUB2.0” over these eight bytes (Sound Club 2). |
| 3C | 2 | – | reserved | Not read by Scream Tracker 3.21, and no other program is known to use it. |
| 3E | 2 | u16 | Special | Parapointer to custom data, valid when Flags bit 7 is set. |
| 40 | 32 | u8 × 32 | Channel settings | One byte per channel. |
| 60 | OrdNum | u8 | Orders | The order list. |
| … | InsNum × 2 | u16 | Instrument parapointers | |
| … | PatNum × 2 | u16 | Pattern parapointers | |
| … | 32 | u8 × 32 | Pan table | When DP is 252. |
Flags
| Bit | Value | Meaning when set |
|---|---|---|
| 0 | 1 | ST2 vibrato. Before Scream Tracker 3.01 only. |
| 1 | 2 | ST2 tempo. Before 3.01 only. |
| 2 | 4 | Amiga slides. Before 3.01 only. |
| 3 | 8 | Zero-volume optimisation: a channel whose volume is 0 and whose row has no note, instrument, volume or command is switched off after three such rows (St3.exe, file offset 0x2cd05). libopenmpt ignores this flag. |
| 4 | 16 | Amiga limits: notes beyond the Amiga’s range are not played. The Amiga periods 113 to 856; St3.exe clamps its own periods (four times the Amiga’s) to 453 and 3,424 (1C5 and D60, set at 0x2e57b), and a slide that takes a period to 0 still silences the note. |
| 5 | 32 | Enable filter and sound effects on the Sound Blaster. Before 3.01 only. |
| 6 | 64 | Scream Tracker 3.00 volume slides: slides also run on the first tick. Set automatically when Cwt/v is 1300. |
| 7 | 128 | Special custom data is present. |
Tracker versions
| Cwt/v | Program |
|---|---|
1xyy | Scream Tracker 3.xx: 3.00 is 1300, 3.01 1301, 3.03 1303, 3.20 1320 |
2xyy | Imago Orpheus |
3xyy | Impulse Tracker |
4xyy | Schism Tracker, with its own numbering |
5xyy | OpenMPT |
Other programs reuse these numbers: Liquid Tracker shares OpenMPT’s, for example. The list is not closed.
Channel settings
Each of the 32 channels has one byte. FF means the channel is unused. Bit
7 set means the channel is disabled.
| Low seven bits | Channel |
|---|---|
| 0–7 | Left sample channels 1 to 8. |
| 8–15 | Right sample channels 1 to 8. |
| 16–24 | AdLib melody channels 1 to 9. |
| 25–29 | AdLib percussion: bass drum, snare, tom, cymbal, hi-hat. Scream Tracker 3 does not implement them. |
Two pattern channels can feed one output channel. Only Scream Tracker supports this fully, and only the last channel’s effects are applied.
Order list
OrdNum bytes from offset 60, each a pattern number. 255 ends the tune, and
254 is a marker skipped during playback. OrdNum should be even (TECH.DOC). In St3.exe’s order
scan (file offset 0x2d60c) a 254 is skipped and a 255 sends the song back to its restart position, which is the
first order, so a song plays again from the start; it stops only if the first order is 255 too. A pattern number
beyond the pattern count names no stored pattern and plays as an empty one.
Parapointers
Instruments and patterns are found through parapointers: 16-bit values giving the file offset divided by 16. The file offset is parapointer × 16.
| Table | Starts at | Entries |
|---|---|---|
| Instruments | 60 + OrdNum | InsNum |
| Patterns | 60 + OrdNum + InsNum × 2 | PatNum |
| Pan table | 60 + OrdNum + (InsNum + PatNum) × 2 | 32 |
Scream Tracker places the sample data at the end of the file, but the parapointers can point anywhere (TECH.DOC).
Scream Tracker 3.21’s loader (the routine at file offset 0x191AE of the unpacked
St3.exe in st321.zip) reads the instrument parapointers into an array of 101 words and the pattern
parapointers into another of 101, so more than 99 instruments or 100 patterns do not load as such. For each
instrument it seeks to the parapointer × 16 and reads 80 bytes; for each pattern it seeks there, reads the length
word and then that length minus 2 bytes. A pattern parapointer of 0 is skipped: nothing is read,
and the player treats a pattern with no stored data as having no rows to play (the row reader at 0x2d738 finds a zero
segment and returns no entries). So 0 means an empty pattern. libopenmpt and libxmp do the same.
A file whose byte at offset 1C is FC instead of 1A makes the same loader look for the real header
at an offset of OrdNum × 512 + InsNum, and read the header again from there (0x1921C to 0x1926C in the disassembly). No file
or document is known that uses this; it is listed here because the program does it.
Panning table
When DP is 252, 32 pan bytes follow the parapointers.
| Bits | Meaning |
|---|---|
| 0–3 | The pan position. |
| 5 | Set: use this pan position. Clear: use the default. |
| 6–7 | Reserved. |
The default is 7 for a mono song, or 3 (left) and 12 (right) for a stereo song.
Timing
A tick lasts 2.5 ÷ tempo seconds, so at speed S each row takes
2.5 × S ÷ tempo seconds. At the default tempo of 125 a tick is 20 ms. This is not a guess from other
players: in St3.exe the Set tempo routine (file offset 0x2ce0d) multiplies the tempo by 0x3200 (12,800),
divides by 0x7d (125) and keeps the high byte of the quotient, which is the tempo × 0.4 rounded down (tempo 125: 50),
and the timer set-up (0x2ba79) divides 0x1234DC (1,193,180, the PC timer’s clock) by that number of ticks a second. A
tick is 1 ÷ (0.4 × tempo) seconds, which is the same as 2.5 ÷ tempo. The statement that a tick lasts 1 ÷ tempo
seconds is wrong for Scream Tracker 3. The program’s timer runs at whole hertz, so for tempos that are not a
multiple of 5 the real tick is a little longer (tempo 128: 51 ticks a second, not 51.2). The routine ignores a tempo
of 0x20 (32) and below, as the Set tempo command (T) does; the initial tempo is likewise ignored below 33.
The speed command A with 0 does nothing. Every speed from 1 to 255 is accepted by the command.