Difference between revisions of "BRSTM file"

From WiiBrew
Jump to navigation Jump to search
Line 75: Line 75:
 
=== HEAD chunk ===
 
=== HEAD chunk ===
  
The head chunk is typically 256 bytes long.<br/>
+
The HEAD chunk contains information about the brstm file, including sample rate, loop information, volume, panning, and information on each of the ADPCM streams.
It contains what looks like the ADPCM table and YN1/YN2, twice, probably once for the first part and once for the last (looping) part.<br/>
+
 
It also contains some other unknown stuff.
+
This chunk contains 3 internal parts.<br/>
 +
Part 1 contains general information about the file such as loop information, sample rate, and data needed to deinterleave the audio stream.<br/>
 +
Part 2 defines the tracks in the file, and contains volume and panning information for each of them.<br/>
 +
Part 3 contains the information needed to decode the ADPCM audio, including the ADPCM coefficients, and history samples.
 +
 
 +
 
 +
Any internal offsets in the HEAD chunk are based off of byte 8 in the header. e.g. Offset 0x40 would refer to offset 0x48 in the overall header.
 +
 
 +
 
 +
HEAD chunk header
 +
{| class="wikitable"
 +
|-
 +
! Offset
 +
! Size
 +
! Description
 +
|-
 +
| 0x0000
 +
| 4
 +
| "HEAD" (0x48454144)
 +
|-
 +
| 0x0004
 +
| 4
 +
| Length of entire HEAD section.
 +
|-
 +
| 0x0008
 +
| 4
 +
| Marker? (0x01000000)
 +
|-
 +
| 0x000C
 +
| 4
 +
| Offset to HEAD chunk part 1
 +
|-
 +
| 0x0010
 +
| 4
 +
| Marker? (0x01000000)
 +
|-
 +
| 0x0014
 +
| 4
 +
| Offset to HEAD chunk part 2
 +
|-
 +
| 0x0018
 +
| 4
 +
| Marker? (0x01000000)
 +
|-
 +
| 0x001C
 +
| 4
 +
| Offset to HEAD chunk part 3
 +
|}
  
 
=== ADPC chunk ===
 
=== ADPC chunk ===

Revision as of 04:39, 30 July 2016

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.

BRSTM header

The header is 64 bytes long.

Offset Size Description
0x0000 4 "RSTM" (0x5253544D)
0x0004 2 Byte Order Mark (BOM), usually 0xFE 0xFF for big endian.
0x0006 1 Major version
0x0007 1 Minor version
0x0008 4 Size of the whole file
0x000C 2 Header size
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
0x0028 24 Unknown/Padding (zero)

HEAD 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 internal offsets in the HEAD chunk are based off of byte 8 in the header. e.g. Offset 0x40 would refer to offset 0x48 in the overall header.


HEAD chunk header

Offset Size Description
0x0000 4 "HEAD" (0x48454144)
0x0004 4 Length of entire HEAD section.
0x0008 4 Marker? (0x01000000)
0x000C 4 Offset to HEAD chunk part 1
0x0010 4 Marker? (0x01000000)
0x0014 4 Offset to HEAD chunk part 2
0x0018 4 Marker? (0x01000000)
0x001C 4 Offset to HEAD chunk part 3

ADPC chunk

The ADPC chunk is typically 1216 bytes long. It seems to contain some other ADPCM table.

DATA chunk

The DATA chunk contains ADPCM sound data.