A Soundtracker module starts with a 600-byte header: the song title, a header for each of the 15 samples, the song length, the tempo and the order table. There is no signature. The patterns follow straight after it, from offset 600. All numbers are big-endian, most significant byte first, and the header has no padding.
Layout
| Offset | Size | Type | Name | Description |
|---|---|---|---|---|
| 0 | 20 | text | title | The song title. |
| 20 | 450 | 15 × 30 bytes | samples | The sample headers, sample 1 first. |
| 470 | 1 | u8 | song length | How many positions of the order table are played. |
| 471 | 1 | u8 | tempo | The tempo, as a CIA timer setting; 120 is the standard. |
| 472 | 128 | u8 × 128 | order | The pattern played at each position. |
Title
The first 20 bytes are the song title, as single-byte text padded with zero bytes. A title of exactly 20 characters has no zero after it.
Sample headers
From offset 20 come 15 sample headers of 30 bytes each. Sample numbers in the patterns count from 1, so the header of sample n is at 20 + (n − 1) × 30, and sample 15’s ends at 470. A sample that is not used has a length of 0.
| Offset | Size | Type | Name | Description |
|---|---|---|---|---|
| 0 | 22 | text | name | The sample name, padded with zero bytes. Often the name of the sample disk and the sound, as in st-02:snare14. |
| 22 | 2 | u16 | length | The length in words of 2 bytes, so the data is 2 × length bytes. 0 means no sample. |
| 24 | 1 | u8 | finetune | Unused: 0. |
| 25 | 1 | u8 | volume | The default volume, 0 to 64 (40). |
| 26 | 2 | u16 | loop start | Where the loop starts, in bytes from the start of the sample. |
| 28 | 2 | u16 | loop length | The length of the loop in words. 1 means no loop. |
Samples could be at most 9,999 bytes long in Ultimate Soundtracker; Master Soundtracker 1.0 and D.O.C. Soundtracker 2.0 allowed 32 KB (OpenMPT). The explorer turns down a file with a sample longer than 37,000 words, well beyond any of those limits.
00000014 73 74 2D 30 31 3A 73 74 72 69 6E 67 73 00 00 00 st-01:strings...
00000024 00 00 00 00 00 00 0F A0 00 40 0B B8 03 E8 .........@....
| Bytes | Field | Value |
|---|---|---|
73 74 … 00 | name | “st-01:strings”, then 9 zero bytes to make 22 |
0F A0 | length | 4,000 words, 8,000 bytes |
00 | finetune | 0, as always |
40 | volume | 64 |
0B B8 | loop start | 3,000 bytes |
03 E8 | loop length | 1,000 words, 2,000 bytes: the loop is bytes 3,000 to 4,999 |
Finetune
Soundtracker has no finetune, and byte 24 of every sample header is 0. The byte was given a meaning only by ProTracker, in the 31-sample format. A non-zero byte here is a sign that the file is not a Soundtracker module: the explorer’s test counts it heavily against the file, and reports it in a file it accepts.
Loops
Soundtracker counts the loop start in bytes and the loop length in words. OpenMPT’s loader says it plainly: “Loop start is always in bytes, not words”. Later trackers count both in words, so a reader that treats a Soundtracker file as a ProTracker one puts every loop at twice its real start.
A looped sample also plays differently. OpenMPT notes that looped samples in Ultimate Soundtracker “seem to ignore all sample data before the actual loop start”: a sample with a loop plays only its loop, from the first note on. The explorer plays them that way:
- If the loop length is 1, there is no loop: the sample plays once, from its start to its length.
- If the loop length is more than 1, the sample plays from byte
loop startforloop lengthwords, and repeats that for as long as the note lasts. Data before and after the loop is never played.
In the example above, the sample plays bytes 3,000 to 4,999 over and over; its first 3,000 bytes and last 3,000 bytes are not heard. A loop that ends after the end of its sample is a fault of the file, which the explorer reports.
Song length
The byte at offset 470 is the number of positions in the song, 1 to 128: positions 0 to song length − 1 of the order table are played, in order. A value of 0 or above 128 turns the file down.
Tempo
From Ultimate Soundtracker 1.8 (April 1988), the byte at offset 471 is the tempo, a setting for the Amiga’s CIA timer, which runs at 709,379 Hz on a PAL Amiga. Each tick then lasts
tick = (240 − tempo) × 122 / 709,379 seconds
BPM = 709,379 × 125 / 50 / ((240 − tempo) × 122) = 1,773,447.5 / ((240 − tempo) × 122)
as OpenMPT converts it. The values 120 (78) and 0 mean the standard tempo,
and OpenMPT plays them at 125 BPM, 50 ticks a second; 120 is the standard value. A
higher value is a faster tempo. OpenMPT turns a file down if the byte is
above 220, and so does the explorer.
| Tempo byte | Ticks a second | BPM |
|---|---|---|
| 0 or 120 | 50 (standard) | 125 |
| 100 | 41.5 | 103.8 |
| 150 | 64.6 | 161.5 |
| 180 | 96.9 | 242.3 |
| 200 | 145.4 | 363.4 |
| 220 | 290.7 | 726.8 |
Versions of Soundtracker differed here: some dropped the variable tempo and D.O.C. Soundtracker IX brought it back (OpenMPT). In the 31-sample format the same byte became NoiseTracker’s restart position, and some converted files still carry 120 there.
Order table
The 128 bytes from offset 472 are the number of the pattern played at each position.
Only the first song length entries are played. Soundtracker has at most 64
patterns, so every entry is 0 to 63; a higher one turns the file down.
The number of patterns stored in the file is one more than the highest number in all 128 entries, including those after the song length.
000001D6 04 78 00 01 02 01 00 00 00 00 …
The song is 4 positions long, at the standard tempo (78), and plays
patterns 0, 1, 2 and 1. The highest entry is 2, so 3 patterns are stored, and the
sample data starts at 600 + 3 × 1,024 = 3,672.