Register | Login
Views: 19364387
Main | Memberlist | Active users | ACS | Commons | Calendar | Online users
Ranks | FAQ | Color Chart | Photo album | IRC Chat
11-02-05 12:59 PM
1 user currently in Rom Hacking: hukka | 2 guests
Acmlm's Board - I2 Archive - Rom Hacking - How To Create Your Own Music For Megaman 2 | |
Add to favorites | "RSS" Feed | Next newer thread | Next older thread
User Post
infidelity

Red Paratroopa
Level: 21

Posts: 161/164
EXP: 42804
For next: 7139

Since: 09-13-04
From: U.S.A.

Since last post: 2 days
Last activity: 6 hours
Posted on 10-31-05 01:40 AM Link | Quote
I'd first like to thank Matrixz, for helping me understand the original Japanesse thread, that deals with editing the music in Megaman 2. http://klikechange.free.fr/Rockman2.htm If it wasn't for his expertise, I wouldn't have been able to create this turtorial. I'd also like to thank Matrixz, for helping me find the value in Megaman 2, which tells you which song is playing.

Tools used in finding/creating music
------------------------------------------------------------
FCEUXD's 6502 Debugger & Hex Editor
Windows Calculator
Your Own Creativity

How To Find Out Which Song Is Playing
-------------------------------------------------------------------
I'm going to give you an example, of finding the pre-intro song to Megaman 2. "REMEMBER, THIS EXAMPLE WILL APPLY TO ALL SONGS"

First, open Megaman 2, and pause it, "F2" at the copyright screen. Second, open the "6502 Debugger," and add an "Execute Breakpoint" to "8003," then click "Run"

Second, just as the pre-intro screen fades in, the debugger sould snap. Look at the Debugger's "A" value now, and it should say "0E." This tells you, that the pre-intro song is, "0E"

How To Find The Songs Pointer
------------------------------------------------------
We're continuing on with the pre-intro song example.

First, open up your Windows Calculator, and make sure it's set to "Scientific," and also, make sure it's set to "Hex" NOT "Dec"

Second, enter the value "0E" and multiply it by "2" You should end up with the value, "1C" then add, "30A60." (30A60 is the Song Pointer Table), then, click equals, and you should get this value "30A7C"

Third, open up the "Hex Editor" in FCEUXD, and make it view in "ROM File," then, goto the address, "30A7C" You should see these values, "B4,B1" Your now at the Song Pointer, for song "0E," "The Pre-Intro Song."

How To Find The Song
-----------------------------------------
We're continuing on with the pre-intro song example.

In order for us to find the song correctly, Megaman 2 has it's song pointers, in High Byte, to, Low Byte format. What that means is, "B4,B1" is actually read as, "B1,B4" This goes for all song pointers in this ROM. So,

First, goto your Windows Calculator, and type in the value, "B1B4" then add the value, "28010" You should now end up with the value, "331C4" This tells you now exactly where the "pre-intro song" is in the ROM.

How To Figure Out What This Mess Is
----------------------------------------------------------------
We're continuing on with the pre-intro song example.

I'm still unsure on some aspects, as to how to correctly understand some things here. I'm hoping that with this information I'm releasing, others will be able to figure out, and add to this list, the things I'm unable to understand. Anyways,

First, goto the address "331C4" in FCEUXD's Hex Editor. You'll notice that you end up at "0F" (So far, from what I've noticed, "0F" is always the beginning of the songs.) You should see these values "0F,BF,B1,3D,B2,B9,B2,1D,B3,53,B3,00"

I'm going to explain these values to you.

0F - The beginning of the song (By beginning, I do not mean the tones and stuff, this value basicly tells the rom, this is where to begin to find all the pointers.)

"Remember earlier, how I said Megaman 2 searches High Byte, to Low Byte, for it's pointers? Well, what I'm about to show you, are the pointers, to the sound channels"

B1,BF - This points to the Square 1 channel (usually the main beat)

B2,3D - This points to the Square 2 channel (usually the back beat)

B2,B9 - This points to the Square 3 channel (usually the bass)

B3,1D - This points to the Square 4 channel (usually the drums)

B3,53 - ?? Matrixz and I, have no idea what these are.

00 - ?? This, I believe, seperates things.


So, let's goto the first channel. "B1,BF" (The example I'm about to give, will work for the other channel pointers as well)

