Once the XOR has been undone, a session
is a tree of blocks from offset 20 to the end of the file. Multi-byte fields follow the
byte order given at header offset 0x11, with the exceptions noted on the
data page.
Block header
| Offset | Size | Name | Meaning |
|---|---|---|---|
| 0 | 1 | marker | 0x5A, ASCII Z |
| 1 | 2 | block_type | Its meaning is unknown. A value with the high byte set is rejected. |
| 3 | 4 | block_size | Bytes of content, counted from offset 7 |
| 7 | 2 | content_type | What the block holds; see below. ptformat defines a maximum of 0x3000. |
The block’s content starts at offset 7, with the content_type as its first
two bytes. A block is rejected if it would run past the end of its parent or the file.
Nesting
A reader walks the top level from offset 20, moving forward by
block_size + 7 after each block. Inside a block, it scans its content
byte by byte from content offset 1 for further blocks, moving forward by
child.block_size + 7 after each valid child. The tree therefore has no
count of children, and depends on the marker byte.
Finding the version
ptformat looks for a block at offset 0x1F of the decoded file.
What is at 0x1F | Version |
|---|---|
| No valid block | Byte 0x40. If that is zero, byte 0x3D. If that is zero too, byte 0x3A plus 2. |
A block with content type 0x0003 (older sessions) | At content offset 3 is a length-prefixed string. Skip it and 8 more bytes (string length + 8), then read a 32-bit version. |
A block with content type 0x2067 (newer sessions) | The 32-bit value at content offset 20, plus 2. |
ptformat loads versions 5 to 12 only.
Content types
ptformat names these. It does not describe how most of them are laid out; those it reads are on the data page.
| Code | ptformat’s description |
|---|---|
0x0003 | Version information, in older sessions (used, not described) |
0x0030 | Product and version |
0x1001 | Audio file sample rate and size |
0x1003 | Audio file metadata |
0x1004 | Full list of audio files |
0x1007 | Region name and number |
0x1008 | Audio region name and number (version 5) |
0x100B | Audio region list (version 5) |
0x100E | Region reference in a track map (used, not described) |
0x100F | Audio region to track entry |
0x1011 | Audio region to track map entries |
0x1012 | Full audio region to track map |
0x1014 | Audio track name and number |
0x1015 | Audio tracks |
0x1017 | Plug-in entry |
0x1018 | Full list of plug-ins |
0x1021 | Input or output channel entry |
0x1022 | Input and output channel list |
0x1028 | Session sample rate |
0x103A | Audio file names |
0x104F | Audio region to track sub-entry (version 8) |
0x1050 | Audio region to track entry (version 8) |
0x1052 | Audio region to track map entries (version 8) |
0x1054 | Full audio region to track map (version 8) |
0x1056 | MIDI region to track entry |
0x1057 | MIDI region to track map entries |
0x1058 | Full MIDI region to track map |
0x2000 | MIDI events |
0x2001 | MIDI region name and number (version 5) |
0x2002 | MIDI region map (version 5) |
0x2067 | Path of the session |
0x2511 | “Snaps” block |
0x2519 | Full MIDI track list |
0x251A | MIDI track name and number |
0x2523 | Compound region element |
0x2602 | Input or output route |
0x2603 | Input and output routing table |
0x2628 | Compound region group |
0x2629 | Audio region name and number (version 10) |
0x262A | Audio region list (version 10) |
0x262B | Compound map group (used, not described) |
0x262C | Full compound region map |
0x2633 | MIDI region name and number (version 10) |
0x2634 | MIDI region map (version 10) |
0x271A | Marker list |
Any other value is an unknown content type. Blocks not listed here do occur in real sessions, holding the parts of a session that are not publicly understood.
Not confirmed
- What
block_typemeans. - The layout of plug-in, routing, “Snaps” and marker blocks, and of tempo and mixer data.