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 ===