Jazz 2 Music Format

From ModdingWiki
Jump to: navigation, search

The J2B format is just a container for the custom format of the Galaxy Sound System, RIFF AMFF or RIFF AM.

Container Header

The file header is 24 bytes long:

File header:
0   4  ID     'MUSE'; indicates that this is a music file
4   4  ID2    0xDEADBEAF (RIFF AM) or 0xDEADBABE (RIFF AMFF); indicates the file content, but is pretty useless (you should not rely on this at all!)
8   4  Size   Size of the complete file
12  4  ChSum  Checksum of the data block (before decompression)
16  4  Size2  Length of the data block before decompression (should be file size - 24 bytes)
20  4  Size3  Length of the data block after decompression
24  ?  Data   This is the actual music file in either RIFF AMFF or RIFF AM format; It's compressed using standard zlib compression. Simply use zlib's "uncompress" macro to read this.

Data body

The uncompressed data body contains a module in either RIFF AMFF or RIFF AM format. Both formats are rather similar, but RIFF AM follows the RIFF conventions more strictly. RIFF AMFF was only used in early versions of Jazz Jackrabbit 2, which explains why RIFF AM is generally the more advanced format of the two. RIFF AMFF is internally very close to the XM format, with a few additions to support some S3M / IT commands.