Making GBA Music with MIDI
BotB Academy Bug Reports and Feature Requests
 
 
200324
Level 23 Chipist
icrawfish
 
 
 
post #200324 :: 2024.11.04 11:15am
  
  mirageofher, Flaminglog, dotmid, petet, Luigi64, arceus413, WobbleBlast, Opilion and RevvoBolt liēkd this
TL;DR - YOU CAN MAKE GBA MUSIC WITH MIDI BUT IT’S WEIRD AND TIED INTO A SPECIFIC GAME SO IT MIGHT BE HARD TO ALLOW ON BOTB

I want to call to attention 2 things I noticed with the beloved new GBA format. For one, all the tools listed on the lyceum page were trackers or sequencers (that’s fine in and of itself, you get what you get with these things sometimes). But the second thing stands in contrast to that; from what I know, the Fire Emblem hacking community primarily uses MIDI to create GBA songs. They have a tutorial listed here: FE GBA Music for Beginners


My main question is this: is there a way we could open this up as a means of submitting GBA music, to facilitate people who prefer MIDI over trackers?

The reason I ask is because of the issues that are involved. Based on this guide, it seems like the only unique filetypes generated for GBA insertion are .s files, which aren’t mentioned in the submittable formats, and it sounds like to playback the audio you would need to use either a tool specifically for FE hacking, or insert the song into the game, the latter of which feels pretty out of the scope of BotB. I also don’t know if it’s just as simple as converting the .s file straight into a .gba file somehow, or if there’s a nicer solution that avoids this mess.

Point is, I think it would be great to allow this MIDI method of GBA music creation that a lot of people use, but I don’t know how one would make it work with BotB’s rules on playback for submissions and what can be converted to what. I would like to hear others’ input if they know some stuff I don’t, since I’m at a loss here.
 
 
200328
Level 29 Chipist
gotoandplay
 
 
 
post #200328 :: 2024.11.04 12:22pm
  
  mirageofher, blockblockblock, Chepaki, damifortune and Opilion liēkd this
Allowing .s would be generally favourable to having a FE gba file with the music injected, just because of the copyright issues
 
 
200330
Level 24 Chipist
Opilion
 
 
 
post #200330 :: 2024.11.04 12:33pm
  
  mirageofher, trough, Chepaki and WobbleBlast liēkd this
  
  ReiXbits hæitd this
Well here is probably the biggest issue when making music with the GBA. From what I see in the tutorial, Fire Emblem was developed using the m4a sound engine (aka Sappy). It was probably the most used sound engine to make commercial GBA games and it works with midi files indeed! The problem is that like most of the sound engines used for commercial games, m4a is not publicly available... That's why your only choice if you want to work with midi is probably to rely on hacking tools.

I'm a complete noob regarding ROM hacking but it seems to be a way to play music on the GBA indeed. If someone is effectively able to make a GBA song this way, I agree it would be good to update the gba (format) page, providing detailed instructions explaining how to produce a .s file (if that's the format you want to use) from your midi song.

I never tried it but I think I saw a bunch of similar tutorial to hack Pokémon ROMs (the GBA Pokémon games also used the m4a sound engine), maybe this could help too! In addition, this page
is good if you want to learn more about the different GBA sound engines that were used in commercial games.

Also just a newbie question, I understand ROM hacking lets you use custom music in your modified version of the game. However, is it also possible to play a song right when the game starts or are you obligated to replace a certain song in the game and play a part of the game when the original song is played in order to hear your composition?
 
 
200332
Level 23 Chipist
WobbleBlast
 
 
 
post #200332 :: 2024.11.04 12:38pm
  
  Luigi64 and Opilion liēkd this
Oh cool, I couldn't find much on this!

I wanted to gather more info, but I'm going to share here since it is related. The .s files you mention can be used to inject the song into any game rom that uses the Sappy engine (from the Nintendo SDK). So it's not just limited to Fire Emblem, but many other titles.

Through some other tools, the music can be extracted and converted to .gba. On paper all you need for making GBA music with midi is:

- A midi editor: to write your track.
- A soundfont player: to send midi to while writing.
- gba-mus-riper: to extract your soundbank into a soundfont.
- Mid2Agb: to convert your track to an injectable format.
- Sappy 2006 mod 15: to inject your track inside an existing rom. https://www.youtube.com/watch?v=NfitdOWcEV8
- saptapper: to extract your track into independent .gsf and .gsflib files.
- gsf2rom: to make your track playable on hardware. https://hydrogenaud.io/index.php?PHPSESSID=oal12bqgl0c0815ttu4ljotc7o&topic=99038.msg957919#msg957919

The Sappy tool in question supports custom samples, GB instruments and ch3 waveforms (no macros or tables unfortunately).

I did a little test, and I managed to confirm this works, but I'm not sure I will able to write an article for the lyceum before oops ends.
 
 
200334
Level 23 Chipist
icrawfish
 
 
 
