EA SAGE Audio Files
- Extension: .cdata
- Website: http://www.commandandconquer.com/
- Company: Electronic Arts
- Samples: http://samples.mplayerhq.hu/game-formats/cc3-audio/
This format is found on certain .cdata files used for audio inside the *.BIG resource files of Command & Conquer 3,Red Alert 3 and Command & Conquer 4. Using a program such as bigextract.exe from SDK Extras you can open the *.BIG files of these games and access the .cdata files. Other .cdata files contain other data such as textures.
The file begins with a 16-byte header. All numbers are encoded in big endian. If bytes 0 and 1 are 0x0000, it means that the audio file is a streamed audio file and the actual header data is stored elsewhere in the game data.
byte 0 codec type 0 = not used 1 = not used 2 = no compression (ID in the code is P6B0) 3 = XBOX 360 XMA audio (ID in the code is EXm0) 4 = EA XAS ADPCM (ID in the code is Xas1) 5 = One version of EALayer3 MPEG Layer 3 audio variant (ID in the code is EL31) 6 = One version of EALayer3 MPEG Layer 3 audio variant (ID in the code is L32P) 7 = One version of EALayer3 MPEG Layer 3 audio variant (ID in the code is L32S) byte 1 related to channel count. Seems to be set to (channel count - 1) * 4 so 0 = mono, 4 = stereo, 0xC = 4 channels and 0x14 = 5.1 (i.e. 6 channels) bytes 2-3 sample rate bytes 4-7 total samples bytes 8-11 total file size (bytes) bytes 12-16 total samples
Further analysis of the game binaries indicates that EL31 may mean "EALayer3 Interleaved (Version 1)" or just "EALayer3". L32P almost certainly means "EALayer3 Interleaved (Version 2) PCM" and L32S almost certainly means "EALayer3 Interleaved (Version 2) Spike"
For the streamed version of this format (usually used for audio in EALayer3 format), the above header is stored elsewhere in the game data. The streamed header is broken down into a number of blocks. Each block has an 8 byte header (stored in big endian). The first 2 bytes are a flag value. If flags & 0x8000 is true, that means its the last block in the stream. The second 2 bytes are the size of the block and the remaining 4 bytes are the number of samples in that block.
Thanks to KMX at Derelict Studios for finding out the initial information on this format as it applies to C&C3.