A .pt3 is a score for the ZX Spectrum's AY-3-8910: three square-wave channels, one envelope, one noise generator. There is no PCM anywhere. A "sample" is a table of per-tick settings (volume, tone offset, noise, which mixers are on) and an "ornament" a table of semitone offsets, and a note is a pointer into both. The file was made to be loaded at a known address and played in place, so every pointer in it is an absolute offset, 16 bits, and the whole file can be tiled by sorting them: each region begins where a pointer says and ends where the next one begins.
Ninety-nine bytes of text, then the numbers. The signature is thirty
characters that name the tracker; the name and the author are thirty-two each with
by between them, so the text reads as a sentence.
The position list is stored times three. Each byte after the pointer tables is a pattern number multiplied by 3, because a Z80 player used it directly as an index into the pattern table's six-byte rows without a multiply. The list ends at 0xFF.
Where the header's pattern pointer lands: for each pattern, three 16-bit absolute offsets, one per channel, each to a stream of notes and effects. Two patterns may point at the same stream. The count of patterns is not stored; it is one more than the highest number in the position list.
A sample record is a loop point, a length, and that many four-byte rows, one per tick: mixer and envelope flags, the volume with accumulate bits, and a signed 16-bit tone offset. An ornament is a loop point, a length, and that many signed bytes of semitone offset. Both declare their own size, which the walk checks against the room to the next pointer.
Each channel of each pattern is a stream of one-byte commands with the occasional operand: notes in 0x50-0xAF, volume in 0xC1-0xCF, ornament-and-sample in 0xF0-0xFF followed by a sample byte, speed as 0xB1 and a byte, rest and release, and 0x00 to end. The stream is decoded by playing it; the walk sizes it by the next pointer, which is what the pointers are for.
PT2, the tracker before, is the same design with the header the other way round and nothing at offset zero to read:
With nothing to sniff, a PT2 is identified by its arithmetic: the position count and the list agree, every pointer lands inside the file, and the first pointed region begins exactly where the position list ends. A file that fails any of those is not called a PT2, which means a PT2 cut short is refused rather than guessed at.
STC is the Sound Tracker 1.x module as its Song Compiler wrote it, the format PT2 and PT3 grew out of. No magic. The header is 27 bytes of pointers and the four blocks come in a fixed order with fixed record sizes, so the file tiles by arithmetic up to the pattern table and by pointers after it:
SONG BY ST COMPILE; then the module's sizeRecords carry their own numbers, so sample 9 can follow sample 7 with nothing between. Some compilers write the ornaments before the positions block; the pointers say which, and each block ends where the next begins either way. Some leave a line of text before the pattern table; it is the author's, and it is reported as a comment.
ProTracker 3. or Vortex Tracker II at offset
zero. The older Spectrum trackers (PT2, Sound Tracker, ASC) have no text signature and are
identified by their pointer arithmetic instead; this is the one that says its name.