Detailed description of the TTA multichannel audio data format
TTA is a simple and stable lossless audio data format for real-time compressing of digital music, using the lossless True Audio algorithm. Free and fully-functional for any use. The TTA has a very simple structure. The file header of TTA file contains a unique format identifier, which is followed by meta-data block. Meta-data block contains minimal information which is needed for restoring the original stream (including number of channels, count of bits per sample, sample rate and overall number of samples in file, etc.) and ended by a 32-bit control sum. Following that header, we write one or more audio frames. Each frame is ended by a 32-bit control sum; a decoder may start decoding from any TTA frame in the stream. The compressed samples of channels in a frame are located sequentially, as in a simple PCM data format.
TTA Header Structure
TTA1 header | |
---|---|
Byte number | Value (format) |
Stream header | |
00-03 | Format signature with version number (ASCII, "TTA1") |
04-05 | Audio format (binary, Little Endian) |
06-07 | Number of channels (binary, Little Endian) |
08-09 | Bits per sample (binary, Little Endian) |
10-13 | Sample rate (binary, Little Endian) |
14-17 | Data length in samples (binary, Little Endian) |
18-21 | CRC32 block footer (binary, Little Endian) |
Таблица поиска1 | |
22-25 | Seek point 1 (binary, Little Endian) |
26-X0 | .. .. .. .. .. .. .. .. .. .. .. .. .. .. |
X1-X4 | Seek point N (binary, Little Endian) |
X5-X8 | CRC32 block footer (binary, Little Endian) |
.. .. .. data .. .. .. |
TTA2 headers (in development) | |
---|---|
Byte number | Value (format) |
Stream header | |
00-03 | Format signature with version number (ASCII, "TTA2") |
04-05 | Number of channels (binary, Little Endian) |
06-07 | Bits per sample (binary, Little Endian) |
08-11 | Sample rate (binary, Little Endian) |
12-15 | Channel locations mask2 (binary, Little Endian) |
16-23 | Data length in samples (binary, Little Endian, may be zero) |
24-31 | Data size, bytes (binary, Little Endian, may be zero) |
32-35 | CRC32 block footer (binary, Little Endian) |
.. .. .. data .. .. .. | |
Stream footer (Seek table) | |
00-02 | End of stream signature (binary, "0xFFFFFF") |
03-06 | Seek point 1 (binary, Little Endian) |
07-X0 | .. .. .. .. .. .. .. .. .. .. .. .. .. .. |
X1-X4 | Seek point N (binary, Little Endian) |
X5-X8 | CRC32 block footer (binary, Little Endian) |
The quotient of overall count of samples and "frame length" defines the total number of frames in data stream. The seek table must have a number of seek-points equal to the number of frames in the stream. Each seek-point uses 4 bytes, contains the current frame data length in bytes and can be easily transformed into the Seek point value which specifies the location of the next frame. It is possible to decode TTA file with a corrupted seek table, but in "unseekable" mode only.
TTA Frame Structure
TTA1 frame | |
---|---|
Byte number | Value (format) |
00-X0 | Frame data (bit stream) |
X1-X4 | CRC32 block footer (binary, Little Endian) |
Regular frame length of TTA1 = frame time * sample rate.
TTA2 frame (in development) | |
---|---|
Byte number | Value (format) |
00-X0 | Frame data (bit stream) |
X1-X3 | End of frame signature (bit stream, "0xFFFFFE") |
X4-X7 | CRC32 block footer (binary, Little Endian) |
The total number of frames in data stream can be calculated as a quotient of overall count of samples and standard length of TTA frame. TTA format supports both of ID3v1/ID3v2 information tags, and also APEv2.