The patterns hold the notes. Each is a grid of 64 rows with one column for each channel, and each cell says which sample to play, at what pitch and with what effect. The patterns are stored straight after the header, from offset 1084; the signature gives the number of channels, C, and so the size of every row and pattern.
Patterns
Every pattern is 64 rows of 4 × C bytes, 256 × C bytes in all: 1,536 bytes for 6 channels, 2,048 for 8, 7,168 for 28. 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. The cell for pattern p, row r and channel c (counting channels from 1) is at
1084 + p × 256 × C + r × 4 × C + (c − 1) × 4
In an 8-channel module, row 1 of pattern 2 channel 5 is at 1084 + 4,096 + 32 + 16 = 5,228.
Rows
A row is one 4-byte cell for each channel, channel 1 first: 4 × C bytes. All the 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).
+00 00 FE 80 00 00 00 00 00 00 00 00 00 00 00 00 00
+10 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0F 7D
A-2 08 ... on channel 1, and F7D (tempo 125) on channel 8The first cell is from an 8CHN file examined for this site; the rest of
the row is built for this page.
Cells
A cell is 4 bytes, a b c d, the same as in a 4-channel module:
a: ssss pppp s = high 4 bits of the sample number, p = period bits 11–8
b: pppp pppp period bits 7–0
c: ssss eeee s = low 4 bits of the sample number, e = effect (0–F)
d: xxxx yyyy effect parameter
| Value | From the bytes | Meaning |
|---|---|---|
| sample | (a & 0xF0) | (c >> 4) | 1 to 31; 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. |
| parameter | d | The effect’s parameter, often read as two nibbles x and y. |
| Cell | Sample | Period | Effect | Shown as |
|---|---|---|---|---|
00 FE 80 00 | 8 | 0FE = 254 | none | A-2 08 ... |
15 4D 20 00 | 10 | 2 = 18 | 54D = 1357 | none | E-0 18 ... |
00 00 00 00 | none | none | none | --- .. ... |
The second cell, built for this page, has a period from octave 0, below ProTracker’s
range (see the table below). The explorer names a period that is not in the table
after the nearest note when it is within a quarter tone of it, and shows
??? otherwise.
Periods
The pitch is stored as an Amiga period: the number of cycles of the Amiga’s colour clock, 3,546,895 Hz on a PAL Amiga, that each sample byte is held for. A note plays its sample at 3,546,895 / period bytes a second; C-2, period 428, at about 8,287.
ProTracker names three octaves, C-1 to B-3, periods 856 to 113. PC trackers also write an octave below and an octave above, which ProTracker’s tables do not cover. The files examined for this site include a 28-channel module that uses octave 0 throughout. With finetune 0:
| C | C# | D | D# | E | F | F# | G | G# | A | A# | B | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Octave 0 | 1712 | 1616 | 1525 | 1440 | 1357 | 1281 | 1209 | 1141 | 1077 | 1017 | 961 | 907 |
| 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 |
| Octave 4 | 107 | 101 | 95 | 90 | 85 | 80 | 76 | 71 | 67 | 64 | 60 | 57 |
Within octaves 1 to 3, ProTracker keeps a row of 36 periods for each finetune, and a note is played by finding the first finetune 0 entry the cell’s period is not below and taking the entry at the same place in the row of the sample’s finetune. The rows, from C-1 to B-3, in the order of the finetune nibble:
0: 856 808 762 720 678 640 604 570 538 508 480 453 428 404 381 360 339 320 302 285 269 254 240 226 214 202 190 180 170 160 151 143 135 127 120 113
+1: 850 802 757 715 674 637 601 567 535 505 477 450 425 401 379 357 337 318 300 284 268 253 239 225 213 201 189 179 169 159 150 142 134 126 119 113
+2: 844 796 752 709 670 632 597 563 532 502 474 447 422 398 376 355 335 316 298 282 266 251 237 224 211 199 188 177 167 158 149 141 133 125 118 112
+3: 838 791 746 704 665 628 592 559 528 498 470 444 419 395 373 352 332 314 296 280 264 249 235 222 209 198 187 176 166 157 148 140 132 125 118 111
+4: 832 785 741 699 660 623 588 555 524 495 467 441 416 392 370 350 330 312 294 278 262 247 233 220 208 196 185 175 165 156 147 139 131 124 117 110
+5: 826 779 736 694 655 619 584 551 520 491 463 437 413 390 368 347 328 309 292 276 260 245 232 219 206 195 184 174 164 155 146 138 130 123 116 109
+6: 820 774 730 689 651 614 580 547 516 487 460 434 410 387 365 345 325 307 290 274 258 244 230 217 205 193 183 172 163 154 145 137 129 122 115 109
+7: 814 768 725 684 646 610 575 543 513 484 457 431 407 384 363 342 323 305 288 272 256 242 228 216 204 192 181 171 161 152 144 136 128 121 114 108
-8: 907 856 808 762 720 678 640 604 570 538 508 480 453 428 404 381 360 339 320 302 285 269 254 240 226 214 202 190 180 170 160 151 143 135 127 120
-7: 900 850 802 757 715 675 636 601 567 535 505 477 450 425 401 379 357 337 318 300 284 268 253 238 225 212 200 189 179 169 159 150 142 134 126 119
-6: 894 844 796 752 709 670 632 597 563 532 502 474 447 422 398 376 355 335 316 298 282 266 251 237 223 211 199 188 177 167 158 149 141 133 125 118
-5: 887 838 791 746 704 665 628 592 559 528 498 470 444 419 395 373 352 332 314 296 280 264 249 235 222 209 198 187 176 166 157 148 140 132 125 118
-4: 881 832 785 741 699 660 623 588 555 524 494 467 441 416 392 370 350 330 312 294 278 262 247 233 220 208 196 185 175 165 156 147 139 131 123 117
-3: 875 826 779 736 694 655 619 584 551 520 491 463 437 413 390 368 347 328 309 292 276 260 245 232 219 206 195 184 174 164 155 146 138 130 123 116
-2: 868 820 774 730 689 651 614 580 547 516 487 460 434 410 387 365 345 325 307 290 274 258 244 230 217 205 193 183 172 163 154 145 137 129 122 115
-1: 862 814 768 725 684 646 610 575 543 513 484 457 431 407 384 363 342 323 305 288 272 256 242 228 216 203 192 181 171 161 152 144 136 128 121 114
A few values are ProTracker’s own and not what a formula gives: finetune −7 has 675 for E-1, −4 has 494 for A#-1 and −1 has 203 for C#-3.
Notes outside ProTracker’s range
ProTracker’s table has no entries for octaves 0 and 4, so ProTracker could not play such a module as written: it would fold an octave 0 note into its table, playing 1,712 as 856. These modules come from PC trackers, so the explorer plays them in a way of its own, not ProTracker’s: a period below 113 or above 856 keeps the value it was written with, moved by the sample’s finetune; slides run from 57 to 1,712 instead of 113 to 856; and an arpeggio on such a note works by the ratio between semitones rather than by looking up the table.