First, enter "B1BF" in your Windows Calculator, then add "28010" you should end up with, "331CF" This tells you exactly where Square 1 begins. This tells you exactly where B1,BF is pointing to.

You'll notice that it starts at "00" This is the beginning of Square Channel 1. You'll notice this set of values, "00,08,05,20,02,80,03,3E,07,DF,40,08,00,21" These sets of values, basicly sets up how the sound will sound. I'll try to explain these as best I can.

00 - Pointer for Square Channel 1

08 - Speed for Square Channel 1, the higher the value, the slower the sound, the lower the value, the faster the sound

05 - ?? Different tones, sometimes it screwes up. I'm not sure on how to use this correctly

20 - Different Pitch's

02 - ?? Not sure. I usually leave it as is.

80 - ?? Different Tones??

03 - ?? Different Tones??

3E - Volume for sound, anything below "30" and it glitches.

07 - ?? Different Tones? If it's set to "0A" it resets the entire rom

DF - ?? Different Tone effects??

40 - ?? Not sure.

08 - * This seems to give the notes that vibrato feeling to it, this value is usually followed by 00,01,02, etc, I'm not sure as to what those values due to the sound. Also, anytime you see "08" there will usually be "21" right after it, or a few after it. Im not sure if this tells "08" when to stop the vibrato effect to the sound.

00 - * Look at "08"

21 - * Look at "08"

So, all that there, is the beginning's on making the sounds sound. You'll notice in your Hex Editor, that after "21" you'll notice "AE" This is the very beginning note for the sound channel.

How To Understand The Sounds
-------------------------------------------------------
We're continuing on with the pre-intro song example.

From what I've come across. anything that is "40, 60, 80, A0, B0, C0, D0, E0, F0"
are pauses until the next note kicks in. The lower the value, the shorter the pause, the higher the value, the longer the pause. Pauses all end with the value "0"

For notes, it appears that "61" makes the note, sound the quickest, and, "FF" makes the note sound the longest. So, 61-6F, 71-7F, 81-8F, 91-9F, A1-AF, B1-BF, C1-CF, D1-DF, E1-EF, F1-FF, deal with notes.


How To Understand Loops
-----------------------------------------------
We're continuing on with the pre-intro song example.

You'll notice, how sounds loop in certain places throughout all songs. Loops always look like this. "04,xx,xx,xx" If you goto value "331E5" in your Hex Editor, you'll notice a loop. You should see this set of values. "04,01,C1,B1"

04 - Loop command

01 - How many times to loop. "If this value is set to 00, it will loop infinite"

C1 & B1 - These are pointers. These point to where to begin the loop. So, it says, "C1,B1" Remember how I said Megaman 2 deals with High Byte, then Low Byte? Open your Windows Calculator, and type in the value, "B1C1" then add, "28010" to it, you should end up with the value "331D1" This value is where the loop begins at.

How To Create A Demo Sound
-----------------------------------------------------
We're continuing on with the pre-intro song example.

OK, so now your like, I want to make my own song, how do I do it? Well, I'll do my best in helping.

First, it gets kind of annoying trying to create a sound for one channel, when you got all the others going on in the backround right? Well, what you should do, is turn them off, or, just give them extremely long pauses, so you can understand what your doing. So first, we're going to temporarely shut off the 2nd 3rd and 4th channels.

Do you remember how I spoke about the pointers to those channels? We need to find out where those channels begin. So, instead of telling you straight out where they are, I'll give you examples for the 2nd 3rd and 4th channel pointers.

Remember the section "How To Figure Out What This Mess Is" This section tells you where the actuall song begins. This song begins at value" 331C4" so, here it is again, 0F,BF,B1,3D,B2,B9,B2,1D,B3,53,B3,00

We already know that B1,BF is sound channel 1. So, B2,3D is sound channel 2. In your Calculator, enter B23D, and add 28010 to it. You'll get 3324D, this is the beginning of sound channel 2.

Enter B2B9 into your Calculator, and add 28010 to it. You'll get 332C9, this is the beginning of sound channel 3.

Enter B31D into your Calculator, and add 28010 to it. You'll get 3332D, this is the beginning of sound channel 4.

