The current URL is datacrystal.tcrf.net.
EarthBound/Audio: Difference between revisions
(It has come to my attention that this is completely wrong) |
m (→Song SPC Pointer Table: incorrect) |
||
Line 12: | Line 12: | ||
This table is located at 262B8C in the ROM and contains 191 (0xBF) entries. Not all songs are loaded into the same offset in SPC RAM, so this table is used to tell where in SPC RAM the song is located. Each entry is a two-byte pointer in little-endian (LSB first) format. | This table is located at 262B8C in the ROM and contains 191 (0xBF) entries. Not all songs are loaded into the same offset in SPC RAM, so this table is used to tell where in SPC RAM the song is located. Each entry is a two-byte pointer in little-endian (LSB first) format. | ||
The first entry in the table is actually song 01, not song 00 (i.e., the table is accessed as if it began at 262B8A instead of 262B8C). Song 00 does not point to an actual song | The first entry in the table is actually song 01, not song 00 (i.e., the table is accessed as if it began at 262B8A instead of 262B8C). Song 00 does not point to an actual song, and its space in the table is probably used by the preceding data chunk. Similarly, the last song is actually song C0, although it is entry BF in the table. | ||
[[Category:EarthBound]] | [[Category:EarthBound]] |
Revision as of 07:41, 17 February 2008
SPC RAM
As with all SNES games, audio data must be loaded into the SPC700's RAM before it can be played. This RAM contains all the song data, the instrument data, the sample data, and even the music playback code itself. SPC files are nothing more than a straightforward dump of SPC RAM with a 256-byte header attached (and a footer with state information that doesn't concern us here), so you can easily convert a RAM offset to an SPC file offset by adding 0x100 for the header.
Patterns
The first pattern of the song is the first data to be found in the song data. So if, for example, the Song SPC Pointer Table has 0x6000 for your particular song, the first pattern is at 0x6000 in SPC RAM. The value 0x00FF marks a jump, with the following two bytes containing the address to jump to. The game only uses this to loop back to a previous pattern. The value 0x0000 indicates the end of the song (i.e., stop playing), which will never be reached in a song with a loop.
The values pointed to are themselves pointers to the actual pattern data. In C notation, the pattern data for a pattern is at **pattern_tbl[i], not just *pattern_tbl[i]. This extra level indirection seems pointless, but nonetheless, it's there.
The pattern data itself is a table of eight pointers. (Yes, even more pointers!) Each pointer corresponds to a channel. If the value is 0x0000, the channel is silent for that pattern, which is often done on channel 8 to allow sound effects to be played on it.
Song SPC Pointer Table
This table is located at 262B8C in the ROM and contains 191 (0xBF) entries. Not all songs are loaded into the same offset in SPC RAM, so this table is used to tell where in SPC RAM the song is located. Each entry is a two-byte pointer in little-endian (LSB first) format.
The first entry in the table is actually song 01, not song 00 (i.e., the table is accessed as if it began at 262B8A instead of 262B8C). Song 00 does not point to an actual song, and its space in the table is probably used by the preceding data chunk. Similarly, the last song is actually song C0, although it is entry BF in the table.