post #200334 :: 2024.11.04 1:13pm
  
  WobbleBlast liēkd this
So what I’m hearing is that .s can be converted to a .gba for listening purposes? That might make it a ton more viable to add it as a submission type, or even if it doesn’t get added, be able to use MIDI to get to .gba, which is submittable.
 
 
200344
Level 31 Chipist
damifortune
 
 
 
post #200344 :: 2024.11.04 4:15pm
  
  RevvoBolt, icrawfish, WobbleBlast, Chepaki and Opilion liēkd this
sounds like a viable path to victory as long as there's no copyrighted content from the game ROM portion of this process involved in the eventual .gba file that gets submitted as the entry. which i would want to be really sure of, considering how litigious they are.

thanks for all this really cool research into the format. it's neat to see all these things being uncovered, especially since gba music is very underexplored. it's convoluted, but as long as there's some instructions it seems very doable!
 
 
200348
Level 23 Chipist
WobbleBlast
 
 
 
post #200348 :: 2024.11.04 6:04pm :: edit 2024.11.04 6:04pm
  
  icrawfish, arceus413 and Opilion liēkd this
Although I'm not really qualified to speak about the legality of it, technically I believe the .gsf files themselves are an equivalent of .vgm for GBA. So those should be fine.

Someone better informed should look into the source of psflib
and gsf2rom
to be safe.

If it turns out there is an issue, maybe .gsf could be added as an accepted file format. Actually probably .zip instead, since .gsf and .gsflib files need to be together for the conversion to work.
 
 
200361
Level 21 Mixist
Luigi64
 
 
 
post #200361 :: 2024.11.05 8:53am
  
  Opilion, WobbleBlast and icrawfish liēkd this
since gsf is like vgm (I think?) the playback routine for a gsf-converted-to-a-rom is completely different from the actual sound engine you started with, so I think submitting a rom is preferable

if the sound engine being proprietary is a problem, I believe the gba bios does include the sound engine in its entirety, and there’s also https://github.com/ipatix/agbplay and good ol sappy
 
 
200367
Level 23 Chipist
icrawfish
 
 
 
post #200367 :: 2024.11.05 12:49pm
  
  WobbleBlast liēkd this
Trying to parse what WobbleBlast has mentioned; in total, it could be done as:
song ->MIDI (via anvil studio/other DAW perhaps)
MIDI -> .s (via midi2agb, the open source version of mid2agb)
.s -> an actual game? (via sappy 2006 mod 15)
actual game -> .gsf and .gsflib (via saptapper)
.gsf and .gsflib -> .gba (via gsf2rom)

Does that sound right? And could any of those steps be cut out to generate a listenable file that isn't a rom, or get to a non-proprietary rom faster?

My other question is, would the agbplay link Luigi64 posted be able to play files outputted from midi2agb? If so that would be a huge timesave and make midi2agb-exported files a viable file format for submission, I think.
 
 
200368
Level 23 Chipist
WobbleBlast
 
 
 
post #200368 :: 2024.11.05 1:41pm
  
  icrawfish liēkd this
@icrawfish the Sappy 2006 tool can play music and I think its rather accurate.

The issue with .s files is that they don't include soundbanks, so they will only work if you know which rom to use and which track to replace. So, I don't think they would make for good submission files.

You're making me realise this process really wouldn't be ideal for OHBs, but I guess it's doable lol.
 
 
200369
Level 23 Chipist
icrawfish
 
 
 
post #200369 :: 2024.11.05 2:33pm
Would there be a way to include soundbank information with a file exported from midi2agb? Or could one provide a .s with an .sf2 and get away with it that way? That could make .zip’ing the 2 files viable. (qgain, apologies for asking out of ignorance rather than testing these ideas out myself).
 
 
200371
Level 23 Chipist
WobbleBlast
 
 
 
post #200371 :: 2024.11.05 4:49pm
@icrawfish no worries, these are great questions!

I don't know of anyway to do that. As far as I know, midi2agb only takes in midi and doesn't care about soundbanks, only program changes.

midi2agb was probably meant to be used along side the official SDK. So it looks like all paths forward lead to Sappy related romhacking tools.

I wanted to look into the SDK itself, but I expect it won't be usable without official developer hardware.
 
 
200509
Level 21 Mixist
Luigi64
 
 
 
post #200509 :: 2024.11.08 9:17pm
  
  icrawfish and Chepaki liēkd this
I need to do more research, but it seems like gsf is less like vgm and more like spc or nsf (includes actual driver code instead of a stream of register writes) and you should be able to make a standalone .gsf that includes a soundbank and doesn't depend on any external .gsflib? if this is true then it seems like the perfect submission format

https://gist.github.com/SaxxonPike/11618bd321a45a70c01febae43ff564e
http://fileformats.archiveteam.org/wiki/Portable_Sound_Format
 
 
216832
Level 23 Mixist
02FD
 
 
 