So, in the Hex Editor, goto address 3324D, and type "E0" a shit load of times. I usually do it about 10 times for every sound channel.

Do the same for 332C9, and 3332D.

Now, listen to the song, and you will only hear channel 1 playing in the backround.

Now, lets edit channel 1.

For starters, keep everything the same from 331C4 to 331DC. You'll notice that at, 331DD, the value is AE, this is the first note. Starting at AE change it to E0, and change the other values to E0, just before the first loop begins. Remember what a loop looks like? "04,xx,xx,xx" So, type E0 from 331DD to 331E4. When you listen to the song again, theres no sound, nothing until the building moves up, but that's ok.

Now, let's try this, starting at 331DA, type in these values, "61,62,63,64,65,66,67,68,69,6A,6B,6C" When you play the song again, you'll hear what you just typed in there, and it will loop, 1 time through.

Let's edit how many times that loops, I say, let's let it loop infinite. So, we see the loop command, 04,01,C1,B1, let's change the "01" to "00" Once that's done, Listen to the song again, it will not stop until the Main Title Song kicks in.

Now, let's try changing the tone. Goto the address 331D2, the value should say "20" let's change it to "30" When you start the song again, you'll notice it sounds higher now.

Now, let's change it's speed. Goto the address 331d0, the value should say "08" let's change it to "02" When you start the song again, it sounds like an alert going off!

Well, I hope this sheds some light on editing the songs for Megaman 2. I apologize if this sounds so scrambled, I never typed a tutorial this big before. But If you follow the examples I gave you, you'll be able to find, edit, and create your own songs for Megaman 2. Trust me, the information I gave does work, and I can prove it. Here's an ips of Megaman Ultra, with some edited songs. Try playing Woodman, Wily 1 and Wily 3, to hear my edited songs. "I'm still working on Crashman, it's not finished, but you'll be able to tell what song I'm going to put there " I created these songs all by ear, and had a tiny bit of help, by listening to nsf's, to be close to perfection as possible with 2 of the songs!



http://rapidshare.de/files/6978409/megamanultramusic.ips.html



Is this sticky worthy anybody?


(edited by infidelity on 10-30-05 04:42 PM)
dan

Snap Dragon
Level: 43

Posts: 777/782
EXP: 534516
For next: 30530

Since: 03-15-04

Since last post: 20 hours
Last activity: 14 hours
Posted on 10-31-05 01:58 AM Link | Quote
Useful indeed. I was just looking into this music engine the other day (for Mega Man 1), so this document could be extremely useful to me.
kuja killer

Rat
Level: 11

Posts: 75/80
EXP: 4582
For next: 1403

Since: 09-22-05
From: Lake Havasu City, Arizona

Since last post: 10 hours
Last activity: 1 hour
Posted on 10-31-05 02:03 AM Link | Quote
Danng..
I'm going to put this on a notepad file for myself to keep just in case.

I haven't read this post entirly you just made. but it looks very helpful.

I really want to hack the music of Megaman 3.

I found some sound effects this weekend though by using a little sound tool.

Like the shooting sound is generated by the Pulse 2 or Noise channel i think..i forget which.
http://www.alienaa.com/members/108/music.PNG





(edited by kuja killer on 10-30-05 05:03 PM)
infidelity

Red Paratroopa
Level: 21

Posts: 163/164
EXP: 42804
For next: 7139

Since: 09-13-04
From: U.S.A.

Since last post: 2 days
Last activity: 6 hours
Posted on 10-31-05 02:07 AM Link | Quote
dan - that's so funny you mentioned that. I was talking to bbitmaster about the mm1 engine, and he mentioned to me it's pretty much similar. I tried using the same value $8003 in the 6502 debugger, to see if I can find where the songs were, but I had no luck. I was thinking on inserting Elecman's music into my hack, but I've been unsuccessful in finding the value, that tells what song is playing during whatever stage in Megaman 1. Just thought I'd throw that out there.
Disch

Micro-Goomba
Level: 4

Posts: 11/16
EXP: 226
For next: 53

Since: 10-21-05

Since last post: 12 hours
Last activity: 1 day
Posted on 10-31-05 02:23 AM Link | Quote
Originally posted by infidelity
I tried using the same value $8003 in the 6502 debugger


