Project notes: getting playable audio files out of a .gba rom
I want to have, say, a ring tone from megaman battle network 3 blue, somehow. I don’t know what i want exactly, but something from that game. I own the game 8 times over, surely there's a way to do this.
Outline
- How do I get the files from the .gba file itself?
- This is apparently annoying and lossy, but
vgmtrans
~works. - I was suggested several other options but they require manually editing makefiles and compiling c++, gross, lets skip those.
- This is apparently annoying and lossy, but
VGMtrans
is pretty self explantory, poke around the UI to find the files you want. You’ll have to play every sound collection in there to know what they are though.- Export all your files in various formats to your file system, again, just in the UI.
- Next, a digression into how the resultant audio files work:
.MID
files are midi files, which contain music sequences but no sound.DLS
is a “downloadable sounds” file, which contains sound samples that can be used by MIDISF2
is a soundfount file, basically an alternative to DLS.- Probably you only need either DLS or SF2 at a single time, just depends on what’s supported by the DAW you’ll be working with in next step
- Now you have all the bare files exported, but you need to recombine them into a file that your phone can understand.
LMMS
is free / open source. There’s better options, but not without a price tag.LMMS
works, I did an original POC with it, but its not easily automatable. But! There is something that IS automatiable on the commandline calledfluidsynth
that gets us alllllmost all the way there - it can give us.wav
files.- Once you have a
.wav
its easy to use ffmpeg to get.mp3
Conversion script
I llm’d a script to do this for me en masse:
import os import subprocess import pdb # Directory where your files are located root = "/Users/josiah/mmbn3/" export_dir = root + "exports" directory = root + "raws" # Go through each MIDI file and find its matching SF2 file for file in os.listdir(directory): if file.endswith(".mid"): midi_file = os.path.join(directory, file) sf2_file = os.path.join(directory, file.replace(".mid", ".sf2")) if os.path.exists(sf2_file): # Output WAV file name output_wav = os.path.join(export_dir, file.replace(".mid", ".wav")) output_mp3 = os.path.join(export_dir, file.replace(".mid", ".mp3")) # Run Fluidsynth to combine the files and export to WAV subprocess.run([ "fluidsynth", "-ni", sf2_file, midi_file, "-F", output_wav ]) subprocess.run([ "ffmpeg", "-i", output_wav, output_mp3 ]) # Delete the WAV file after MP3 is successfully created if os.path.exists(output_mp3): os.remove(output_wav) print(f"Deleted intermediate file: {output_wav}") print(f"Processed {file} -> {output_mp3}")
iphone idiocy
You’d think you’d be done, simply import them to your phone and bam you got ring tones!
Wrong.
On iPhone, for historic “we sell ringtones” reasons, its still very annoying to get a sound file to be recognized by the system as appropriate for ring tone useage.
- Put your files on icloud drive somewhere
- Open garageband on your phone
- Create a new project with the
audio recorder
option - Import your audio file
- Tap the
loop
icon in the top right - Go to the weird loop thing on the top right
browse items from the files app
- Tap the
- Trim audio as needed
- Tap the
down arrow
in the top left, select “my songs” and then select from storage, import the specific file.- Tap on the song song you’ve just created
- The select share
- Choose ringtone.
- Now assign as default ringtone in settings, or per contact
Problems with this approach
This has worked mostly well! But there's a few things that are sub-optimal that i haven't figured out:
- There's definitely some sound effects I can't find. Probably that's weirdness in the import process to vgmtrans, but no idea what i can do about it
- Despite exporting the sf2 files, the sounds are just a bit off when it comes to the soundtrack - the midi file / sequence definitely works, but the instruments must be subtly different.
- I'm tempted to try remixing all the files with DLS instead of sf2 and see if it changes the output, but i'm out of time today :|
- I haven't figured out a bulletproof way to have notifications on iPhone setup the way i want
- Apple watches mess with your notification scheme, both individually per app and globally with the
silent
option.
- Apple watches mess with your notification scheme, both individually per app and globally with the