AGSC (File Format): Difference between revisions

>MrSinistar
No edit summary
>Aruki
Line 73: Line 73:
=== MusyX chunks ===
=== MusyX chunks ===


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 originally a file created with muconv2, a tool that comes with MusyX's SDK.  Muconv2 takes the original project file and its associated sound assests and converts them into file formats that are read by the Gamecube's MusyX audio engine.  Retro took these four separate files and cooked them into the final AGSC files.
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 chunk ====
==== 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.


Every 4 bytes is in little endian, so to read the data as originally formatted by the MusyX SDK before it was converted, take each long (4 bytes) and change to big endian.
Every 4 bytes were originally little endian, but have been swapped to big endian in the AGSC files (despite not being longs). To read the data as originally formatted, every four bytes needs to be byte-swapped.


{|class="wikitable"
{|class="wikitable"
Line 91: Line 91:
|-
|-
| 0x1
| 0x1
| 1
| 7
| '''Command argument''' (varies between commands)
| '''Command arguments''' (varies between commands)
|-
| 0x2
| 1
| '''Command argument''' (varies between commands)
|-
| 0x3
| 1
| '''Command argument''' (varies between commands)
|-
| 0x4
| 1
| ''Flip next four bytes'' '''Command argument''' (varies between commands)
|-
| 0x5
| 1
| '''Command argument''' (varies between commands)
|-
| 0x6
| 1
| '''Command argument''' (varies between commands)
|-
| 0x7
| 1
| '''Command argument''' (varies between commands)
|-
|-
| 0x8
| 0x8
Line 124: Line 100:
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.  


==== PROJ chunk ====
==== 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.


==== SAMP chunk ====
==== 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.


==== SDIR 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.
Anonymous user