Changes

Jump to navigation Jump to search
1,183 bytes added ,  01:05, 6 December 2019
m
Fixed mix-up of N' and N in description of file
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, Legend of Zelda: Twilight Princess, and possibly in other games.
   −
They contain an header followed by a BLCK chunk.<br>
+
They contain a 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 beginning of the file), except where mentioned.<br>
 
All the sizes are in bytes, except where mentioned.<br>
 
All the sizes are in bytes, except where mentioned.<br>
   Line 23: Line 23:  
| 0x0004
 
| 0x0004
 
| 4
 
| 4
| Size of the BLCK chunk
+
| Size of all the BLCK chunks (size of the file minus 64)
 
|-
 
|-
 
| 0x0008
 
| 0x0008
Line 30: Line 30:  
|-
 
|-
 
| 0x000C
 
| 0x000C
| 4
+
| 2
| Unknown
+
| Number of channels (typically 2 = stereo)
 +
|-
 +
| 0x000E
 +
| 2
 +
| Unknown (0xFFFF)
 
|-
 
|-
 
| 0x0010
 
| 0x0010
 
| 4
 
| 4
| Sampling rate in Hz (typically 0x7D00 = 32000 Hz)
+
| Sampling rate in Hz (typically 32000)
 
|-
 
|-
 
| 0x0014
 
| 0x0014
 
| 4
 
| 4
| Unknown
+
| Total number of samples
 
|-
 
|-
 
| 0x0018
 
| 0x0018
 
| 4
 
| 4
| Loopstart position in samples, from beginning of BLCK chunk
+
| Loopstart position in samples/bytes?
 
|-
 
|-
 
| 0x001C
 
| 0x001C
Line 51: Line 55:  
| 0x0020
 
| 0x0020
 
| 4
 
| 4
| Block size? (typically 0x2760)
+
| Block size for the first chunk? (typically 0x2760)
 
|-
 
|-
 
| 0x0024
 
| 0x0024
 
| 28
 
| 28
| Unknown
+
| Unknown (Usually all zeros except 0x0028, which is 0x7F)
 
|}
 
|}
   −
=== BLCK chunk ===
+
=== BLCK chunks ===
   −
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. There's one block per channel.<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>
 +
 
 +
=== 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 music in SMG, such as the beach theme, are 4.0 Surround, though.
 +
 
 +
=== 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
 +
|-
 +
| ...
 +
|
 
|}
 
|}
   −
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!
+
Where:<br>
Note: there's sound data for one channel only. Stereo mixing is performed by the Wii's DSP.
+
- N' is the number of channels (entry 0x000C in AST header)<br>
 +
- N is the block size (entry 0x0004 in BLCK chunk header)<br>
 +
[[Category:File formats]]
1

edit

Navigation menu