Difference between revisions of "CSNG (File Format)"

From Retro Modding Wiki
Jump to navigation Jump to search
imported>Jackoalan
imported>Jackoalan
Line 51: Line 51:
| 0x0
| 0x0
| 4
| 4
| '''Voice Header Table Offset''' (start of MusyX SON data)
| '''Version'''; always 0x18
|-
|-
| 0x4
| 0x4
| 4
| 4
| '''Voice Sequence Offsets Table Offset'''
| '''Channel Index Offset'''
|-
|-
| 0x8
| 0x8
| 4
| 4
| '''Wave Index Table Offset'''
| '''Channel Map Offset'''
|-
|-
| 0xC
| 0xC
| 4
| 4
| {{unknown|'''Unknown'''}}; (always 0...probably another offset)
| '''Tempo Table Offset''', 0x0 if tempo doesn't change
|-
|-
| 0x10
| 0x10
| 4
| 4
| '''Initial BPM Rate'''; AKA Tempo (always 0x78 = 120 beats per minute)
| '''Initial Tempo'''; (commonly 0x78 or 120 beats per minute)
|-
|-
| colspan=3 {{unknown|WIP}}
| 0x14
| 4
| {{unknown|'''Unknown'''}}
|-
| 0x18
| 256
| '''Channel Offsets'''; 64 elements
|-
| 0x118
| colspan=2 {{unknown|End of header}}
|}
|}



Revision as of 08:22, 18 May 2016

The CSNG format contains MIDI data. It appears in Metroid Prime 1 and 2. It is essentially MusyX's SON music format, with a custom header.


Morphball wire.png This file format needs a lot of research
Nothing is known about this format.


Format

All offsets are relative to the start of the main header (after the custom header).

Custom Header

This 0x14-byte header isn't part of the MusyX format; it appears at the start of the file. After parsing this the rest of the file is copied into a buffer and then passed to the MusyX functions.

Offset Size Description
0x0 4 Magic; (always 0x2)
0x4 4 MIDI Setup ID
0x8 4 SongGroup ID
0xC 4 AGSC ID
0x10 4 SON File Length
0x14 MusyX data starts

Header

Offset Size Description
0x0 4 Version; always 0x18
0x4 4 Channel Index Offset
0x8 4 Channel Map Offset
0xC 4 Tempo Table Offset, 0x0 if tempo doesn't change
0x10 4 Initial Tempo; (commonly 0x78 or 120 beats per minute)
0x14 4 Unknown
0x18 256 Channel Offsets; 64 elements
0x118 End of header

Data

The data in the files is very similar to MIDI, however it is formatted by word, rather than MIDI's byte formatting.

After the data for the instruments are defined, there is a table of offsets for data through out the SON data. Each chunk of data starts with a long 0x8, usually followed by another absolute offset that points to the end of the chunk.

Notes durations are controlled by 96 ticks per beat.