The trick with that is, the game is loading the song ID number into A and then jumping to the "Music Init" routine to load a song. This is common practice in many games.

Fortunately, many people already filtered through all the code and stuff required to find the address of that Init routine -- to rip NSFs! So if you want to know the Init routine of the game, there's a good chance you can just pick up the NSF, and look at offset 0x0000A and 0x0000B (the Init address in the NSF header) and use that value.

It won't work all the time, but it's worth a shot.
dan

Snap Dragon
Level: 43

Posts: 778/782
EXP: 534516
For next: 30530

Since: 03-15-04

Since last post: 20 hours
Last activity: 14 hours
Posted on 10-31-05 02:27 AM Link | Quote
All the songs using this engine seem to write the song ID to $580. If you put a write breakpoint on that, and follow along enough, you'll eventually come to the pointers location. I used this method to discover where Mega Man 1 and Mega Man 2's pointer list are located.
kuja killer

Rat
Level: 11

Posts: 76/80
EXP: 4582
For next: 1403

Since: 09-22-05
From: Lake Havasu City, Arizona

Since last post: 10 hours
Last activity: 1 hour
Posted on 10-31-05 02:59 AM Link | Quote
Ahh, that's crazy. I just followed along with the guide to try it out on a clean megaman 2 ROM.

Awsome.
Bit-Blade
Pixel Artist

Level: 34

Posts: 443/445
EXP: 229264
For next: 24387

Since: 03-16-04

Since last post: 2 days
Last activity: 7 hours
Posted on 10-31-05 03:14 AM Link | Quote
Originally posted by Disch
Originally posted by infidelity
I tried using the same value $8003 in the 6502 debugger


The trick with that is, the game is loading the song ID number into A and then jumping to the "Music Init" routine to load a song. This is common practice in many games.

Fortunately, many people already filtered through all the code and stuff required to find the address of that Init routine -- to rip NSFs! So if you want to know the Init routine of the game, there's a good chance you can just pick up the NSF, and look at offset 0x0000A and 0x0000B (the Init address in the NSF header) and use that value.

It won't work all the time, but it's worth a shot.


I've done that, actually. I've used NSFs to find exactly where the 'ripped' nsf data starts and ends in the original rom (which isn't all that hard). Although if I'm not misunderstanding this... it's not the location of the data itself that's the problem, but how it is executed and what changes in the in-rom variables?

So... I've heard that the music engine for megaman 1 and megaman 2 are not necesarilly the same. Are you sure you can get Electric Man's music to play in Megaman 2? Also, there is a game I think comes VERY close to the megaman 2 engine. It's called Legendary Wings, and there is an NSF of it too. At least a few of the songs in that sountrack are fairly memorable, if you want to use them (and assuming that the Legendary Wings sound engine is as similiar to MM2's as I think it might be).

On a somewhat off-topic note Astyanax (Lord of King in japan) and The Battle of Olympus seem to share the exact same music engine but different composers. I've always wondered about that, since the two games were made by two very different companies. Jaleco made Astyanax, Broderbund did Battle of Olympus.
infidelity

Red Paratroopa
Level: 21

Posts: 164/164
EXP: 42804
For next: 7139

Since: 09-13-04
From: U.S.A.

Since last post: 2 days
Last activity: 6 hours
Posted on 10-31-05 03:23 AM Link | Quote
hmm, i've tried opening the megaman 1 nsf in my emu, but it wont play anything, i can move through the songs, but none of them will play, i tried pushing the a,b buttons.

also i can't look through this nsf with the hex editor.

any ideas?

also, I was able to find what music value is used, to play in elecman's stage. I'm just unaware of understanding how to find the pointers for the actual song. So far so good though.
dan

Snap Dragon
Level: 43

Posts: 779/782
EXP: 534516
For next: 30530

Since: 03-15-04

Since last post: 20 hours
Last activity: 14 hours
Posted on 10-31-05 02:26 PM Link | Quote
The pointers to Mega Man 1's music are located at $11A70 in the ROM.
Sliver X

Level: 8

Posts: 19/19
EXP: 1942
For next: 245

Since: 05-01-04

