Making GBA Music with MIDI
BotB Academy Bug Reports and Feature Requests
 
 
200324
Level 14 Chipist
icrawfish
 
 
post #200324 :: 2024.11.04 11:15am
  
  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 28 Chipist
gotoandplay
 
 
 
post #200328 :: 2024.11.04 12:22pm
  
  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 21 Chipist
Opilion
 
 
 
post #200330 :: 2024.11.04 12:33pm
  
  ReiXbits hæitd this
  
  Chepaki and WobbleBlast liēkd 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 22 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 14 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
  
  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 22 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 20 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 14 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 22 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 14 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 22 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 20 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
 
 

LOGIN or REGISTER to add your own comments!