The current URL is datacrystal.tcrf.net.
Metroid/Music data format: Difference between revisions
(Created page with 'The Metroid music format was likely decoded by Dirty McDingus, as a complete description of it appears in his disassembly of the game. == Init music index table == This table ap…') |
No edit summary |
||
Line 14: | Line 14: | ||
* 7: Brinstar | * 7: Brinstar | ||
* 8: Game start | * 8: Game start | ||
* 9: | * 9: Power up (i.e. received item or beat boss) | ||
* A: Ending | * A: Ending | ||
* B: Title screen | * B: Title screen | ||
Line 31: | Line 31: | ||
* Title screen | * Title screen | ||
* Game start | * Game start | ||
* | * Power up | ||
* Brinstar | * Brinstar | ||
* Tourian | * Tourian | ||
Line 42: | Line 42: | ||
* Instrument ID for square 2 | * Instrument ID for square 2 | ||
* Address of square 1 music data | * Address of square 1 music data | ||
* Address of square 2 music | * Address of square 2 music data | ||
* Address of triangle music data | * Address of triangle music data | ||
* Address of noise music data | * Address of noise music data | ||
All of these are one byte except for the | All of these are one byte except for the addresses, which take two. | ||
If a song is not used in the current bank, its offsets are given as $0100, $0300, $0500, $0700. | If a song is not used in the current bank, its offsets are given as $0100, $0300, $0500, $0700. | ||
Line 58: | Line 58: | ||
* $02 - play a rest [i.e. a silent note] | * $02 - play a rest [i.e. a silent note] | ||
* $04-7E = plays C#2, D-2, D#2 ... F-7. | * $04-7E = plays C#2, D-2, D#2 ... F-7. | ||
== Note lengths table == | |||
This is where the music format gets a bit annoying. :) Metroid doesn't define things like quarter notes and eighth notes, nor does it specify a number of frames to hold a note. Instead, the number of frames is stored in a table, and which table is used depends on the song (see Init Music Table). | |||
The number of frames a note is held is as follows (in decimal): | |||
'''Table 0''' (index of $00) - used by Power Up and Kraid | |||
* 0: 4 | |||
* 1: 8 | |||
* 2: 16 | |||
* 3: 32 | |||
* 4: 64 | |||
* 5: 24 | |||
* 6: 48 | |||
* 7: 12 | |||
* 8: 11 | |||
* 9: 5 | |||
* A: 2 | |||
'''Table 1''' (index of $0B) - used by all music that doesn't use tables 0 or 2 | |||
* 0: 6 | |||
* 1: 12 | |||
* 2: 24 | |||
* 3: 48 | |||
* 4: 96 | |||
* 5: 36 | |||
* 6: 72 | |||
* 7: 18 | |||
* 8: 16 | |||
* 9: 8 | |||
* A: 3 | |||
'''Table 2''' (index of $17) - used by title screen and ending | |||
* 0: 16 | |||
* 1: 7 | |||
* 2: 14 | |||
* 3: 28 | |||
* 4: 56 | |||
* 5: 112 | |||
* 6: 42 | |||
* 7: 21 | |||
* 8: 18 | |||
* 9: 2 | |||
* A: 3 |
Revision as of 14:51, 22 March 2011
The Metroid music format was likely decoded by Dirty McDingus, as a complete description of it appears in his disassembly of the game.
Init music index table
This table appears at BBFA in every ROM bank with music (every bank except the graphics and engine banks). It translates song IDs into offsets (given as one byte) into the Init Music Table. Curiously, the songs are not in the same order in the two tables.
The song order is:
- 0: Ridley
- 1: Tourian
- 2: Item room
- 3: Kraid
- 4: Norfair
- 5: Escape
- 6: Mother Brain
- 7: Brinstar
- 8: Game start
- 9: Power up (i.e. received item or beat boss)
- A: Ending
- B: Title screen
Init Music Table
This table is present in every ROM bank with music. It is located at $BD31 in each bank.
The order (as defined by the Init Music Index table) is:
- Mother Brain
- Escape
- Norfair
- Kraid
- Item room
- Ridley
- Ending
- Title screen
- Game start
- Power up
- Brinstar
- Tourian
The format is:
- Index into note length table (will be $00, $0B, or $17)
- Does song loop at end? (zero = no, nonzero = yes)
- Length counter for triangle channel
- Instrument ID for square 1
- Instrument ID for square 2
- Address of square 1 music data
- Address of square 2 music data
- Address of triangle music data
- Address of noise music data
All of these are one byte except for the addresses, which take two.
If a song is not used in the current bank, its offsets are given as $0100, $0300, $0500, $0700.
Music data
- $00 - Ends or loops the song. Affects all channels.
- $Bx - Sets length of subsequent notes to x (as defined by the song's note lengths table)
- %11xxxxxx - start of local loop; loop x times
- $FF - end of local loop
- $01 - plays an A-1 note
- $02 - play a rest [i.e. a silent note]
- $04-7E = plays C#2, D-2, D#2 ... F-7.
Note lengths table
This is where the music format gets a bit annoying. :) Metroid doesn't define things like quarter notes and eighth notes, nor does it specify a number of frames to hold a note. Instead, the number of frames is stored in a table, and which table is used depends on the song (see Init Music Table).
The number of frames a note is held is as follows (in decimal):
Table 0 (index of $00) - used by Power Up and Kraid
- 0: 4
- 1: 8
- 2: 16
- 3: 32
- 4: 64
- 5: 24
- 6: 48
- 7: 12
- 8: 11
- 9: 5
- A: 2
Table 1 (index of $0B) - used by all music that doesn't use tables 0 or 2
- 0: 6
- 1: 12
- 2: 24
- 3: 48
- 4: 96
- 5: 36
- 6: 72
- 7: 18
- 8: 16
- 9: 8
- A: 3
Table 2 (index of $17) - used by title screen and ending
- 0: 16
- 1: 7
- 2: 14
- 3: 28
- 4: 56
- 5: 112
- 6: 42
- 7: 21
- 8: 18
- 9: 2
- A: 3