Since last post: 1 day
Last activity: 3 days
Posted on 10-31-05 04:11 PM Link | Quote
I hacked Mega Man 1's music years ago, but cannot for the life of me find the notes I took on its format. If I can find it, I'll be sure to post it here.
kuja killer

Rat
Level: 11

Posts: 78/80
EXP: 4582
For next: 1403

Since: 09-22-05
From: Lake Havasu City, Arizona

Since last post: 10 hours
Last activity: 1 hour
Posted on 11-01-05 01:32 PM Link | Quote
I'm having a pretty difficult time trying to figure out on my own how to do this for MM3.
http://elazulspad.net/matrixz/romstuff/capmusfrm.txt
I can find the song ID's at least using the same method described for setting a Execute breakpoint to 8003 easily..

But on that site, not sure how to properly use the sound engine bank +A43...with a song ID.
Say I find Sparkman music, it's "07" ..would i just do .. sound engine bank +A43 +07?
It doesn't say if I'm suppose to use 2C010, 2E010, or 30010..but i've tried them all ...i've tried like endless different combinations and can't find what I'm looking for. I do KNOW that the start of the entire sound engine thing starts at 2C010 obviously.

Also I noticed that the byte on 2C017 is "00" ...and anything after that I edit affects the beginning MM3 intro music. But I think I'm doing it wrong or something. :|

Basically just like infidelity was trying to find the song pointers for Megaman 1 ..yea..i'm trying to do the same...but for mm3 ...
Specficially I want to edit stage music, not the intro. I can find the sond id's and stuff...i've got a whole list of them all already


(edited by kuja killer on 11-01-05 04:34 AM)
(edited by kuja killer on 11-01-05 04:35 AM)
(edited by kuja killer on 11-01-05 04:40 AM)
(edited by kuja killer on 11-01-05 04:41 AM)
Jaspile

Red Koopa
Level: 20

Posts: 133/133
EXP: 37467
For next: 4972

Since: 03-15-04
From: Paris, France

Since last post: 20 hours
Last activity: 11 hours
Posted on 11-01-05 04:10 PM Link | Quote
Here, things I found some time ago for mm5 :
mm5songs

Also, if you want to easily find a particular song's data, FCEUXD's Code/Data is the best tool for this : start it just before your song plays, wait for the song to have reached its last loop (don't play the game in the same time or you'll have useless data registered, thus it will be harder to find your song) and watch in the Hex editor for a bunch of blue data : that should be the song (it usually is at the end of the ROM). Try to change some bytes to verify if this is actually the song data.
With the time you'll distinguish more easily music data from other datas.
Matrixz

Goomba
Level: 8

Posts: 19/20
EXP: 2186
For next: 1

Since: 03-15-04
From: Norway

Since last post: 12 hours
Last activity: 7 hours
Posted on 11-01-05 05:29 PM Link | Quote
Originally posted by kuja killer

Say I find Sparkman music, it's "07" ..would i just do .. sound engine bank +A43 +07?
It doesn't say if I'm suppose to use 2C010, 2E010, or 30010..but i've tried them all ...i've tried like endless different combinations and can't find what I'm looking for. I do KNOW that the start of the entire sound engine thing starts at 2C010 obviously.


Its 2C010. But do ($2CA53 + ($7 * 2)) and look there. You have to multiply it by two since each song uses a 2-byte pointer in the song adress table.
My document could be more precise at that point, yeah..
Looking in the adress table and calculating pointers goes fast once you have done it a few times.

Sticky this!
kuja killer

Rat
Level: 11

Posts: 79/80
EXP: 4582
For next: 1403

Since: 09-22-05
From: Lake Havasu City, Arizona

Since last post: 10 hours
Last activity: 1 hour
Posted on 11-01-05 09:59 PM Link | Quote
Originally posted by Matrixz

Its 2C010. But do ($2CA53 + ($7 * 2)) and look there. You have to multiply it by two since each song uses a 2-byte pointer in the song adress table.
My document could be more precise at that point, yeah..
Looking in the adress table and calculating pointers goes fast once you have done it a few times.


Blehh Let's see..so that's 2CA61 when doing the adding.
First 2 bytes are A7, C1 ...now i'd take C1A7 + 2C010 - 8000 right ?
Now i'm at 301B7

