AST file
AST files contain PCM16 (16-bit signed) sound data. They're used in Super Mario Galaxy for musics, Legend of Zelda: Twilight Princess, and possibly in other games.
They contain a header, followed by BLCK chunks which are divided in blocks (channels).
All the data in those files are big-endian, except where mentioned.
All the offsets are absolute (from beginning of the file), except where mentioned.
All the sizes are in bytes, except where mentioned.
AST header
The header is 64 bytes long. Here's a description of it:
Offset | Size | Description |
---|---|---|
0x0000 | 4 | "STRM" (0x5354524D) |
0x0004 | 4 | Size of all the BLCK chunks (size of the file minus 64) |
0x0008 | 4 | Unknown (0x00010010) |
0x000C | 2 | Number of channels (typically 2 = stereo) |
0x000E | 2 | Unknown (0xFFFF) |
0x0010 | 4 | Sampling rate in Hz (typically 32000) |
0x0014 | 4 | Total number of samples |
0x0018 | 4 | Loopstart position in samples/bytes? |
0x001C | 4 | Unknown (typically same as entry 0x0014) |
0x0020 | 4 | Block size for the first chunk? (typically 0x2760) |
0x0024 | 28 | Unknown (Usually all zeros except 0x0028, which is 0x7F) |
BLCK chunks
The BLCK chunks directly follow the AST header. They contain a 32-byte header, followed by PCM16 sound data.
Here's a description of them:
Offset
(from beginning of BLCK chunk) |
Size | Description |
---|---|---|
0x0000 | 4 | "BLCK" (0x424C434B) |
0x0004 | 4 | Block size (typically 0x2760) |
0x0008 | 24 | Padding (zero) |
0x0020 | variable | PCM16 data blocks |
The data is divided into blocks. There's one block per channel.
The length of each block is defined by entry 0x0004 in BLCK chunk header.
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!
Block mapping inside BLCK chunks
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 music in SMG, such as the beach theme, are 4.0 Surround, though.
AST file structure
Element | Size |
---|---|
AST header | 64 bytes |
BLCK chunk header | 32 bytes |
PCM16 block 1 | N |
PCM16 block 2 | N |
... | |
PCM16 block N' | N |
BLCK chunk header | 32 bytes |
PCM16 block 1 | N |
PCM16 block 2 | N |
... | |
PCM16 block N' | N |
BLCK chunk header | 32 bytes |
... |
Where:
- N' is the number of channels (entry 0x000C in AST header)
- N is the block size (entry 0x0004 in BLCK chunk header)