Line 1:
Line 1:
AST files contain PCM16 (16-bit signed) sound data. They're used in Super Mario Galaxy for musics, and possibly in other games.
AST files contain PCM16 (16-bit signed) sound data. They're used in Super Mario Galaxy for musics, and possibly in other games.
−
They contain an header, followed by BLCK chunks which are divided in blocks.<br>
+
They contain an header, followed by BLCK chunks which are divided in blocks (channels).<br>
All the data in those files are big-endian, except where mentioned.<br>
All the data in those files are big-endian, except where mentioned.<br>
All the offsets are absolute (from begining of file), except where mentioned.<br>
All the offsets are absolute (from begining of file), except where mentioned.<br>
Line 31:
Line 31:
| 0x000C
| 0x000C
| 2
| 2
−
| Number of blocks per BLCK chunk
+
| Number of channels (typically 2 = stereo)
|-
|-
| 0x000E
| 0x000E
Line 39:
Line 39:
| 0x0010
| 0x0010
| 4
| 4
−
| Sampling rate in Hz (typically 0x7D00 = 32000 Hz)
+
| Sampling rate in Hz (typically 32000)
|-
|-
| 0x0014
| 0x0014
Line 47:
Line 47:
| 0x0018
| 0x0018
| 4
| 4
−
| Loopstart position in samples, from beginning of BLCK chunk
+
| Loopstart position in samples/bytes?
|-
|-
| 0x001C
| 0x001C
Line 91:
Line 91:
|}
|}
−
The data is divided into blocks. The number of blocks is defined by entry 0x000C in AST header.<br>
+
The data is divided into blocks. There's one block per channel.<br>
The length of each block is defined by entry 0x0004 in BLCK chunk header.<br>
The length of each block is defined by entry 0x0004 in BLCK chunk header.<br>
WARNING: The PCM16 data is stored in BIG-ENDIAN! If you aren't working on the Wii, don't forget to byteswap each sample you read or your sound will be pure junk!<br>
WARNING: The PCM16 data is stored in BIG-ENDIAN! If you aren't working on the Wii, don't forget to byteswap each sample you read or your sound will be pure junk!<br>
−
Note: there's sound data for one channel only. Stereo mixing is performed by the Wii's DSP.
+
+
=== Block mapping inside BLCK chunks ===
+
+
{| class="wikitable"
+
|-
+
! Number of channels
+
! Type
+
! Block mapping
+
|-
+
| 2
+
| Stereo
+
| Left; Right
+
|-
+
| 4
+
| 4.0 Surround
+
| Left; Right; Surround left; Surround right
+
|}
+
+
Stereo is the most common type. Some musics in SMG, such as the beach theme, are 4.0 Surround, though.
=== AST file structure ===
=== AST file structure ===
Line 145:
Line 163:
Where:<br>
Where:<br>
−
- N is the number of blocks per BLCK chunk (entry 0x000C in AST header)<br>
+
- N is the number of channels (entry 0x000C in AST header)<br>
- N' is the block size (entry 0x0004 in BLCK chunk header)<br>
- N' is the block size (entry 0x0004 in BLCK chunk header)<br>