News:

11 March 2016 - Forum Rules

Main Menu

HOW DO I EDIT MUSIC IN SUPER MARIO 2??!!

Started by mrbope, May 17, 2023, 10:18:21 PM

Previous topic - Next topic

mrbope

Hello
I have been making an smb2 rom hack for like 2 months now and i've been wondering how to edit the music in the game. I've  tried finding tutorials but found nothing. Can someone please give help me with this?

Noan1999

Hi, in case you can't find any documentation about the smb2 engine, try looking for documentation about another game that uses the same one (for example smb1 or smb3), but obviously the data is not the same and is in different locations.

https://github.com/TheRealQuantam/RetroDocs/blob/main/Super%20Mario%20Bros%203%20Music%20Format.txt

Try to compare the music data from a disassembly of smb2 with one of smb3 to see if there is any similarity with the code of the music engine of the 2 games.

Here I have a disassembly of smb2:
https://github.com/Xkeeper0/smb2

Or else ask NesDraug about how he changed the music in his SMB2 hack.

Jorpho

#2
I agree the disassembly might be useful, but there is no reason to believe that the music engine should have anything whatsoever to do with SMB1 or SMB3.

As per https://www.romhacking.net/forum/index.php?msg=390910 the music was largely the work of "Shauing and the good folks at the SmB2 discombobulators".

Further examination of the Youtube comments indicates that he did it all manually without an editor.
https://www.youtube.com/watch?v=N1RgND_eXjU&lc=UgzAVOOxI45P0VpX9hR4AaABAg

QuoteIt is not hard once you know the steps, but of course you have to know how everything works.
This signature is an illusion and is a trap devisut by Satan. Go ahead dauntlessly! Make rapid progres!

Noan1999

Quote from: Jorpho on May 22, 2023, 01:06:53 AMI agree the disassembly might be useful, but there is no reason to believe that the music engine should have anything whatsoever to do with SMB1 or SMB3.

What I wanted to refer to was that they use the same music engine, but obviously the data is different (sound effects, songs, envelopes and some other additional coding, etc.), I did not want to refer to the fact that they had some kind of relationship between those games because obviously their data, for example of the songs, are different.

Quote from: Jorpho on May 22, 2023, 01:06:53 AMFurther examination of the Youtube comments indicates that he did it all manually without an editor.
https://www.youtube.com/watch?v=N1RgND_eXjU&lc=UgzAVOOxI45P0VpX9hR4AaABAg

Of course, it can be done even with just a hexadecimal editor, but it's a bit more comfortable with a disassembly when inserting new music, obviously you have to have knowledge about how it works.

I say this from experience with my Hack EarthBound Beginnings (which uses a different engine than Koji Kondo, which was used by Hirokuza Tanaka, this engine is also present in other games like Tetris), I have already been able to understand its format and I have been able to insert music new.

Jorpho

Quote from: Noan1999 on May 22, 2023, 10:27:11 AMWhat I wanted to refer to was that they use the same music engine
Oh! That's unexpected. Assuming that information is accurate, anyway. (I would have expected someone to have developed a flexible editing tool by now if significant code was being shared – or at least a handy way to replace it with Famitone/Famitracker. But I guess not.)
This signature is an illusion and is a trap devisut by Satan. Go ahead dauntlessly! Make rapid progres!

Noan1999

#5
Quote from: Jorpho on May 22, 2023, 11:14:08 AMOh! That's unexpected. Assuming that information is accurate, anyway. (I would have expected someone to have developed a flexible editing tool by now if significant code was being shared – or at least a handy way to replace it with Famitone/Famitracker. But I guess not.)

There is already an editor that was in development (I don't know if development is still going on), I have not tested it, but for now it only works for smb1, possibly support for smb2 and smb3 will be added.

https://github.com/anakrusis/SMBMusEdit

In the meantime, it should be try using the Quamtan documentation about the smb3 format to see if it works, obviously the data is different, but if in theory the same engine is used, the format should be the same.

NesDraug

#6
The SMB2 discombobulators keep reverse eningering and adding stuff to the smb2 source on github. They also have a discord. Link in their github. There's no straightforward guide for editing the music but it should at least be easier to do in asm. Search for "music' in the discord or ask. Theymight be able to point you in the right direction.

https://github.com/Xkeeper0/smb2


When I was working alone on the Beatles hack I made this document which describes how the SMB2 music engine correspons to notes.

https://docs.google.com/spreadsheets/d/1ZWXZQHwC7OgbENXLaasqqX2HnhPj2Q_dFVx51TGn-Cs/edit?usp=drivesdk

Then there's also note lengths, which I never quite got my head around. But it's all documented in the disassembly on github. (Note-lenghts.asm)

I never got far and Shauing took over programming the music only using hex editing which I can't recommend as it's tedious and Shauing is a wizard for pulling it off.
✍️ Blog: https://www.tumblr.com/blog/nesdraug

💀 Join my crypt on discord:
https://discord.gg/Eb4HTSNzeg