BRSTM files contain ADPCM sound data. They are used for music in some games, such as Super Smash Bros. Brawl and Mario Kart Wii.
They contain a header, followed by a HEAD chunk, an ADPC chunk and a DATA chunk.
All the data in those files are big-endian, except where mentioned.
All the offsets are absolute (from begining of file), except where mentioned.
All the sizes are in bytes, except where mentioned.
The header is 64 bytes long.
|0x0004||2||Byte Order Mark (BOM), usually 0xFE 0xFF for big endian.|
|0x0008||4||Size of the whole file|
|0x000E||2||Number of chunks|
|0x0010||4||Offset to HEAD chunk|
|0x0014||4||Size of HEAD chunk|
|0x0018||4||Offset to ADPC chunk|
|0x001C||4||Size of ADPC chunk|
|0x0020||4||Offset to DATA chunk|
|0x0024||4||Size of DATA chunk|
The HEAD chunk contains information about the brstm file, including sample rate, loop information, volume, panning, and information on each of the ADPCM streams.
This chunk contains 3 internal parts.
Part 1 contains general information about the file such as loop information, sample rate, and data needed to deinterleave the audio stream.
Part 2 defines the tracks in the file, and contains volume and panning information for each of them.
Part 3 contains the information needed to decode the ADPCM audio, including the ADPCM coefficients, and history samples.
Any offsets in the HEAD chunk are relative to offset 0x08 in the HEAD chunk unless otherwise noted.
HEAD chunk header
|0x0004||4||Length of entire HEAD section.|
|0x000C||4||Offset to HEAD chunk part 1|
|0x0014||4||Offset to HEAD chunk part 2|
|0x001C||4||Offset to HEAD chunk part 3|
HEAD chunk part 1
This part is 0x34 bytes long
0 - 8-bit PCM
|0x0002||1||Number of channels|
|0x0008||4||Loop start in samples|
|0x000C||4||Total sample count|
|0x0010||4||Absolute offset to the beginning of the ADPCM data.
Note that this is not the beginning of the DATA chunk.
|0x0014||4||Total block count.
The total number of interlaced blocks in the ADPCM data. This count includes the final block.
|0x0018||4||Block Size in bytes.|
|0x001C||4||Samples per block.|
|0x0020||4||Size of the final block without padding in bytes|
|0x0024||4||Samples in the final block.|
|0x0028||4||Size of the final block with padding in bytes|
|0x002C||4||Samples per entry in the ADPC table|
|0x0030||4||Bits per sample? (0x04 for 4-bit ADPCM)|
The ADPC chunk is typically 1216 bytes long. It seems to contain some other ADPCM table.
The DATA chunk contains ADPCM sound data.