The patterns hold the notes of the song’s 8 channels. On disk, though, every pattern is an ordinary 4-channel one of 1,024 bytes, and two of them together make one 8-channel pattern. They are stored straight after the header, from offset 1084.
Pattern pairs
Stored patterns are numbered from 0 in the order they appear. Pattern 2n holds channels 1 to 4 of the n-th 8-channel pattern, and pattern 2n + 1 holds channels 5 to 8. Each half has 64 rows of 4 cells, so row r of the 8-channel pattern is row r of the even half followed by row r of the odd half.
1084Stored pattern 0 pair 0, channels 1 to 41,024 bytes2108Stored pattern 1 pair 0, channels 5 to 81,024 bytes3132Stored pattern 2 pair 1, channels 1 to 41,024 bytes4156Stored pattern 3 pair 1, channels 5 to 81,024 bytes…… and so on
The order table names the even pattern of the pair, so an entry of 4 plays stored patterns 4 and 5 together. To find the cell for 8-channel pattern n, row r and channel c (1 to 8):
stored pattern = 2n when c is 1 to 4
= 2n + 1 when c is 5 to 8
offset = 1084 + stored × 1024 + r × 16 + ((c − 1) mod 4) × 4
For example, row 10 of 8-channel pattern 1, channel 6, is in stored pattern 3, at 1084 + 3,072 + 160 + 4 = 4,320. The explorer lists the stored patterns one by one, each labelled with its pair and half, and shows the song with the two halves side by side as 8 channels.
Rows
A stored row is 16 bytes: one 4-byte cell for each of the 4 channels of its half, the lowest channel first. The row as played is 8 cells, the even half’s 4 then the odd half’s 4, all played at the same moment; the rows follow each other every few ticks, as the speed says (see timing).
pattern 0, row 0 01 AC 10 00 00 00 00 00 00 00 00 00 00 00 00 00
pattern 1, row 0 00 00 00 00 00 D6 20 00 00 00 00 00 00 00 00 00
C-2 01 on channel 1 and C-3 02 on channel 6Cells
A cell is 4 bytes, a b c d, as in a ProTracker 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. |
In the row above, 01 AC 10 00 is sample 1 at period 1AC =
428 (C-2), and 00 D6 20 00 sample 2 at period 0D6 = 214
(C-3).
Periods
The pitch is 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, so a note plays at 3,546,895 / period bytes a second. Three octaves are used, C-1 to B-3, periods 856 to 113, written with finetune 0:
| 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 |
The explorer plays the notes as ProTracker does: it finds the first finetune 0 entry the cell’s period is not below, and takes the entry at the same place in ProTracker’s row for 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
StarTrekker’s own playback routine is not described in the sources used for these pages, so how closely it matches ProTracker’s tables is not known.