Difference between revisions of "EA Command And Conquer 3 Audio Codec"

From MultimediaWiki
Jump to navigation Jump to search
(xas info)
Line 4: Line 4:
* Samples: http://samples.mplayerhq.hu/game-formats/cc3-audio/
* Samples: http://samples.mplayerhq.hu/game-formats/cc3-audio/


Note that all files on that site except 166b084d.46410f77.03cfdd8a.96acd5f2.cdata and 166b084d.46410f77.d6c25c01.6901ceb3.cdata appear to be EA XAS ADPCM. Those 2 files should be EALayer3.
This format is found on certain .cdata files used for sound effects/voice inside the *.BIG resource files of the new Command & Conquer 3 Demo. Using a program such as [http://www.ppmsite.com/ OS Big Editor 0.4] you can open the DemoStreams.big file from the C&C3 Demo and extract any .cdata file from the "data\global_demo_common\cdata" folder.


This codec is found on certain .cdata files used for sound effects/voice inside the *.BIG resource files of the new Command & Conquer 3 Demo. Using a program such as [http://www.ppmsite.com/ OS Big Editor 0.4] you can open the DemoStreams.big file from the C&C3 Demo and extract any .cdata file from the "data\global_demo_common\cdata" folder. Exactly how to tell if this is formatted with EA XAS ADPCM or EALayer3 MPEG audio by examining the files and data is unknown at this time.
== File Layout ==
The file begins with a 16-byte header, which is then followed by codec specific data. All numbers are encoded in big endian.


The data begins with a 16 byte header.
bytes 0-1    codec type
                0x0000  EA Layer 3
                0x0400  EA ADPCM XAS mono
                0x0404  EA ADPCM XAS stero
                0x040c  EA ADPCM XAS quad
                0x0504  another EA ADPCM variant?
bytes 2-3    sample rate
bytes 4-7    total samples
bytes 8-11  total file size (bytes)
bytes 12-16 total samples


In a mono 16-bit audio file the first 2 bytes are 04 00, for stereo 16-bit, they are 04 04. Other numbers have been seen but the purpose is unknown (possibly they are bit flags of some kind and/or they code for the audio format e.g. 16-bit etc)
== EA ADPCM XAS ==


The next 2 are the sample rate of the audio (BB 80 aka 48000 in all files seen so far)
XAS is a variation on the [[Electronic Arts XA]] codec that uses four independant PCM deltas.  
Following that is a 4 byte count of how many samples are in the audio file. Then comes a 4 byte count of the size in bytes of the audio data that follows the header. After that comes the 4 byte sample count repeated a second time.
All of these numbers are big endian.


The audio data that follows is broken up into 76 byte blocks with a 16 byte header and 60 bytes of sample data. Exactly how to decode this data is unknown at this time. Each block decodes into 80 samples of output.
Compressed audio data is arranged in 76-byte blocks that follow sequentially after the header. Each block corresponds to 128 audio samples. In files with stereo audio, the blocks alternate between left and right channels. For example, the first block is for the first channel, the next is for the second channel and so on.


80 samples of 16-bit audio silence encodes as 00 00 0C 00 00 00 0C 00 00 00 0C 00 00 00 0C 00 as the 16 byte header followed by 60 bytes of 00
Each block beings with a 16-byte header, and is followed by 15 x 4-byte compressed audio blobs.


In a file with stereo audio, the first 76 byte block is for the first channel, the next is for the second channel and so on.
== Notes ==
 
The following tables are known to be used in some way in the decoding routine:
Table 1:
 
0.0
0.9375
1.796875
1.53125
1.0
 
Table 2:
 
0.0
0.0
-0.8125
-0.859375
1.0
 
Table 3:
 
0.00000000046566129
0.00000000023283064
0.00000000011641532
0.000000000058207661
0.00000000002910383
0.000000000014551915
0.0000000000072759576
0.0000000000036379788
0.0000000000018189894
0.0000000000009094947
0.00000000000045474735
0.00000000000022737368
0.00000000000011368684
0.0
0.0


Thanks to KMX at Derelict Studios for finding out the initial information on this format as it applies to C&C3.
Thanks to KMX at Derelict Studios for finding out the initial information on this format as it applies to C&C3.


This codec MAY be related to the ADPCM_EA_R3 format used in the .snd files (which provide audio to the movie clips in the game)
[[Category:Game Formats]]
 
[[Category:Undiscovered Audio Codecs]]
[[Category:Audio Codecs]]

Revision as of 05:50, 24 October 2007

This format is found on certain .cdata files used for sound effects/voice inside the *.BIG resource files of the new Command & Conquer 3 Demo. Using a program such as OS Big Editor 0.4 you can open the DemoStreams.big file from the C&C3 Demo and extract any .cdata file from the "data\global_demo_common\cdata" folder.

File Layout

The file begins with a 16-byte header, which is then followed by codec specific data. All numbers are encoded in big endian.

bytes 0-1    codec type
                0x0000   EA Layer 3
                0x0400   EA ADPCM XAS mono
                0x0404   EA ADPCM XAS stero
                0x040c   EA ADPCM XAS quad
                0x0504   another EA ADPCM variant?
bytes 2-3    sample rate
bytes 4-7    total samples
bytes 8-11   total file size (bytes)
bytes 12-16  total samples

EA ADPCM XAS

XAS is a variation on the Electronic Arts XA codec that uses four independant PCM deltas.

Compressed audio data is arranged in 76-byte blocks that follow sequentially after the header. Each block corresponds to 128 audio samples. In files with stereo audio, the blocks alternate between left and right channels. For example, the first block is for the first channel, the next is for the second channel and so on.

Each block beings with a 16-byte header, and is followed by 15 x 4-byte compressed audio blobs.

Notes

Thanks to KMX at Derelict Studios for finding out the initial information on this format as it applies to C&C3.