Thysbelon.Logo of a Hummingbird moth.

I Tried to Improve Nintendo DS Music Romhacking

Hello! Over the last two months, I spent a lot of time improving my fork of GBA_Mus_Ripper. I fixed bugs, made the outputted midi and sf2 sound more accurate to the GBA, made it compatible with more GBA games, and updated the documentation.

Unless users find more bugs (I may not always fix bugs right away, but I always appreciate it when users inform me of bugs!), or that one infinite loop bug I found ends up affecting more songs than just the "Unknown Item Jingle" from Metroid: Zero Mission (Japan), GBA_Mus_Ripper is complete!

With GBA_Mus_Ripper finished, I was curious to see if there was anything I could do to improve Nintendo DS music romhacking.

My main goals were to allow users to convert to and from sseq (DS sequenced music format) and midi mostly losslessly, inject these sseq files into a DS rom, and to do all this on Linux. That last goal was important to me, and I'm happy to say I achieved it. (all of these programs should work on Windows as well. Please politely let me know if they don't!)

Keep in mind that all this hasn't been tested rigorously. I was able to extract a song from Kirby: Canvas Curse, modify it, then inject it back into the game and run it on MelonDS 0.9.5; but the song I tested didn't use many different sequence commands, so there could still be bugs that I missed. Politely letting me know about bugs in the issues tab on GitHub is always appreciated!

sseq2mid

This program was originally written by loveemu. It was the best simple sseq-to-midi program I could find, so I decided I would try to do my best to improve it. I went through the list of sseq commands, and implemented midi conversions for the sseq commands that didn't have them.

Keep in mind that most of the midi conversions I implemented are completely inaudible in the exported midi. sseq has a lot of commands that don't have an equivalent in midi. One day, I might create a DS-sound-bank-2-sf2 converter that uses modulators to make these commands audible, but that won't be anytime soon because it would be a lot of work; the GBA_Mus_Ripper suite already had sound_font_ripper, a simple program that I could modify to add modulators to the soundfonts, but I don't think a simple DS-sound-bank-2-sf2 program currently exists that I could modify.

The reason I implemented all these commands, even though they're inaudible in the midi, is because I designed my fork of midi2sseq to read these commands and convert them back to their sseq equivalent, preserving all of the effects used in the song.

midi2sseq

This program was originally written by fincs. perallard made a fork of fincs's program with a few improvements, so I decided to fork perallard's fork. Like with sseq2mid, I did my best to implement conversions for every sseq command.

SDATTool

I did not write this program, nor did I make any modifications to it. I am including it in this blog post because it's a very good program that allowed me to achieve my goal of injecting modified songs into DS games.

SDATTool is a python3 program written by froggestspirit. It can both unpack and re-pack SDAT files. And because it's a python program, it can run on any platform that can run python!

ndstool

I also did not write or modify this program. ndstool is a program that can dump the files of a DS rom, then rebuild the rom with your modified files. The author is the organization devkitPro; they only provide this program as a bundle with the rest of their great Nintendo DS software development toolchain, but for people like SiIva-style-high-quality-rippers who just want to mess around with music, it's more convenient to just download one of the portable copies that Leseratte provides.

I wrote a guide on how to use all of these tools to modify DS music.

Tags:
Categories: