A TTA file begins with a fixed header and a seek table, then its frames. ID3v2 data may come before the header, and ID3v1 or APEv2 tags after the frames. Numbers are little-endian. This page follows the format description published by the codec’s authors, and FFmpeg’s reader.
TTA1 header
| Offset | Size | Type | Field | Meaning |
|---|---|---|---|---|
| 0 | 4 | char[4] | Signature | TTA1 |
| 4 | 2 | uint16 | Audio format | See below |
| 6 | 2 | uint16 | Channels | Number of channels |
| 8 | 2 | uint16 | Bits per sample | 8, 16 or 24 |
| 10 | 4 | uint32 | Sample rate | In hertz |
| 14 | 4 | uint32 | Data length | Samples per channel in the file |
| 18 | 4 | uint32 | CRC-32 | Of the first 18 bytes |
| Audio format | Meaning |
|---|---|
| 1 | Simple |
| 2 | Encrypted: decoding needs the password |
The CRC is the usual reflected CRC-32, with the polynomial 0xEDB88320.
Frame length and count
The frame length is fixed by the sample rate. The published frame time is 1.04489795918367346939 seconds, which is 256/245:
frame length = 256 × sample rate ÷ 245
last frame = data length mod frame length
frame count = data length ÷ frame length, plus 1 if the last frame is not empty
Seek table
The table follows the header directly.
| Offset | Size | Type | Field | Meaning |
|---|---|---|---|---|
| 22 | 4 × frames | uint32[] | Seek points | The compressed size in bytes of each frame, including its CRC |
| after those | 4 | uint32 | CRC-32 | Of the seek points |
Each frame’s position is the end of the table plus the sizes of the frames before it. A file whose table is damaged can still be decoded, but not seeked.
Worked example
One minute of 16-bit stereo at 44,100 Hz is 2,646,000 samples per channel:
54 54 41 31 TTA1
01 00 format 1
02 00 2 channels
10 00 16 bits
44 AC 00 00 44100
F0 5F 28 00 2646000
xx xx xx xx CRC-32 of the 18 bytes above
The frame length is 256 × 44100 ÷ 245 = 46,080 samples. 57 frames hold 2,626,560 samples and leave 19,440 for the last, so there are 58 frames. The table is 58 × 4 + 4 = 236 bytes, and the first frame starts at offset 22 + 236 = 258.
Draft TTA2
The authors’ description also gives a TTA2 format, marked as in development. Whether it was ever released could not be confirmed, and the channel mask values are on a page that could not be read.
| Offset | Size | Field | Meaning |
|---|---|---|---|
| 0 | 4 | Signature | TTA2 |
| 4 | 2 | Channels | Number of channels |
| 6 | 2 | Bits per sample | |
| 8 | 4 | Sample rate | In hertz |
| 12 | 4 | Channel mask | Channel locations |
| 16 | 8 | Data length | In samples; may be 0 |
| 24 | 8 | Data size | In bytes; may be 0 |
| 32 | 4 | CRC-32 |
In TTA2 a frame ends with the signature FF FF FE, then a CRC-32. The seek table is a footer: the signature FF FF FF, the seek points, then a CRC-32.