Offsets on this page are relative to a block’s content, which starts with its two-byte
content type. “The block’s end” is content
offset block_size. Strings are a 32-bit length followed by the characters.
Unless the page says otherwise, values follow the session’s byte order.
Session sample rate
Block 0x1028 holds the rate as a 32-bit value at content offset 4. ptformat
accepts 44,100 to 192,000.
Audio files
Block 0x1004 holds the file list. Its count of files is the 32-bit value at
content offset 2, and its child 0x103A holds the names. The entries start
at offset 11 of that child, each being:
| Field | Size | Meaning |
|---|---|---|
| Name | 4 + length | String: the file name |
| Type | 4 | Four characters: WAVE, AIFF, MXFf, or the same reversed (EVAW, FFIA, fFXM) |
| Other | 5 | Skipped by ptformat |
Names containing .grp, Audio Files or Fade Files
are skipped. From version 10, an entry may have a zero type, and then its name must
contain .wav, .aif or .mxf. Accepted files are
numbered in order; this number is how regions refer to them.
Each 0x1003 child of the list, in order, has a 0x1001 child
whose 64-bit value at content offset 8 is that file’s length in samples.
Region positions
Regions store three values, an offset, a length and a start, in a packed form: each is 1 to 5 bytes wide, with its width given elsewhere in the same record. All the values are little-endian, whatever the session’s byte order. Starting at position j:
| Field | Little-endian session | Big-endian session |
|---|---|---|
| Offset width | high nibble of byte j+1 | byte j+4 |
| Length width | high nibble of byte j+2 | byte j+3 |
| Start width | high nibble of byte j+3 | byte j+2 |
The values follow each other from j+5: the offset, then the length, then the start, each using the width given for it. A width of 0 means the value is 0.
Audio regions
Audio regions are entries in a list block: 0x100B holding
0x1008 entries in version 5, or 0x262A holding
0x2629 entries from version 10. In each entry, a string at content offset 11
is the region name, and the three-point values follow it. The 32-bit value at the block’s
end is the audio file number.
Tracks
Audio tracks are 0x1014 blocks inside 0x1015. A string at
content offset 2 names the track. After the name and one more byte is a 32-bit channel
count, then one 16-bit channel number per channel.
MIDI tracks are 0x251A blocks inside 0x2519, with the name at
content offset 4. A track that matches an audio track by number and name is the same
track.
ptformat removes tracks numbered 65,535 and renumbers the rest.
Placing regions on tracks
| Sessions | Block chain | Fields of the innermost block |
|---|---|---|
| Audio, versions 5 to 9 | 0x1012 → 0x1011 → 0x100F → 0x100E | Region number: 32 bits at content offset 4 |
| Audio, version 8 onwards | 0x1054 → 0x1052 → 0x1050 → 0x104F | Region number: 32 bits at offset 4; start: 32 bits at offset 9. A byte 0x01 at offset 46 of the 0x1050 entry marks a fade, which ptformat drops. |
| MIDI | 0x1058 → 0x1057 → 0x1056 → 0x104F | Region number: 32 bits at offset 4; start: 40 bits at offset 9, as an absolute difference from zero ticks. |
MIDI events
Block 0x2000 holds events. A reader searches it for the five bytes
MdNLB, moves 11 bytes on from its start and reads a 32-bit event count. The
events follow, 35 bytes each, and the 40-bit position of the first event is used as the
zero point.
| Offset | Size | Field | Meaning |
|---|---|---|---|
| 0 | 5 | Position | Ticks, less the zero point |
| 8 | 1 | Note | MIDI note number |
| 9 | 5 | Length | Ticks |
| 17 | 1 | Velocity |
All these fields are little-endian. ptformat treats a value of
0xE8D4A51000, 1012 ticks, as the zero position of a MIDI
timeline.
MIDI regions are in 0x2002 holding 0x2001 entries (version 5)
or 0x2634 holding 0x2633 entries (version 10). A nested
0x1007 or 0x2628 has a name string at content offset 2, the
three-point data after it, and at the block’s end a 32-bit index into the list of event
chunks.
Compound regions
Block 0x262C holds 0x262B groups, which hold
0x2628 blocks. A group’s name and positions are read as for a region, and a
16-bit count of elements is at two bytes past the end of the block’s content.
Each 0x2523 element has a 32-bit region number at content offset 39, and
40-bit start and stop positions at offsets 51 and 59, less the zero point. ptformat
reads these but does not use them, so its compound region support is incomplete.
Not confirmed
- The purpose of the skipped bytes in the file and event records.
- MIDI layouts in versions 5 to 7, which ptformat lists as unconfirmed, and compound regions in versions 10 and later.
- Tempo, automation, plug-in settings and everything else ptformat does not read.