Now (since im following along with your site, which you did great on, and i respect that since you're smarter knowing this stuff) ...it says if a bye starts with "0" ..song otherwise sound effect.
Do you mean 00 ? ...or something else ? ..i see a 0D at 301B7 ..then ... 28 03 28 48 01 68 0D 00
Hmm I'd change the values just for the hell of it after the 0D to random numbers as a test, don't notice any change.

So in other words...i take the first 2 bytes after 0D .... 0328 + 2C010 - 8000 to find the start of at least 1 channel ?? that comes up as 24338 which is completely off and way out of the range of the entire sound engine area.
Sorry to be hassle. Just wanting to learn properly.


(edited by kuja killer on 11-01-05 01:01 PM)
(edited by kuja killer on 11-01-05 01:07 PM)
Matrixz

Goomba
Level: 8

Posts: 20/20
EXP: 2186
For next: 1

Since: 03-15-04
From: Norway

Since last post: 12 hours
Last activity: 7 hours
Posted on 11-02-05 12:30 AM Link | Quote
Originally posted by kuja killer

Blehh Let's see..so that's 2CA61 when doing the adding.
First 2 bytes are A7, C1 ...now i'd take C1A7 + 2C010 - 8000 right ?


The bytes are ordered the other way around actually: A7C1. That should clear everything up.
But then yeah.. you'd do A7C1 + 2C010 - 8000 (or just A7C1 + 24010 blah).
You'll get 2E7D1. There is the Sparkman music.
Thats the weird difference from MM2 to MM3.. the music pointer bytes are order High first the Low.. very unusual.

Originally posted by kuja killer

...it says if a bye starts with "0" ..song otherwise sound effect.
Do you mean 00 ? ...or something else ?


Nah its always 00 if its a song. But now the problem is solved anyway.

kuja killer

Rat
Level: 11

Posts: 80/80
EXP: 4582
For next: 1403

Since: 09-22-05
From: Lake Havasu City, Arizona

Since last post: 10 hours
Last activity: 1 hour
Posted on 11-02-05 02:05 AM Link | Quote
Originally posted by Matrixz


The bytes are ordered the other way around actually: A7C1. That should clear everything up.
But then yeah.. you'd do A7C1 + 2C010 - 8000 (or just A7C1 + 24010 blah).
You'll get 2E7D1. There is the Sparkman music.
Thats the weird difference from MM2 to MM3.. the music pointer bytes are order High first the Low.. very unusual.

Nah its always 00 if its a song. But now the problem is solved anyway.



Ahh I see now. Gosh ...this whole time i kept ordering the bytes backwards switching them around and I didn't even think to try keeping them the same way when doing my calculations. Darn, sorry. Thank you SO much for your help and genoristy Maxtrixz. I seriously do appreciate it and have respect for you. Not just because I wanted to brag or think you're better than everyone else, I just mean it because your being helpful and nice and so on. Honestly!

One more question for now ..now is each sound data channel exactly 14 bytes in length always ? ..or is it longer or shorter depending on different music and sound effects ?
I'm saying...does a 00 indicate the end of the data for a specific channel or is it "AA"

For example, I wanted to go to the Noise channel for sparkman music which is 2EA7A ...has the following:
06 C8 07 0C 08 0C 04 00 63 60 6F 6F 0E 1B
Is the end of this noice channel the "AA" located after the 1B ? ..or does it end at the "00" which is next to the 04 ?

Hope that makes sense
Edit: ohhhh ..a channel ends when a byte is "17" huh ? ...so the end of this noise channel for sparkman music actually starts from 2EA7A, and ends at 2EAD1 since that particular byte on the 2ead1 reads 17 ??

I may have just a few more questions if that's okay later. So that I'm understanding more about how it all works.


(edited by kuja killer on 11-01-05 05:06 PM)
(edited by kuja killer on 11-01-05 05:10 PM)
(edited by kuja killer on 11-01-05 06:11 PM)
Add to favorites | "RSS" Feed | Next newer thread | Next older thread
Acmlm's Board - I2 Archive - Rom Hacking - How To Create Your Own Music For Megaman 2 | |


ABII


AcmlmBoard vl.ol (11-01-05)
© 2000-2005 Acmlm, Emuz, et al



Page rendered in 0.020 seconds.