AGSC (File Format): Difference between revisions

Jump to navigation Jump to search
no edit summary
>Aruki
No edit summary
>MrSinistar
No edit summary
Line 1: Line 1:
'''AGSC''' is the sound effect format for Metroid Prime and Metroid Prime 2: Echoes. Each AGSC file contains a group of sound effects. According to the debug maps in Metroid Prime, there are references to various "classes", with one of them controlling audio in the map, known as AudioGroupSet.  So presumably, AGSC is an abbreviation for '''Audio Group Set Class'''.   
'''AGSC''' is the sound effect format for Metroid Prime and Metroid Prime 2: Echoes. Each AGSC file contains a group of sound effects. The first two Metroid Prime games utilize the MusyX audio engine created by Factor5 and as a result, AGSC files are created by utilizing files generated from MusyX's SDK. 
 
According to the debug maps in Metroid Prime, there are references to various "classes", with one of them controlling audio in the map, known as AudioGroupSet.  So presumably, AGSC is an abbreviation for '''Audio Group Set Class''' or '''Audio Group Set Cooked''', as all the game data had to be cooked into their final formats.   


The audio codec used in AGSC is the standard GameCube DSP ADPCM codec, as described in the GameCube SDK.   
The audio codec used in AGSC is the standard GameCube DSP ADPCM codec, as described in the GameCube SDK.   


{{researchmoderate
{{researchmoderate
|reason=The first two chunks are still unknown.
|reason=The proj chunk and the sdir chunk still need some reverse-engineering.
}}
}}


Line 11: Line 13:
== Format ==
== Format ==


The AGSC format is split up into four distinct data chunks; two unknown chunks, 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 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.


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


=== Sound Metadata ===
=== 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.
 
==== POOL chunk ====
 
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.
 
{|class="wikitable"
! Offset
! Size
! Description
|-
| 0x0
| 1
| '''Command ID''' (varies; there are 79 known commands in the MusyX audio engine.)
|-
| 0x1
| 1
| '''Command argument''' (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
| colspan=2 {{unknown|End of entry}}
|}
 
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 ====
 
The Project properties chunk contains values for the sounds, including priority, polyphony, volume, etc.
 
==== SAMP chunk ====
 
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 ====


The sound metadata 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 126: Line 189:
|}
|}


==== 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 157: Line 220:
=== 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

Navigation menu