Difference between revisions of "Creative 8 bits ADPCM"

From MultimediaWiki
Jump to navigation Jump to search
Line 1: Line 1:
* Company: [[Creative]]
* Company: [[Creative]]


These ADPCM schemes are used in [[Creative_Voice|Creative VOC]] files. The only reference decoder is a hardware one: the Creative Sound Blaster (Pro). So this documentation is not based on reverse engineering. It's based on wild guessing and empirical tests but gives good enough results.  (Ed. note:  The DOSBox source contains code that claims to decode Creative ADPCM as well, but that code has not yet been verified against the information on this page.)
These ADPCM schemes are used in [[Creative_Voice|Creative VOC]] files. The only reference decoder is a hardware one: the Creative Sound Blaster (Pro). So this documentation is not based on reverse engineering. It's based on wild guessing and empirical tests but gives good enough results.   


There are three different variation of this codec, which pack samples to either 4, 2.6 or 2 bits. The 2.6 scheme means that every byte is composed of 3 samples of 3 bits for the first and the second and 2 bits for the last.
There are three different variation of this codec, which pack samples to either 4, 2.6 or 2 bits. The 2.6 scheme means that every byte is composed of 3 samples of 3 bits for the first and the second and 2 bits for the last.
Line 29: Line 29:
   step--;
   step--;
step must be clamped into the 0..3 range.
step must be clamped into the 0..3 range.
== External sites ==
* The DOSBox source contains code that claims to decode Creative ADPCM as well, but that code has not yet been verified against the information on this page.


[[Category:Audio Codecs]]
[[Category:Audio Codecs]]

Revision as of 16:20, 4 April 2007

These ADPCM schemes are used in Creative VOC files. The only reference decoder is a hardware one: the Creative Sound Blaster (Pro). So this documentation is not based on reverse engineering. It's based on wild guessing and empirical tests but gives good enough results.

There are three different variation of this codec, which pack samples to either 4, 2.6 or 2 bits. The 2.6 scheme means that every byte is composed of 3 samples of 3 bits for the first and the second and 2 bits for the last.

The three different schemes use the same algorithm with different initial parameters.

Initialization

The first byte is a raw (not compressed) sample, used as the initial value for prdiction.

step is initialized to 0.

shift is initialized to 2 for 2 bits scheme and to 0 else.

limit is initialized to 5 for 4 bits samples, 3 for 3 bits samples and 1 for 2 bits samples.

Decoding

Every packed sample is composed of a sign bit (the most significant bit), and a value (the other bits). Let's define sign as 1 when the sign bit is 0 and -1 when the sign bit is 1. Now you can decode a packed sample with the following operation

sample = prediction + sign * (value << (step + shift))

sample have to be clamped to fit into an unsigned byte.

Then prediction is updated to the new sample value, and step is updated using this algorithm:

if (value >= limit)
  step++;
else if (value == 0)
  step--;

step must be clamped into the 0..3 range.

External sites

  • The DOSBox source contains code that claims to decode Creative ADPCM as well, but that code has not yet been verified against the information on this page.