post #216832 :: 2025.05.09 7:41am
idk if this is even worth putting here, but in doing research into the GBA, I found that the GBA BIOS does actually contains that early version of the m4a/mp2k mixer briefly mentioned earlier. It's not the greatest solution, but you can pass MidiKey2Freq commands to the engine after initializing it, which might be all that the midi2agb writes in terms of code. It definitely wouldn't be practical for a game due to the assumed increased CPU usage of this older version. Food for thought, I suppose:
https://problemkaputt.de/gbatek.htm#biossoundfunctions
 
 
238812
Level 0 n00b
maddievision
 
 
sorry to bump this thread, i came across it while doing some research on GBA/MIDI workflows. (fun fact, i made the original Sappy midi player/extractor some 20 years ago).

hope this is ok to post about this here! but i'm currently working on a new open source driver that has similar to mp2k functionality. it uses an open source hq implementation of an mp2k compatible mixer. the driver also combines GBC channel, just like the original mp2k. right now it uses straight MIDI files and a soundbank system that's similar to the one used in mp2k

it's still heavily work and process and i'm in the process of building tooling to streamline MIDI -> GBA/GSF and soundbank creation, but wanted to post about it here to see if people might still be interested in having an easier MIDI workflow, that doesn't rely on a proprietary driver. once i get tooling in order it would be cool to get some ppl to test it out :)

there are some demos in the repo readme! https://codeberg.org/roses/sappy4all
 
 
238822
Level 21 Mixist
Luigi64
 
 
 
post #238822 :: 2026.05.12 10:45am
i was happy to see that license issue closed a few days i really appreciate what you're doing
 
 
238850
Level 30 XHBist
Tex
 
 
 
post #238850 :: 2026.05.12 1:26pm
  
  goluigi liēkd this
Thanks, Shantae Advance composer!!!
 
 
238905
Level 22 Mixist
Chepaki
 
 
 
post #238905 :: 2026.05.13 3:56am
  
  goluigi and The Goofy-Mouse liēkd this
"hope this is ok to post about this here!"

no!!! people of botb absolutely HATE when there are new and free and opensource tools for making chiptune!! fuck music!!!!


( jokes aside, thank you very much, I will definitely give this a try )
 
 
241849
Level 24 Chipist
Opilion
 
 
 
post #241849 :: 2026.07.09 8:12pm
  
  WobbleBlast liēkd this
Wow so I tried out Sappy by following the steps of WobbleBlast's post, I think I found a simpler setup for BotB!

1 - Download Sappy from the devs' GitHub repo

You can download the whole project, to start sappy run the file called sappy.exe (which is in the source folder).

I used it on Linux with Wine, I had to deal with a few crashes but it's overall really usable. If Wine complains about a missing MSVBVM60.DLL file, you can fix it by using winetricks to install the required Visual Basic libraries:
winetricks vb6run
(more details here
)

2 - Try out KAWAJUKE 2K6
In the source folder, you will find a GBA ROM called kawajuke.gba, open it with an emulator of your choice (I used mGBA
).

This ROM is a simple jukebox. It contains a selection of songs, use the D-pad to select a song and start playing it by pressing A.

3 - Hack KAWAJUKE 2K6 with Sappy
Open kawajuke.gba from Sappy, you can play all the songs here. Choose a song (for instance the song number 1) and replace it by a song of your choice, as explained in this video
from WobbleBlast's post.

For this you will need to download and set up Mid2Agb. You can get it from here
, the program itself is located in the folder called Mid2Agb. It can be used as shown in the video, but before that you need to replace the file called MidPlayDef.s in Sappy's source folder by the one located in the Mid2Agb folder you just downloaded.

Note: for a first try, there is some .s files like Futaba_Town.s in the Mid2Agb folder that you can directly import in Sappy

Also, when importing a song Sappy will ask for a base destination offset. It worked for me by replacing the Song 1 with a value equal to the one of the Song header shown on the player (0x0608D8).

4 - Check things out, submit your song
Open kawajuke.gba again in your emulator, the song you chose to replace in Sappy should now be replaced here too!

Then you can upload kawajuke.gba as a gba entry........ except it's probably wiser to use Sappy before to replace all the other songs by dummy songs, especially since some of them are covers of copyrighted musics. If I manage to do it, I'll probably share the ROM on this thread so that everyone won't have to do all this clean-up!
 
 
241851
Level 24 Chipist
Opilion
 
 
 
post #241851 :: 2026.07.09 10:07pm
Actually after some research it seems you can't modify the soundfont of a ROM from Sappy, so at least the original method from WobbleBlast's thread will let you choose any soundfont from games made with the m2k engine (as long as you have a ROM of the game).

I didn't find any tool to modify the soundfont of a GBA game so I'll probably give up with Sappy for now and try Kitty Advance
instead (this is the new name of the tool maddievision is working on) or go back to DOS modules converters
 
 

LOGIN or REGISTER to add your own comments!