TTA

From Hydrogenaudio Knowledgebase
Revision as of 17:21, 7 July 2023 by Porcuswiki (Talk | contribs)

Jump to: navigation, search

The True Audio (TTA) is a lossless audio codec. It is distributed as a free open-source (GPL/LGPL) encoder/decoder and library for several operating systems. The TTA project also includes DirectShow filters and plugins for several audio players, including foobar2000.

It is not known whether the project is abandoned. ffmpeg has an encoder/decoder that remedies some of the reference encoder/decoder's shortcomings – others, like the lack of channel allocation mask, are limitations of the format. An announced development of a "TTA2" format has passed with no known updates since 2010.[1]

TTA has a couple of unique properties: one is encryption with password protection, and also TTA chose (since around 2004) not to offer options to tune compression/CPU load; there is one setting. These properties have some appeal in certain applications, outside which TTA seems to have a fairly limited userbase. ffmpeg's TTA encoder also produces the very same files as the reference encoder does, up to the tags (and, certain signals are accepted only by one of the encoders), and ffmpeg supports the password functionality.

Performance-wise, TTA has been measured around WavPack between default and -h on CD audio signals[2] – putting it on what traditionally has been considered on the fast encoder side rather than the heavy compression (Monkey's Audio/OptimFROG) side. One codec (TAK) could beat TTA simultaneously on both encoding speed, decoding speed and file size.


Features

For an end-user considering TTA as an audio format, the following features are quite common among lossless codecs, except for password protection. Some competing formats are lacking certain of these features, and some are free from certain of the limitations listed. To compare TTA with other lossless codecs, see HA Wiki's Lossless Codec Comparison.

  • Seekable and streaming playback.
  • High-resolution audio support: the format supports 24 bits per sample, at any WAVE sampling rate (integers up to 4 GiHz; although the encoders may stop short of the 4 GiHz mark – ffmpeg at 2 GiHz – this limitation is hardly relevant for audio).
  • Multichannel support, however with limitations (see below). Currently the reference encoder supports up to six channels, while the ffmpeg implementation supports 16.
  • Piping support.
  • Tagging: APEv2 or ID3v1/2.
  • Unicode support.
  • Embedded CUE sheets support.
  • Can be used in the Matroska container.
  • Password-protected encryption.

The lack of encoding options may be a limitation or sometimes considered a feature: a given music signal corresponds to precisely one (unencrypted) TTA bit stream – no matter whether one uses the reference encoder or ffmpeg. Metadata sections may of course differ, but the audio data part of the file depends only on input signal (and, if applicable, encryption password).

Limitations

The following list is in part based the format properties as claimed on the official site, and in part on currently (2023) available implementations – some as revealed by tests in the Hydrogenaudio forums. As development

  • Bad error handling in the available implementations.[3] Errors will upon playback lead to full-volume static noise played back, at worst for the rest of the file. Only the most severe errors seem to be detected by the reference decoder. Testing reveals that ffmpeg can detect errors the reference decoder cannot, and might drop more defective frames, but ffmpeg might still play back static unmuted. The lack of (MD5) audio checksum is a more severe shortcoming when the capability to detect errors by other means is so limited; there seems to be no reliable way implemented to mass scan a collection for corrupted files, although the format apparently provides for it.
  • The existing implementations have limitations for non-CDDA signals:
    • Bit depth: The format supports 8, 16 or 24 bit files only (32 is not supported, neither integer nor float) – and 8-bit signals are only supported in ffmpeg's implementation, not in the the reference encoder/decoder (nor the official foobar2000 playback component). An earlier incarnation of the format did support floating-point signals; that was apparently dropped circa 2004, and it is not known how to decode those files.
      Non-integer byte depths (say 20 valid bits in a 24-bit WAVE container) are not well supported. Testing with 20-bit WAVE files has provoked the reference encoder into either of the following three: rejecting the file altogether; producing undecodeable files; silently upconverting to 24 bits, losing any information that it was ever 20 bits (ffmpeg appears to always do this). In the latter case, TTA will not compress it well, as it is unable to make use of "wasted bits": other codecs can detect that bits 21 to 24 are zero and compress a 20-bit signal virtually without penalty. (See van Beurden's lossless comparison, section 2.3.)
    • Limitations in multichannel support: Although the TTA format claims support for up to 65536 channels, no implementation seems to support more than 16 (ffmpeg), the reference implementation being capped at 6. Furthermore, there seems to be no rule (neither WAVEFORMATEXTENSIBLE nor elsewhere) to interpret what channels are encoded. A player cannot know whether a three-channel TTA file is supposed to be 2.1 or 3.0, or a five-channel file a 5.0 or a 4.1. Also, in van Beurden's comparison, TTA fared worse on multichannel material than on stereo.
    • The reference encoder is picky about input files, only supporting some versions/generations of the WAVE format (no AIFF) and requiring workarounds at 2 GiB input size. Also the reference implementation might truncate too large files. These issues can be circumvented by using ffmpeg instead.
  • Metadata:
    • TTA might be the lossless format most likely to suffer from tagging ambiguity. While there are other formats which can (like MP3) accommotate both ID3 and APEv2 tags, applications seem to have converged to APEv2 for other lossless formats which accept it, and both ffmpeg's TTA encoder and foobar2000 will try to enforce APEv2 in TTA. However, a tagger like MusicBrainz Picard will treat TTA files as MP3 files, defaulting to ID3v1&ID3v2.3 while ignoring any APEv2. Apparently Mp3tag will write ID3 to an untagged .tta file, but ignore ID3 when APEv2 is already present.
    • Although ffmpeg can transfer tags upon conversion in the usual way (to APEv2 when encoding), the reference encoder/decoder cannot.
    • There is no provision for (R)IFF chunks; i.e. TTA cannot store nor recreate non-audio chunks of the original file. That means that one limitation of ffmpeg – that it drops RIFF chunks – is moot for TTA, which could not store them in any case.
  • Its unique feature – password protection – seems to be unsupported in players.
  • Just as the lack of options might be useful in specialized applications, other users will find it a limitation. However, one may argue that by 2023, performance differences are less of an issue even if there is no way to speed up neither encoding nor decoding (which takes even more time than encoding, a property nowadays only shared by Monkey's Audio).
  • Like most lossless formats, TTA has no functionality for hybrid lossless/lossy encoding. For TTA, there is also no way (for power users!) to hack a hybrid solution by way of LossyWAV.

Hardware support is limited outside Rockbox. The TTA website lists a few other hardware players with TTA support.[4] However with ffmpeg on devices, the distinction between «hardware» and «software» support is arguably less clear.

Using TTA

For several purposes, one might rather use ffmpeg than the reference encoder – at least for 16 bit signals.

Links

  1. Format description, archived 2010-07-27
  2. Martijn van Beurden's comprehensive lossless comparison, version 5
  3. HA forum discussion (2022) on codecs' error handling
  4. http://tausoft.org/wiki/True_Audio_Codec_Support

Additional sources: