Westwood IMA ADPCM

From MultimediaWiki
Jump to: navigation, search

Many games published by Westwood Studios use VQA files to transport movie animations and AUD files to transport audio clips. Such titles include the Command & Conquer and Lands of Lore series. Westwood Studios multimedia files store audio using the standard IMA ADPCM algorithm.

VQA is a tagged format with different chunks marked by fourccs. A 'SND2' chunk contains IMA ADPCM nibbles. There is no chunk preamble that specifies initial predictor and index. The predictor and index variables are both initialized to 0 when file playback is started and maintained across chunks. This makes random seeking through Westwood Studios multimedia files quite difficult.

If the audio is mono data, the low nibble is decoded first (bits 3-0) then the high nibble:

   byte0 byte1 byte2 byte3 ...
    n1n0  n3n2  n5n4  n7n6 ... 

If the audio is stereo data, left and right bytes are interleaved. Each byte represents 2 samples for either the left of channel:

   byte0 byte1 byte2 byte3 ...
    L1L0  R1R0  L3L2  R3R2 ...