The patterns hold the notes. Each is a grid of 64 rows by 4 channels, and each cell says which sample to play, at what pitch and with what effect. The patterns are stored straight after the 600-byte header, and the order table says in which order they are played.
Patterns
Every pattern is 1,024 bytes: 64 rows of 16 bytes. They are stored in number order, pattern 0 first, with nothing between them; the number stored is one more than the highest number in the order table, at most 64. The cell for pattern p, row r and channel c (counting channels from 1) is at
600 + p × 1024 + r × 16 + (c − 1) × 4
This is 484 bytes earlier than in a 31-sample module, where the patterns start at 1084. A reader that takes a Soundtracker file for a ProTracker one reads its patterns from the wrong place, and takes the song length, the order table and the start of the first pattern for sample headers 16 to 31.
Rows
A row is 16 bytes: one 4-byte cell for each of the 4 channels, channel 1 first. All four cells of a row are played at the same moment, and the rows follow each other every few ticks, as the speed says (see timing).
00000258 01 AC 10 00 00 00 00 00 00 D6 30 00 00 00 0C 20
C-2 01 ... | --- .. ... | C-3 03 ... | --- .. C20Cells
A cell is 4 bytes, a b c d. With only 15 samples, the sample number fits in the top four bits of byte c, and the top four bits of byte a are 0:
a: 0000 pppp p = period bits 11–8
b: pppp pppp period bits 7–0
c: ssss eeee s = the sample number, e = effect (0–F)
d: xxxx yyyy effect parameter
| Value | From the bytes | Meaning |
|---|---|---|
| sample | c >> 4 | 1 to 15; 0 means no sample is given, and the channel keeps the one it has. |
| period | ((a & 0x0F) << 8) | b | The pitch, as a 12-bit Amiga period; 0 means no note. |
| effect | c & 0x0F | The effect number, 0 to F; what each means depends on the Soundtracker version. |
| parameter | d | The effect’s parameter. |
The 31-sample format later used the top four bits of a for a fifth bit of the sample number, which is why the two halves of the number sit apart. In a Soundtracker file they are always 0; the explorer’s test counts the cells of the first pattern where they are not, or where the period is outside 100 to 1,800, and turns the file down if there are more than 16.
| Cell | Sample | Period | Effect | Shown as |
|---|---|---|---|---|
01 AC 10 00 | 1 | 1AC = 428 | none | C-2 01 ... |
00 D6 30 00 | 3 | 0D6 = 214 | none | C-3 03 ... |
00 00 0C 20 | none | none | C, parameter 32 | --- .. C20 |
Periods
The pitch is an Amiga period: the number of cycles of the Amiga’s colour clock that each sample byte is held for. The clock runs at 3,546,895 Hz on a PAL Amiga and 3,579,545 Hz on an NTSC one, so a note plays its sample at 3,546,895 / period bytes a second on PAL; C-2, period 428, at about 8,287. Three octaves are used, C-1 to B-3, periods 856 down to 113:
| C | C# | D | D# | E | F | F# | G | G# | A | A# | B | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Octave 1 | 856 | 808 | 762 | 720 | 678 | 640 | 604 | 570 | 538 | 508 | 480 | 453 |
| Octave 2 | 428 | 404 | 381 | 360 | 339 | 320 | 302 | 285 | 269 | 254 | 240 | 226 |
| Octave 3 | 214 | 202 | 190 | 180 | 170 | 160 | 151 | 143 | 135 | 127 | 120 | 113 |
Soundtracker has no finetune. The explorer plays the notes with ProTracker’s lookup and its periods for finetune 0, the values above: a period that is not one of them is played as the first value in the table that is not above it.