Electronic Arts AS4 / ASF Music

From Just Solve the File Format Problem
Jump to: navigation, search
File Format
Name Electronic Arts AS4 / ASF Music
Extension(s) .as4, .asf
PRONOM x-fmt/137



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.


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; 


  • 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
  • bType - the type of file (this should always be 0x00 for AS4 / ASF files)
  • dwNumSamples - the number of samples in the file
  • dwLoopStart - where the beginning of the repeat loop should start (in terms of samples). If this is 0xFFFFFFFF, there is no loop
  • dwLoopLength - the length of the repeat loop (again in samples). If this is 0, there is no loop
  • dwDataStart - this is not used for AS4 / ASF files
  • dwUnknown - as the name suggests, the function of this would appear to be unknown

Sound Data

Block ID: 1SNd

The next block following the header is the sound data block. Confusingly, the first chunk of sound data will be contained in the 1SNh block.

struct ASFChunkHeader 
DWORD dwOutSize; 
LONG lIndexLeft; 
LONG lIndexRight; 
LONG lCurSampleLeft; 
LONG lCurSampleRight; 
  • dwOutSize - the size of the uncompressed (8 or 16-bit PCM) data in the chunk (in terms of samples).
  • lIndexLeft, lIndexRight, lCurSampleLeft, lCurSampleRight - these are the initial values for the IMA ADPCM decompression routine.

As mentioned above, if no compression is used these blocks consist simply of signed 8 or 16-bit PCM audio. Also note that for mono files, there is no lIndexRight or lCurSampleRight value.

Loop Block

Block ID: 1SNl

This consists of a single value, DWORD value, which defines the looping jump position relative to the start of the song. This block may be followed by a number of further 1SNd blocks.

End Block

Block ID: 1SNe

An 8-byte block containing no data that defines the end of the audio stream. If there is a loop, the jump should be made from here. Note that some files contain further audio data beyond this.


Sample files


Personal tools