TTA: Difference between revisions

From Hydrogenaudio Knowledgebase
(General rewrite.)
(Update with the 2023 comparison, the independent rewrite, and higher precision in some of the text)
 
(4 intermediate revisions by the same user not shown)
Line 9: Line 9:
}}
}}


'''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 DirectShow filters and plugins for several audio players.  A third-party encoder/decoder is available through ffmpeg.
'''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, and with DirectShow filters and plugins for several audio players, including [[foobar2000]].   


TTA has one feature which apparently is unique among lossless codecs available to end-users, namely encryption with password protectionUnlike most other codecs, TTA has chosen not to offer options to tune compression/CPU load; there is ''one'' setting.   Performance-wise, it has been measured not far from the default to -hx [[WavPack]] settings on CD audio<ref>http://audiograaf.nl/downloads.html Martijn van Beurden's comprehensive lossless comparison, version 4</ref> - which in the trade-off between size, encoding speed and decoding speed, might be considered rather on the ''fast encoder'' side.
It is not known whether the project is abandonedThe codec sometimes identifies itself as "TTA1", and an announced development of a "TTA2" format has passed with no known updates since 2010.<ref>[https://web.archive.org/web/20100727022032/http://en.true-audio.com:80/TTA_Lossless_Audio_Codec_-_Format_Description Format description], archived 2010-07-27</ref>


TTA has a couple of unique properties: one is encryption with password protection, and that &ndash; apart from metadata &ndash; the bitstream is uniquely determined by the signal (and if applicable, the password). That is, ''one single setting'' with no encoding options for heavier / lighter compression / CPU load.  These properties have seen some appeal in certain applications, outside which TTA seems to have a limited userbase.
Performance-wise, TTA has been measured around [[WavPack]] between default and <code>-h</code> on CD audio signals<ref>[http://audiograaf.nl/downloads.html Martijn van Beurden's comprehensive lossless comparison, version 6, 2023]</ref> &ndash; putting it on what traditionally has been considered on the ''fast encoder'' side rather than the ''heavy compression'' ([[Monkey's Audio]]/[[OptimFROG]]) side.  In the most recent edition of the comparison, two codecs ([[TAK]] and, narrowly, [[FLAC]] after its recent performance improvements) could beat TTA simultaneously on all three tested parameters (encoding speed, decoding speed and file size) on the average signal tested. 
FFmpeg offers a third-party implementation which can encode and decode to higher channel count and accepts more input files than the official Windows encoder can do.  Also the foobar2000 component at foobar2000.org implements more features than the official version.  This wiki article aims at describing the features and limitations in the available end-user applications, rather than what the TTA ''format'' might accommodate (but nobody has implemented).  A 3rd party source code rewrite was posted in the Hydrogenaudio forums in 2023<ref>[https://hydrogenaud.io/index.php/topic,125048.0.html Hydrogenaudio forum post (2023) on codec rewrite]</ref><ref>[https://hydrogenaud.io/index.php/topic,125143.0.html Hydrogenaudio forum post (2023) on codec rewrite (library)] with [https://github.com/stseelig/libttaR github link]</ref>.
== Features ==  
== Features ==  
For an end-user considering TTA as a an audio format, the following features are quite common among lossless codecs.  Some competing formats are lacking certain of these features, and some are free from certain of the limitations listed.  To compare TAK with other lossless codecs, see [[Lossless_comparison| HA Wiki's Lossless Codec Comparison]].
From an end-user perspective, 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 [[Lossless_comparison| HA Wiki's Lossless Codec Comparison]].


* Streaming support
* Seekable and streaming playback.
* Error handling and  
* 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 &ndash; ffmpeg at 2 GiHz &ndash; this limitation is hardly relevant for audio).
* High-resolution audio support: up to 4 GHz sampling rate and 24 bits/channel
* Multichannel support, however with limitations (see below). Currently the reference encoder supports up to six channels, the ffmpeg implementation supports 16, and the unofficially modified foobar2000 component can handle 8.
* Multichannel support. Currently the reference encoder supports six channels, while the ffmpeg encoder supports 16. (However [https://docs.microsoft.com/en-us/windows/win32/api/mmreg/ns-mmreg-waveformatextensible WAVEFORMATEXTENSIBLE] is not supported.)
* Piping support.
* Piping support
* Tagging (APEv2 or ID3v1/2).
* Tagging: APEv2 or ID3
* Embedded CUE sheets support.
* Embedded CUE sheets support
* Unicode support.
* Can be used in the [[Matroska]] container
* Can be used in the [[Matroska]] container.
* Password protection
* Password-protected encryption.


TTA has some software support through player plugins (and ffmpeg-based players).  There is also certain limited hardware support, most notably through [[Rockbox]], and the TTA website lists a few other hardware players with TTA support.<ref>http://tausoft.org/wiki/True_Audio_Codec_Support</ref>
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 &ndash; no matter whether encoded with the reference encoder or ffmpeg. Metadata sections may of course differ.


=== Limitations ===
=== Limitations ===
* No support for RIFF chunks (i.e., TTA cannot store and recreate ''non-audio'' chunks of the original .wav files).
The following list is in part based on issues revealed by tests in the Hydrogenaudio forums, as per 2022 available implementations &ndash; the 2023 independent rewrite not tested and is known to handle more input files.
* The command-line encoder is picky about .wav files, not supporting all generations of the WAVE format; this can be circumvented by piping stdin to the encoder. 
* [https://hydrogenaud.io/index.php/topic,122094 Bad error handling.]<ref>[https://hydrogenaud.io/index.php/topic,122094 HA forum discussion (2022) on codecs' error handling]</ref> 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 scan a collection of files for corruption, although the ''format'' provides block checksums.
* Input must be either 8, 16 or 24 bits.  Unlike some other codecs, TTA is not able to make use of "wasted bits": other codecs can fit a 20-bit signal in a 24-bit container without penalty in compression size, but TTA appears unable to make use of the fact that the four least significant bits are zeroThus certain (non-CD) signals might compress a bit worse than among other formats (see van Beurden's lossless comparison, section 2.3.)
* The existing implementations have limitations for non-CDDA signals:
* No support for floating-point formats and no hybrid/lossy mode possible (for those, use [[WavPack]] or [[OptimFrog]]).  
** Bit depth: The format supports 8, 16 or 24 bit files &ndash; and 8-bit signals are only supported in ffmpeg's implementation, not in the the reference encoder/decoder (nor the official [[foobar2000]] playback component). Note, some old sources refer to 32-bit (floating-point) support; that was apparently dropped circa 2004, and it is not known how to decode such files, should they even exist. <br/>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. The foobar2000 component repository includes a component version that handles 8 channels (unlike the component provided by the TTA developers), and that component also honours the [https://docs.microsoft.com/en-us/windows/win32/api/mmreg/ns-mmreg-waveformatextensible WAVEFORMATEXTENSIBLE] tag to interpret what channels are encodedThis is an unofficial feature; the format itself offers no channel assignment (e.g., if a TTA file has three channels there is no rule to tell whether it is 2.1 or 3.0, and likewise there is no rule to tell whether a five-channel file a 5.0 or a 4.1 &ndash; the component implements support through a tag).  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 (and no other format than WAVE) 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 [https://en.wikipedia.org/wiki/MusicBrainz_Picard 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.
** 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 &ndash; that it drops RIFF chunks &ndash; is moot for TTA, which could not store them in any case. Note that ffmpeg will transfer tags upon conversion in the usual way (to APEv2 when encoding), but the reference encoder/decoder does not know tags in WAVE.
* Its unique feature &ndash; password protection &ndash; seems to be unsupported in ''players'', save for invoking ffplay from a command-line with the password typed in.
* 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 CPU power than encoding).
* 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]].  A few hardware players with TTA support have been around over the years<ref>http://tausoft.org/wiki/True_Audio_Codec_Support</ref> until Cowon exited the hardware player market.  However the distinction between &laquo;hardware&raquo; and &laquo;software&raquo; support is arguably less clear with ffmpeg-based players on smart devices. 
 
==Using TTA (missing: info about DirectShow) ==
At least for 16-bit signals, one might rather use ffmpeg than the reference implementation. Note that ffmpeg will, upon decoding to WAVE/AIFF, default to 16 bits regardless whether that is a lossy operation. (This is not specific to input source, and users should take care before using ffmpeg for lossless conversion.)


Because TTA - like MP3 and OptimFROG - can accommodate both APE tags and ID3, tagging ambiguity could be an issue: one application might not read another's tagsUsers might want to stick to one tag format. [[Mp3tag]] will write the same tagset to .tta files as to .mp3 files, possibly both ID3v1, ID3v2 and APE.
For foobar2000 playback, the component at the foobar2000 website has more features than the TTA developers' decoding component and is also available for 64-bit versions of the playerSince non-audio chunks are not stored in .tta files, foobar2000 just as well be the preferred software to convert .tta files unless one encounters > 8 channels.  


==Links==
==Links==
* [http://tausoft.org/wiki/True_Audio_Codec_Overview TTA Lossless Audio Codec - Tau Projects]
<references/>
Additional sources:
* [http://tausoft.org/wiki/True_Audio_Codec_Overview TTA Lossless Audio Codec &ndash; Tau Projects:] Codec overview at the official site.
* {{wikipedia|TTA (codec)}}
* {{wikipedia|TTA (codec)}}
* [https://www.foobar2000.org/components/view/foo_input_tta foobar2000 component at foobar2000.org]
* [[Lossless_comparison| HA Wiki's Lossless Codec Comparison]] originally by [[User:Rjamorim|Rjamorim]]  
* [[Lossless_comparison| HA Wiki's Lossless Codec Comparison]] originally by [[User:Rjamorim|Rjamorim]]  
<references/>


{{navbox audio codecs}}
{{navbox audio codecs}}


[[Category:Audio codecs]]
[[Category:Codecs]]
[[Category:Lossless audio codecs]]

Latest revision as of 17:51, 25 April 2024

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, and with DirectShow filters and plugins for several audio players, including foobar2000.

It is not known whether the project is abandoned. The codec sometimes identifies itself as "TTA1", and 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 that – apart from metadata – the bitstream is uniquely determined by the signal (and if applicable, the password). That is, one single setting with no encoding options for heavier / lighter compression / CPU load. These properties have seen some appeal in certain applications, outside which TTA seems to have a limited userbase.

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. In the most recent edition of the comparison, two codecs (TAK and, narrowly, FLAC after its recent performance improvements) could beat TTA simultaneously on all three tested parameters (encoding speed, decoding speed and file size) on the average signal tested.

FFmpeg offers a third-party implementation which can encode and decode to higher channel count and accepts more input files than the official Windows encoder can do. Also the foobar2000 component at foobar2000.org implements more features than the official version. This wiki article aims at describing the features and limitations in the available end-user applications, rather than what the TTA format might accommodate (but nobody has implemented). A 3rd party source code rewrite was posted in the Hydrogenaudio forums in 2023[3][4].


Features

From an end-user perspective, 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, the ffmpeg implementation supports 16, and the unofficially modified foobar2000 component can handle 8.
  • Piping support.
  • Tagging (APEv2 or ID3v1/2).
  • Embedded CUE sheets support.
  • Unicode 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 encoded with the reference encoder or ffmpeg. Metadata sections may of course differ.

Limitations

The following list is in part based on issues revealed by tests in the Hydrogenaudio forums, as per 2022 available implementations – the 2023 independent rewrite not tested and is known to handle more input files.

  • Bad error handling.[5] 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 scan a collection of files for corruption, although the format provides block checksums.
  • The existing implementations have limitations for non-CDDA signals:
    • Bit depth: The format supports 8, 16 or 24 bit files – and 8-bit signals are only supported in ffmpeg's implementation, not in the the reference encoder/decoder (nor the official foobar2000 playback component). Note, some old sources refer to 32-bit (floating-point) support; that was apparently dropped circa 2004, and it is not known how to decode such files, should they even exist.
      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. The foobar2000 component repository includes a component version that handles 8 channels (unlike the component provided by the TTA developers), and that component also honours the WAVEFORMATEXTENSIBLE tag to interpret what channels are encoded. This is an unofficial feature; the format itself offers no channel assignment (e.g., if a TTA file has three channels there is no rule to tell whether it is 2.1 or 3.0, and likewise there is no rule to tell whether a five-channel file a 5.0 or a 4.1 – the component implements support through a tag). 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 (and no other format than WAVE) 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.
    • 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. Note that ffmpeg will transfer tags upon conversion in the usual way (to APEv2 when encoding), but the reference encoder/decoder does not know tags in WAVE.
  • Its unique feature – password protection – seems to be unsupported in players, save for invoking ffplay from a command-line with the password typed in.
  • 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 CPU power than encoding).
  • 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. A few hardware players with TTA support have been around over the years[6] until Cowon exited the hardware player market. However the distinction between «hardware» and «software» support is arguably less clear with ffmpeg-based players on smart devices.

Using TTA (missing: info about DirectShow)

At least for 16-bit signals, one might rather use ffmpeg than the reference implementation. Note that ffmpeg will, upon decoding to WAVE/AIFF, default to 16 bits regardless whether that is a lossy operation. (This is not specific to input source, and users should take care before using ffmpeg for lossless conversion.)

For foobar2000 playback, the component at the foobar2000 website has more features than the TTA developers' decoding component and is also available for 64-bit versions of the player. Since non-audio chunks are not stored in .tta files, foobar2000 just as well be the preferred software to convert .tta files unless one encounters > 8 channels.

Links

Additional sources: