User:Halftheisland/EA AS4
From Just Solve the File Format Problem
Contents |
Description
AS4 / ASF files are an audio file format used in many video games created by Electronic Arts. Note that extensions other than those listed may be AS4 / ASF files as Electronic Arts often change file extensions for different games.
Information
The basic structure of AS4 / ASF files is similar to that of RIFF, with each file divided into blocks (although, unlike RIFF, the format does not have a global file header).
Each block starts with a standard header:
struct ASFBlockHeader { char szBlockID[4]; DWORD dwSize; };
Where:
- szBlockID gives the string ID for the block
- dwSize gives the size of the block (including the header) in bytes.
Each file then consists of a number of blocks, each of which are described below.
Header Block
Block ID:1SNh
This is the first block in an ASF / AS4 file, describing the audio stream.
struct EACSHeader { char szID[4]; DWORD dwSampleRate; BYTE bBits; BYTE bChannels; BYTE bCompression; BYTE bType; DWORD dwNumSamples; DWORD dwLoopStart; DWORD dwLoopLength; DWORD dwDataStart; DWORD dwUnknown; };
- szID - the ID string, should always be "EACS"
- dwSampleRate - the sample rate for the file
- bBits - the resolution of the decompressed sound data, divided by 8 (i.e. 1 = 8-bit, 2 = 16-bit)
- bChannels - the number of channels. There are only two options: 1 for mono, 2 for stereo
- bCompression - if this is equal to 0x00, the audio data consists of signed 8 or 16-bit PCM. If it is equal to 0x02, the audio data consists of compressed IMA ADPCM