Modifying NSFs

This is an archive of a topic from NESdev BBS, taken in mid-October 2019 before a server upgrade.
View original topic
Modifying NSFs
by on (#173491)
I'm new to the NSF scene. How do I modify NSFs?
Re: Modifying NSFs
by on (#173495)
They're not easy to modify, because they're the same kind of content as an NES ROM, just with no video output. The NSF file is NES machine code and music data.

To modify an NSF you need the same skillset as for NES ROM hacking. Learn the 6502 instruction set. Analyze and disassemble the code. Figure out what part does the thing you want to change, and patch that part of the code.

Every NSF has different code in it; there's no ready-made solution for this kind of thing. There are easy ways to make new NSFs from scratch, but modifying existing ones takes a lot of work. If it's for a specific game, someone may have already done some work to document the music code for you. Check romhacking.net just in case.

You might ask a more specific question, like, "how do I change the melody in track 3 of the NSF for Super Mario Bros?", because you might get a more useful answer. There's not much anybody can help in response to the general question.
Re: Modifying NSFs
by on (#173497)
In that case, what I'm working on is making the NES versions of arcade ports, starting with Mario Bros. (using the European exclusive Mario Bros. Classic Series) and Donkey Kong (using DK: Original Edition). I'd like to modify the sound effects and music to be more like the arcade version. This means I just need to change the pitch and tone and things like that. Romhacking.net doesn't seem to have anything.
Re: Modifying NSFs
by on (#173513)
I think, conceptually, what you want is to emulate the Nintendo Vs Arcade system. There already are emulators that do that.

Otherwise, you're going through a lot of effort just to emulate it on an incompatible emulator.

This reminds me of the 'hack ideas' over at rockhacking.net, where people often say...'hey, can you take the improved graphics version of the GBA port, and insert them into the NES version'. And, all I can think is...'why? You already have a GBA version that looks exactly like that. Why put 3-6 months work just to get the exact same looking thing?' I digress.
Re: Modifying NSFs
by on (#173519)
I made a typo - I'm trying to make the NES versions of arcade ports, starting with Mario Bros. (using the European exclusive Mario Bros. Classic Series) and Donkey Kong (using DK: Original Edition) more like their original arcade versions. The hack ideas thing is just any ideas that come to mind and make someone think, "Hey, that would be interesting". In certain cases, though, I agree - definitely not worth multiple months of work. What I'm trying to do is what everyone wanted back in the early to mid 80s: bring as good as possible arcade experiences to home consoles. And the NES versions just don't do it for me. They could've pushed the system to its limits to get better experiences, maybe not at first but at least by 1992 or so. I intend to do that.
Re: Modifying NSFs
by on (#173520)
I'm saying it's not worth doing, because it's already done. Get a Vs emulator (MAME ?), done.
Re: Modifying NSFs
by on (#173522)
They're not VS games. Both MB and DK ran on a Z80 with an I8039 doing the sound. (They are both emulated by MAME though.)

Anyhow, I think the kind of thing you're asking would probably take a couple of days for someone with a lot of NES development experience to accomplish. Might be a couple of months of learning preceding that for someone who is new to it. Really depends on what kind of skills you already have, versus how interesting the project is to you.
Re: Modifying NSFs
by on (#173544)
I can easily modify palettes and graphics, and soon I should be able to do text as well. It's just the music and sound effects I can't do. Would it be possible to modify addresses found within the sound area/NSF to change them? Once again, I just need to kind of make them more detailed, probably deeper, whatever I find needs to be done to make them sound like arcade games. If there's a way to modify addresses, I could probably just find out where the sound is and experiment in that area until I find what works.
Re: Modifying NSFs
by on (#173613)
Numerous times I'd accidentally freeze a channel's pitch/octave using the Cheat Console function in FCEUXD. Are you familiar with reading/writing breakpoints?
Re: Modifying NSFs
by on (#173632)
No, but I've heard of them. What is the Cheat Console thing? Is that like the Cheats function in FCEUX, where you can set new values to addresses? I might try playing around with it before I try to figure out this NSF stuff.
Re: Modifying NSFs
by on (#173636)
Probably won't work. You need advanced knowledge of 6502 assembly to understand what you're looking at, or to know what to set breakpoints for.

I recommend putting a 'help wanted' ad over at romhacking.net, and try to find someone who already knows how to do this stuff.