- Codec Overview
- Compression Theory
- Format Description
- Codec Comparisons
- Codec Implementation
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. Free and fully-functional for any use. It has a very simple structure. The TTA file header 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 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||TTA2 headers (in development)|
1 In TTA1 the Seek table is located at the start of the file, following the meta-data block.
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||TTA2 frame (in development)|
The frame duration in the TTA1 format is fixed at about one second. Therefore, every frame in a stream has an equal count of samples, except for the last. The sample count in a TTA1 frame is a multiple to 576 (sound buffer granule). Based on this, the "frame time" is defined as a constant 1.04489795918367346939. Thus, the sample count in a regular TTA1 frame determined as:
regular TTA1 frame length = frame time * sample rate
In theory, the frame duration in the TTA2 format can be any length, but for ease of use is defined equal to one second. Thus, the sample count in a standard TTA2 frame determined by sample rate.