Covox ADPCM

From MultimediaWiki
Jump to: navigation, search

This is a family of ADPCM formats used for compressing 8-bit unsigned PCM. They were invented by Covox for use with the Covox Speech Thing, Sound Master, and other Covox sound output devices. There are 2-,3- and 4-bit ADPCM formats.

Header

File header consists of 16 bytes:

 FF 55 FF AA FF 55 FF AA xx yy pp pp pp pp 00 00
 xx - encoding type
 yy - playback rate (rate != sample rate, rather the timer tick rate divisor used for playback)
 pp - unsigned longint meant to indicate unpacked size (mostly unused)
 00 - unknown/unused

Type may be one of the following:

  • 0x01 - 1-bit ADPCM
  • 0x02 - 2-bit ADPCM
  • 0x03 - 3-bit ADPCM
  • 0x04 - 4-bit ADPCM
  • 0x08 - raw 8-bit unsigned PCM
  • 0x81 - 1-bit ADPCM with silence encoding
  • 0x82 - 2-bit ADPCM with silence encoding
  • 0x83 - 3-bit ADPCM with silence encoding
  • 0x84 - 4-bit ADPCM with silence encoding
  • 0x88 - 8-bit PCM with silence encoding

The first 8 bytes are a unique code guaranteed not to show up inside the rest of file. This means that multiple PCM files can be concatenated together and the locations found by looking for the headers.

Markers

There are two types of markers known:

  • FF 55 55 55 - silence block, next 16-bit little-endian value specifies number of silence samples - 27
  • FF AA AA AA - end of sound

For 3-bit ADPCM they are cut to 3 bytes (FF 55 55 and FF AA AA respectively).

After silence block ADPCM decoding state should be reset.

ADPCM decoding

The Covox method of ADPCM does not match other methods; please see the SPUTTER source code by Adrienne Cousins for one implementation of how to decode Covox ADPCM.