Points of Required Attention™
Please chime in on a proposed restructuring of the ROM hacking sections.
Views: 88,485,824
Main | FAQ | Uploader | IRC chat | Radio | Memberlist | Active users | Latest posts | Calendar | Stats | Online users | Search 04-26-24 07:07 AM
Guest: Register | Login

0 users currently in ROM Hacking | 3 guests

Main - ROM Hacking - Mega Man 2 Music/SFX Hacking Info - Updated New thread | New reply


NARFNra
Posted on 07-08-16 09:17 PM (rev. 2 of 07-08-16 09:17 PM) Link | Quote | ID: 163459


Koopa
Level: 25

Posts: 112/114
EXP: 87649
Next: 1971

Since: 02-13-10
From: Texas

Last post: 1806 days
Last view: 1806 days
Hey all! I know we've technically had this info around for a long time, but I could never make heads or tails of it partially thanks to what I assume is a google translate translation. I went ahead and asked the guy responsible for Rockman CX to help me out with understanding Mega Man 2's sound engine and he was kind enough to type up a file in English for me. It still has some translation issues, but I think it gets the point across much clearer. I was going to use the info myself, but being as I haven't done anything hacking related in quite a while, I figured I'd just post it in the hopes it helps someone else out.

The Sound Engine for Rockman 2
2016 Himajin Jichiku

This document refers to the following URL:
http://www.geocities.co.jp/Playtown-Bingo/2392/rock2m/

[Music Definition]
$30A50 ... Addresses of the beginning of the music and SFXs(2 bytes per a music).
ex.)
$30A50: D6 8A ... Track 00 begins at $8AD6($30AD6).
$30A52: 1D 8E ... Track 01 begins at $8E1D($38E1D).

0F says that the music begins, following addresses means the address of each track.
0F (SQ1) (SQ2) (TRI) (NOI) (MOD)

(MOD) shows where Modulation Difinition Table begins.

[Notes]
A note is made from (Y0 + XX).
Y0 means the length of the note. It must be 40, 60, 80, A0, C0, or E0.
ex.) 60 is twice as long as 40. 80 is twice as long as 60, and is 4 times as long as 40.
XX means the chromatic scale of the note.
It must be 01 through 1F. 00 makes the note rest.
The actually scale is XX plus a base key(set by operation code 05).

In NOI, XX shoud be 01 through 0F. It means the tone of the note.

[Operation Codes]
Music is made of notes and operation codes.
00 to 3F are operation codes.
00 XX ... Sets a tempo. The more XX increases, the slowly the track plays.
01 XX ... Sets a pitch envelope. XX means the amount of change per frame.
A plus value(00 to 7F) makes the note lower, a minus value(FF to 80) makes higher.
02 XX ... Sets a tone of the track.
In SQ1 and SQ2, XX shoud be 00, 40, 80, or C0.
In NOI, XX shoud be 00 or 80.
In TRI, this doesn't work. so you don't have to write it.
03 XX ... Sets a volume. I call this max volume.
In SQ1, SQ2, and NOI, set 31 through 3F to work fine.
This writes bit5-0 of XX on the bit5-0 of APU register $4000, $4004, $400C.
In TRI, set 00-7F to play for a while(larger value means to play longer).
Setting 80-FF, the note will never stop playing.
This writes whole XX on APU register $4008.
04 NN XX YY ... Loop operation. This means to jump $YYXX NN times. If NN is 00, this always jumps.
05 XX ... Sets a base chromatic scale. (XX increases 1 per a halftone.)
The actual scale that XX means is written below URL.
http://www.geocities.co.jp/Playtown-Bingo/2392/rock2m/r2musicfreq.htm
06 ... A following note becomes dotted.
07 XX Y0 ... Sets a volume envelope.
Bit7 of XX is the direction of the change.
0 is increase, from 0 to max volume.
1 is decrease, from max volume to 0.
Y0 is the amount of the change per bit6-0 of XX frame(s).
08 XX ... Selects a Modulation Definition. It must be 00 through 3F.
09 ... End of the track.
2X ... 20-27 means tie. Following X+1 notes are tied.
ex.) "22 42 41 40" will play a note three times as long as normal 42.
technique) "21 68 08 01 68" will change Modulation Difinition from the middle of the note.
30 ... A following note will play a little shorter. This is useful for tuplet notes.

[Modulation Definition Table]
This defines WW XX YY ZZ.
WW XX ... This is pitch bend, useful for vibratos.
Pitch is changed bit7-5 of XX per bit6-0 of WW frame(s).
If pitch is changed bit4-0 of XX time(s), the direction of change will be inverted.
YY ZZ ... This is volume modulation.
The volume will be changed from 0 to max volume, ZZ per bit6-0 of YY frame(s).
bit7 of YY is the first direction of the volume mod.
0 is increase, then decrease.
1 is decrease, then increase.

To disable all Modulation, write 00 00 80 00.

ex.) $8E15: 00 00 80 00 02 62 80 00
Two Modulations are defined.
#0: 00 00 80 00 ... Both pitch and volume modulations are disabled.
#1: 02 62 80 00 ... Pitch modulation is enabled.
Freq. = 2, Amount = 3, Repeat = 2
Usage of this Modulations:
08 00 41 ... Play 41 with Modulation #0, normal 41.
08 01 41 ... Play 41 with Modulation #1, pitch modulated 41.

[SFXs Definition]
X0 0Y says that the SFX begins.
X0 is the strength of the SFX. The larger X is, the less the SFX is likely to be overwritten.
0Y is what track the SFX uses(+01: SQ1, +02: SQ2, +04: TRI, +08: NOI).

[The Structure of SFX]
SFX have a sequentially data made of operation codes and register value.

Register value, XX YY, is (8000 + (0 through 7FF)).
If XX is 8F, it will do nothing, useful for change operations.

Available operation codes are below:
00 XX ... Waits XX frame(s) for play next data. XX shoud be over 02.
01 XX ... Sets a pitch envelope. This is same as music's.
02 XX ... Sets a tone. This is same as music's.
03 XX ... Sets a volume. This is same as music's.
04 NN XX YY ... Loop operation. This is same as music's.
05 WW XX YY ZZ ... Following data is applied a Modulation.
06 ... End of the SFX.

ex.) $BB22($33B22):
50 0A 02 00 03 3F 83 8A 00 06 03 3F 80 0A 80 35 00 09 02 80 01 FF 80 05
50 0A ... SFX begins. Strength = 5, Tracks = 08+02 = SQ2, NOI
02 00 03 3F 83 8A ... SQ2 data. Register value works as a separator.
00 06 03 3F 80 0A ... NOI data. The last track should include 00 XX.

80 35 ... The next SQ2 data.
00 09 02 80 01 FF 80 05 ... The next NOI data.

The order of track data is SQ1->SQ2->TRI->NOI.







Main - ROM Hacking - Mega Man 2 Music/SFX Hacking Info - Updated New thread | New reply

Acmlmboard 2.1+4δ (2023-01-15)
© 2005-2023 Acmlm, blackhole89, Xkeeper et al.

Page rendered in 0.018 seconds. (349KB of memory used)
MySQL - queries: 37, rows: 57/58, time: 0.015 seconds.