Difference between revisions of "TAK"

From MultimediaWiki
Jump to: navigation, search
(no more undiscovered)
(known codec types)
Line 41: Line 41:
 
==== Stream information ====
 
==== Stream information ====
  
   6 bits    codec type (should be always 0)
+
   6 bits    codec type
 
   4 bits    encoder profile (= encoder preset at least for versions <= 1.1.2)
 
   4 bits    encoder profile (= encoder preset at least for versions <= 1.1.2)
 +
 +
Known codec types:
 +
 +
  0    Integer 24 bit (TAK 1.0)
 +
  1    Experimental!
 +
  2    Integer 24 bit (TAK 2.0)
 +
  3    LossyWav (TAK 2.1 Beta)
 +
  4    Integer 24 bit MC (TAK 2.2)
 +
 
   frame size information (32 bits, see below)
 
   frame size information (32 bits, see below)
size
 
format
 
  
 
===== Frame size information =====
 
===== Frame size information =====

Revision as of 01:32, 15 October 2012

TAK (Tom's verlustfreier Audio Kompressor), formerly known as YALAC (Yet Another Lossless Audio Codec) is a lossless audio codec developed by Thomas Becker. As of January 2006, the codec is at the 1.0 release stage. Source code is not available.



Stream format

Integers are little-endian. 24-bit CRC is employed for checking data integrity.

TAK file consists of signature ("tBaK"), obligatory metadata and compressed audio data. APE tags may be present at the end of file.

Metadata

Metadata consists of series of objects, each object has 32-bit header.

Header meaning:

  7 bits - object type
  1 bit  - reserved
 24 bits - object size

Metadata object types:

 0x00 - end of metadata
 0x01 - stream info
 0x02 - seektable (obsoleted in TAK 1.1.1)
 0x03 - original file data
 0x04 - encoder info
 0x05 - padding (since 1.0.3)
 0x06 - MD5 checksum (since 1.1.1)
 0x07 - last frame information (since 1.1.1)

Non-empty metadata object ends with 3 bytes of object data CRC.

Stream information

  6 bits    codec type
  4 bits    encoder profile (= encoder preset at least for versions <= 1.1.2)

Known codec types:

  0    Integer 24 bit (TAK 1.0)
  1    Experimental!
  2    Integer 24 bit (TAK 2.0)
  3    LossyWav (TAK 2.1 Beta)
  4    Integer 24 bit MC (TAK 2.2)
  frame size information (32 bits, see below)
Frame size information
  4 bits    frame size index
24 bits    number of samples

Possible frame sizes:

  0    94 ms of audio
  1    125 ms
  2    188 ms
  3    250 ms
  4    4096 ms
  5    8192 ms
  6    16384 ms
  7    512 ms
  8    1024 ms
  9    2048 ms
 10    6144 ms (obsoleted in 1.1.0, invalid)
 11    12288 ms (obsoleted in 1.1.0, invalid)
 12-14    reserved
 15    frame contains number of samples stored in next 35 bits (not supported yet)
Audio format
  3 bits    data type (should be 0 = PCM)
 18 bits    sample rate - 6000
  5 bits    sample bits - 8
  5 bits    audio channels - 1

Original file data

Called "simple wave data", this contains trailer and footer from original file to allow perfect reconstruction:

  0-2   trailer size
  3-6   footer size
  trailer data
  footer data

Encoder info

  24 bits    encoder version (8 bits per each version component)
   4 bits    preset
   2 bits    evaluation
   2 bits    reserved

Last frame information

 40 bits    frame position relative to the beginning of audio data
 24 bits    frame size

Audio data

TODO: header order, padding, CRC positions

Data header

 16 bits    syncword (0xA0FF little-endian)
  1 bit     last frame
  1 bit     frame contains information (see "information header" below)
  1 bit     frame contains metadata (unsupported)
 21 bits    frame number
 14 bits    sample count - 1 (only for the last frame)
  2 bits    padding (only for the last frame)

Information header

  1 bit     previous frame position is present
  5 bits    reserved (should be 0)
 25 bits    offset to the previous frame header from the end of this header (only if first bit = 1)