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 a BLCK chunk.<br> | + | They contain an header followed by BLCK chunks.<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 30: |
Line 30: |
| |- | | |- |
| | 0x000C | | | 0x000C |
− | | 4 | + | | 2 |
− | | Unknown | + | | Number of blocks per chunk |
| + | |- |
| + | | 0x000E |
| + | | 2 |
| + | | Unknown (0xFFFF) |
| |- | | |- |
| | 0x0010 | | | 0x0010 |
Line 51: |
Line 55: |
| | 0x0020 | | | 0x0020 |
| | 4 | | | 4 |
− | | Block size? (typically 0x2760) | + | | Block size (typically 0x2760) |
| |- | | |- |
| | 0x0024 | | | 0x0024 |
Line 60: |
Line 64: |
| === BLCK chunk === | | === BLCK chunk === |
| | | |
− | The BLCK chunk directly follows the AST header. It contains a 32-byte header, followed by the PCM16 sound data.<br> | + | The BLCK chunks directly follow the AST header. They contain a 32-byte header, followed by PCM16 sound data.<br> |
− | Here's a description of it: | + | Here's a description of them: |
| | | |
| {| class="wikitable" | | {| class="wikitable" |
Line 76: |
Line 80: |
| | 0x0004 | | | 0x0004 |
| | 4 | | | 4 |
− | | Block size? (typically 0x2760) | + | | Block size (typically 0x2760) |
| |- | | |- |
| | 0x0008 | | | 0x0008 |
Line 84: |
Line 88: |
| | 0x0020 | | | 0x0020 |
| | variable | | | variable |
− | | PCM16 data | + | | PCM16 data blocks |
| |} | | |} |
| + | |
| + | The data is divided into blocks. The number of blocks is defined by entry 0x000C in AST header.<br> |
| + | The length of the blocks is defined by entry 0x0020 in AST header.<br> |
| | | |
| WARNING: The PCM16 data is stored in BIG-ENDIAN! 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! 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. | | Note: there's sound data for one channel only. Stereo mixing is performed by the Wii's DSP. |
| + | |
| + | === AST file structure === |
| + | |
| + | {| class="wikitable" |
| + | |- |
| + | ! 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 blocks per BLCK chunk (entry 0x000C in AST header) |
| + | - N' is the block size (entry 0x0020 in AST header) |