AGSC (File Format): Difference between revisions

>Aruki
>Aruki
Line 13: Line 13:
== Format ==
== Format ==


The AGSC format is split up into four distinct data chunks; one for sound engine scripts, one for sound properties, one for sound metadata, and one for actual ADPCM sound data. The format is very similar between Metroid Prime 1 and 2; the main difference is the header, and some slight changes in the way the four chunks are organized. In Metroid Prime, each chunk begins with its own size value; in Metroid Prime 2, every chunk instead has its size listed at the beginning of the file, at the end of the header. In addition, in Metroid Prime, the third chunk is sound data, and the fourth is sound metadata; in Metroid Prime 2, it's the other way around.
The AGSC format is essentially four data chunks combined into one resource, each of which is a standard MusyX file. Of the four data chunks (pool, proj, samp, and sdir), there's one for sound engine scripts, one for sound properties, one for actual ADPCM sound data, and one for sound metadata. The main difference between Prime 1 and 2 is the header, and some slight changes in the way the four chunks are organized. In Metroid Prime, each chunk begins with its own size value; in Metroid Prime 2, every chunk instead has its size listed at the beginning of the file, at the end of the header. In addition, in Metroid Prime, the third chunk is samp, and the fourth is sdir; in Metroid Prime 2, it's the other way around.


=== Header ===
=== Header ===
Line 71: Line 71:
|}
|}


=== MusyX chunks ===
=== Pool ===
 
After the AGSC header, there are four chunks: the Pool chunk, the Properties chunk, the Sample chunk and the Sample Directory chunk. Each chunk is a standard MusyX file, embedded in the AGSC.
 
==== Pool ====


The Pool chunk denotes MusyX's "SoundMacros", small scripts that apply various effects and commands on the sounds in the game.  The chunk first calls out a command ID then the parameters of that particular command, which varies.
The Pool chunk denotes MusyX's "SoundMacros", small scripts that apply various effects and commands on the sounds in the game.  The chunk first calls out a command ID then the parameters of that particular command, which varies.
Line 100: Line 96:
The Soundmacro terminates when the END command is read.  The command ID for END is 0 and has no command arguments, so when 0x00000000 is read, start the next SoundMacro.  The entire chunk terminates when 0xFFFF is read.  
The Soundmacro terminates when the END command is read.  The command ID for END is 0 and has no command arguments, so when 0x00000000 is read, start the next SoundMacro.  The entire chunk terminates when 0xFFFF is read.  


==== Project ====
=== Project ===


The Project properties chunk contains values for the sounds, including priority, polyphony, volume, etc.
The Project properties chunk contains values for the sounds, including priority, polyphony, volume, etc.


==== Sample ====
=== Sample ===


The Sample chunk is all the sound data encoded using the standard Gamecube DSP ADPCM codec.  It can be decoded the same way as a [[DSP (File Format)|DSP]] file. Each sound's size is padded to 32 bytes before the next sound's data begins.
The Sample chunk is all the sound data encoded using the standard Gamecube DSP ADPCM codec.  It can be decoded the same way as a [[DSP (File Format)|DSP]] file. Each sound's size is padded to 32 bytes before the next sound's data begins.


==== Sample Directory chunk ====
=== Sample Directory chunk ===


The Sample Directory chunk (chunk 4 in Metroid Prime, chunk 3 in Metroid Prime 2) is made up of two sets of tables. The structure of both these tables is identical between both games.
The Sample Directory chunk (chunk 4 in Metroid Prime, chunk 3 in Metroid Prime 2) is made up of two sets of tables. The structure of both these tables is identical between both games.


===== Table A =====
==== Table A ====


The first metadata table has one entry per sound, and is terminated with 0xFFFFFFFF; since there's no known sound count anywhere in the file, the only way to read this correctly is to read until you reach the terminator value. Each entry is 0x20 bytes long.
The first metadata table has one entry per sound, and is terminated with 0xFFFFFFFF; since there's no known sound count anywhere in the file, the only way to read this correctly is to read until you reach the terminator value. Each entry is 0x20 bytes long.
Line 165: Line 161:
|}
|}


===== Table B =====
==== Table B ====


These are accessed through the offsets in table A's entries; note that it might not match the sound count, because the same entry in this table can be used with multiple sounds. Each entry is 0x28 bytes long.
These are accessed through the offsets in table A's entries; note that it might not match the sound count, because the same entry in this table can be used with multiple sounds. Each entry is 0x28 bytes long.
Line 196: Line 192:
=== ADPCM Data ===
=== ADPCM Data ===


 
This data is formatted using the standard GameCube ADPCM codec, and can be decoded the same way as a DSP file. Each sound's size is padded to 32 bytes before the next sound's data begins.


== Tools ==
== Tools ==
Anonymous user