• Our software update is now concluded. You will need to reset your password to log in. In order to do this, you will have to click "Log in" in the top right corner and then "Forgot your password?".
  • Welcome to PokéCommunity! Register now and join one of the best fan communities on the 'net to talk Pokémon and more! We are not affiliated with The Pokémon Company or Nintendo.

The ELF Method of inserting Music into a Rom - Hands on!

Corvus of the Black Night

Wild Duck Pokémon
3,416
Posts
15
Years
WEEEEEEELLLL...
This is how I import Golden Sun Songs into a Pokemon rom.
Actually, it works for any GBA rom as long as you can find the
music table, but a lot of people have been asking m about it, so I've made a nice tutorial. No pictures this time, unfortunately...

THE ELF METHOD
What you'll need:
The Mid2gba set
Sappy 1.6
A Midi Program (like Anvil Studio)
A Tile Viewer/Hex Editor. Although Tile Viewer is recommended.
Okay,

STEP 1) Extract your song from Golden Sun: The Lost Age from
Sappy.
In order to do this, you'll have to change Sappy's equavalent
of a ini file (sappy.txt). Where it says Golden Sun, you can
replace AGSE with AGFE, then switch the table offset (which is
0x80FC70C, I think for GS; TLA's is at 0x81C4530). Anyways,
after setting those in the sappy.txt file, open up Sappy 1.6
and load in Golden Sun: The Lost Age. Go to the song you want.
Here's a nice table for you with my totally awesome song
names:
Golden Sun Songs
0002 Alfafa
0003 Temple 1
0004 Dalia
0005 Apooji
0006 Normal Gaia Rock Town
0007 Bummed Gaia Rock Town
0008 Sad Song
0009 Another Weird Foreign Song
000a Active Foregn Town
000b Ceremony
000c Lemuria
0041 Entrance to Lemuria
000d Normal Town
000e Happy Litte Island
000f Garoh
0010 That town with the dead dude
0011 Kids song 1
0012 Kids song 2
0014 Airs Rock
0015 Aqua Rock
0018 Gaia Rock
0017 Caves
0019 Statue
001a Jupiter Lighthouse
001b Magma Rock
001c Mars Lighthouse
001d Cold Temple
001e Swamp
001f Sandy Temple
0025 Shaman Village
0026 Sheba's Sad Song
0028 Theme
0029 Sailing
002a Land Travel Before Jupiter Lighthouse
002b Land Travel After Jupiter Lighthouse
002c Golden Sun Rises
003c Ivan Theme
0027 More Evil
0022 Evil Karst and Agaito
0023 Briggs Gets Away!
0024 More Evil Stuff
0035 Even More Evil
003d Can you believe it? More Evil!
003e Prox
003f We're gonna die!
0040 Sad GS Theme 1
0043 Sad GS Theme 2
0044 GS Theme 1
0046 GS Theme 2
0047 Uber Upbeat GS Theme
0048 Sad GS Theme 3
0049 GS Theme 3
004b GS Theme 4 (short)
004a Healing
02bc Vale
02d0 Mt. Aleph
02d2 Sol Sanctum
02e6 Overworld (Broken Seal)
02bd Happy Town (Broken Seal)
02d4 Caves (Broken Seal)
02be Sad Town (Broken Seal)
02bf Teh McCoy's Place
02d1 Kolima Forest
02c0 Tret the Tree
02d7 Mercury Lightouse
02d6 Imil
02c1 Xian
02d5 Desert
02c2 Kalay
02e5 The Ship (Broken Seal)
02c6 Tolbi Song
02c3 Running to the Match
02c4 Colosso Waiting Room
004c Challenge
02d9 Tolbi Cave
02da Hey there, Babi!
02c5 Think you're lucky? (Broken Seal)
0001 Lucky Dice
0037 Bet Lucky Dice!
02d3 Altin Caves
02d8 Dekhan Plateau
02e7 Venus Lighthouse
02ee Battle! (Broken Seal)
02ef Saturos Battle!
02F0 Boss Battle!
0031 Jenna Battle
0032 Felix Battle
0033 Moapa Battle
0034 Posidon Battle
02f1 Fusion Dragon Battle!
02f2 Super Evil Dragon
0036 Doom Dragon Theme
0038 Boat Battle
0039 Karst/Agaito Battle
003a Won!
003b Lost...
(They're in order of GS:TLA songs, then GS songs, then battle
themes. It's a little jumbled, I know...)
Anyways, go to the song number in sappy, then go to the menu
at the top. Under Options, there is a selection called "Loop
Limit". Set this to 1. Then, go to File, then "Export Song to
.mid". MAKE SURE YOUR SONG ISN'T PLAYING OR SAPPY WILL DISPLAY
AN ERROR MESSAGE. Great, now you exported the song into a .mid
file.
This has to be done because GS has a funky music format.

STEP 2) Editing the song
It is necessary to edit the song to put into another game. You
have to do it one track at a time, and the first track has
these little things called "modulations" that are added when
sappy extracts a song. It is necessary to remove all of these
from the song in order for the insturment to make the right
sound.
First, go to Anvil Studio (This is a freeware program you can
download - it's very useful). Open up your midi; the program
will automatically split it into seperate tracks. First, click
on View, the click on "Event Viewer". Make sure you're on the
first track - these modulations only appear on this track.
Remove all the modulations by double clicking the event, then
pressing "Delete Event".
Now, save the file. My generic song file is "Worka.mid.". Now
that you've got a backup, remove all the tracks except for the
first. Save as this file in the Mid2gba/mid folder. It is
imperative that you do this for step 3 to work.

STEP 3) Converting your song into GBA format.
This is very simple. If you have a midi in the mid folder in
the Mid2gba folder, simply click the program "tr". In the
program, click "??" to convert the song. The program makes a
rom file named "Song.gba" with your song data in it.

Step 4) Inserting the song
Open your rom in your Tile Viewer/Hex Viewer (for the sake of
this tutorial, I'm talking in Tile Viewer terms). Find some
free space, then write down the offset. Then, open up
Song.gba. Go to the very end of the rom. The music data is
right there. Make all the tiles appear by clicking on a "next
page" button. Then, click on "move byte back" until the first
tile of your song data begins with the byte BC. MAKE SURE YOU
DON'T ACCIDENTALLY CUT OFF PART OF YOUR SONG. Copy this to the
free space.

Step 5) Inserting the Track
Go to the offset of the song data with the pointers to the
tracks. In Sappy 1.6, this offset is shown next to "Loc".
Simply change the offset to the offset of the song you just
inserted. Last thing - set the first byte in this tile as the
number of tracks in your final song. For example, Kolima
Forest has 6 tracks, so set this number as 6.

NOTE ON REPEATING TRACKS:
To repeat a track, simply replace the end byte B1 as B2, place
the offset to the beginning of the song after that, then set
the bytes after your offest as B1.
For example:
B212 3456
80B1 0000
Tells the song to repeat at the offset 0x654321.
Voila. The ELF method. Enjoy.

And thus how I got 65+ songs in Jupi becomes emminent.

EDIT: Thanks to Neonemesis for pointing this out to me.

If a song appears on the righthand side of Tr.exe (ELF), then that means your song has errors in it. Here's how to fix that:

Go into Anvil Studio, click on "File", then click on "Repair Song". Then, when it prompts you to remove all notes that never end and to remove all notes with a duration of 0, click yes. DO NOT CLICK YES IF IT PROMPTS YOU TO REMOVE NOTES LONGER THAN 1 MEASURE.

Anvil Studio will then remove all of the problematic errors. After doing that, try reinserting the song into the rom.
 
Last edited by a moderator:

Gamer2020

Accept no Imitations!
1,062
Posts
15
Years
This looks great but i will use this when it gets screens since i need to visualize things lol.
Can midis be inserted without getting them from another game?
 

Corvus of the Black Night

Wild Duck Pokémon
3,416
Posts
15
Years
Yep. One thing you have to keep in mind is that the tracks line up so they repeat properly (like having them all 1 minute long at the same speed).

Sorry that I don't have any screens. It's a pain in the butt. But it's pretty self explainatory for the most part. I was thinking about whether or not if I should have screens, but I decided not to because the first steps are really something that are quite obvious, and the last is really using a tile viewer/hex editor. The last is really if you understand how they work, you understand how they work.
 

AmineX

Music Expert
152
Posts
16
Years
Voila une methode bien compliqué pour inserer une musique !!
pour ne pas utiliser Sappy?
 
224
Posts
16
Years
  • Seen Mar 8, 2016
Nevermind, I get it now.

However I have a problem...
When I make my song.gba after deleting all tracks but one and deleting all the modulations, the song.gba has no song in it. I tried using another mid for another song.gba and opened both of them in my hex editor and they had the same exact data. It's all 0s at the end. Any help?
 
Last edited:

Larsie13

Guest
0
Posts
Well, I've tried it, but it doesn't work for me. So, I've found out an easier way (at least I think it's easier).

I just change the MIDI to .gba with the tr.exe, then save each track as a different file with a HEX Editor, and import them using Sappy. Personally, I think it would save you some time.
 

Corvus of the Black Night

Wild Duck Pokémon
3,416
Posts
15
Years
Nevermind, I get it now.

However I have a problem...
When I make my song.gba after deleting all tracks but one and deleting all the modulations, the song.gba has no song in it. I tried using another mid for another song.gba and opened both of them in my hex editor and they had the same exact data. It's all 0s at the end. Any help?
I believe you are not saving them in the mid2gba/mid folder. If it's not that, you aren't using the program "tr".

Thanks for the help, Larsie, but I've already inserted all 68 songs into my rom hack >_<
 
11
Posts
15
Years
  • Seen Feb 3, 2013
Step 4) Inserting the song
Open your rom in your Tile Viewer/Hex Viewer (for the sake of
this tutorial, I'm talking in Tile Viewer terms). Find some
free space, then write down the offset. Then, open up
Song.gba. Go to the very end of the rom. The music data is
right there. Make all the tiles appear by clicking on a "next
page" button. Then, click on "move byte back" until the first
tile of your song data begins with the byte BC. MAKE SURE YOU
DON'T ACCIDENTALLY CUT OFF PART OF YOUR SONG. Copy this to the
free space.
How do I do this step if I'm not taking it from another rom? How do I find the offset?
And also because I'm a newbie, I have no idea how to use the hex editor/tile viewer.
 

Corvus of the Black Night

Wild Duck Pokémon
3,416
Posts
15
Years
When you use the Program "tr", the song file in the mid2gba/mid folder is converted into the rom file song.gba. So, you're transfering from a rom you already inserted the song into.

If you don't know how to use a tile viewer, I recommend using Sappy 2006. I can't use it, so I taught myself this method. If you can't use Sappy 2006, I'm sorry, you're going to learn how to use a Tile Viewer - it's something you pick up over time.

This method is good for experienced hackers, so they can edit parts of the songs to fix repeats and stuff.
 
224
Posts
16
Years
  • Seen Mar 8, 2016
Nope, I'm using TR and I put it in the Mid2agb/mid folder. When I click the ?? I see the name of my mid pop up in the right hand box. After that I open it up in a hex editor and go to the bottom and it's mostly all zeros. I did the same with another mid and they had the same exact info in them. It's as if it's generating the same gba file over and over.

I keep on getting the same "song.gba" it even has the same size.. 1743 kb.

EDIT: It worked with a song I exported from Sappy 2006... it must be something wrong with the midi. I saved my seong as worka.mid after deleting all modulations and other tracks.. What's up?
EDIT 2: I did a bunch of experimenting... I took a song from Sappy 2006. I put it in the mid folder and converted it to gba. It worked. Next, I took that same song and opened it in anvil studio. I didn't do anything, I just pressed file - save. After that I took that song and put it in the mid folder. It didn't convert to GBA after that.
For some reason, anvil studio is screwing up my mid files and won't let them convert to gba.
 
Last edited:
11
Posts
15
Years
  • Seen Feb 3, 2013
When you use the Program "tr", the song file in the mid2gba/mid folder is converted into the rom file song.gba. So, you're transfering from a rom you already inserted the song into.

If you don't know how to use a tile viewer, I recommend using Sappy 2006. I can't use it, so I taught myself this method. If you can't use Sappy 2006, I'm sorry, you're going to learn how to use a Tile Viewer - it's something you pick up over time.
But I used tr to convert a midi/s file I got online, so it's not from a rom I already inserted a song into...

Sappy doesn't work right for some reason, I think it's because I use vista.
 

Banjora Marxvile

hOI!!!!!! i'm tEMMIE!!
3,496
Posts
15
Years
  • Age 30
  • Seen Apr 10, 2024
But I used tr to convert a midi/s file I got online, so it's not from a rom I already inserted a song into...

Sappy doesn't work right for some reason, I think it's because I use vista.

Yeah. It is, and you need the right files. I can't use Sappy on my laptop either, but I have a main computer.

Anyway, nice tutorial, but the Sappy you use only has Sapphire. Can you find a way for the newer Sappy to insert easier?
 
224
Posts
16
Years
  • Seen Mar 8, 2016
I finally got the midi to convert to a gba file... I downloaded another midi editor and it finally worked. I didn't even have to delete all the other tracks, I kept them all and converted to GBA and it worked. Anyway how exactly do you change the offset next to "loc"?
 

Corvus of the Black Night

Wild Duck Pokémon
3,416
Posts
15
Years
Marxvile - You can add AXVE to Sappy 1.6's list by changing it's ini-like text file. There's a folder called "data". In this folder should be a file called "sappy". Copy this into the file (make sure it's in a seperate line):
AXVE, Pokémon Ruby (U), sapphire, sapphire, sapp, &H45548C, &H15E, &H1D2

And you will be able to play the rom AXVE in it.

Neonemesis - Go to the offset shown next to Def. Then repoint the offset for Loc wherever you want.
 
224
Posts
16
Years
  • Seen Mar 8, 2016
Marxvile - You can add AXVE to Sappy 1.6's list by changing it's ini-like text file. There's a folder called "data". In this folder should be a file called "sappy". Copy this into the file (make sure it's in a seperate line):
AXVE, Pokémon Ruby (U), sapphire, sapphire, sapp, &H45548C, &H15E, &H1D2

And you will be able to play the rom AXVE in it.

Neonemesis - Go to the offset shown next to Def. Then repoint the offset for Loc wherever you want.

Ok by that do you mean go to the offset shown next to Def, and in that place where Def is there is a pointer to where the old music was? So like if the music I'm going to replace is at 0x4A22AC (made up number) then I would search for the pointer to that (which is AC224A08) in the offset where Def is located and replace it with the new offset?

Oh and btw, in case you wanted to know there's a way to add extra songs to your game instead of replacing the old ones. Go here for more info (NOTE it's for FireRed but will work for Ruby I've tried it before: http://www.pokecommunity.com/showthread.php?t=157877
 

Corvus of the Black Night

Wild Duck Pokémon
3,416
Posts
15
Years
Er... I don't know what the second pointer's all about, but basically where it says Def is where the pointer to Loc is. For example, if it says 0x8123456, then it tells Sappy (and the game) that the music data is at 0x8123456. So, if you changed it to 0x8654321, it would tell Sappy to go to 0x8654321. If that's what you mean, then you're right.

BTW, it points to the song info, NOT the track info. So your first few bytes to where you're repointing it to should be
0X00 00B2

where X is the number of tracks in your song. Also, the row underneath that one is the pointer to the insturment data, which means if you wanted to use Slateport's insturments in the battle theme, you could just do a little repointing to do that. Of course, you'll need to change the insturments as well...

What's weird is that in Golden Sun, all of the tracks use all the same instruments, which gives you a lot more choices in instruments. It also saves ample space. I wonder why Pokémon did it the way they did, wasting a ton of space from like 0x8420000 to about 0x8450000 all on insturment data...

Actually, I know how to find any pointer I want, so I could just repoint all the songs. That's how I changed the animation data and made the titlescreen image fit ^_^

Anyways, the Golden Sun songs absolutely own the Pokemon ones IMHO.

Whoops, just noticed this:
Nope, I'm using TR and I put it in the Mid2agb/mid folder. When I click the ?? I see the name of my mid pop up in the right hand box. After that I open it up in a hex editor and go to the bottom and it's mostly all zeros. I did the same with another mid and they had the same exact info in them. It's as if it's generating the same gba file over and over.
Whoops. I forgot to state that if the song title appears on the righthand side, it means the song didn't go through.

Sounds like your song has errors in it. That's easy to fix. Go into Anvil Studio, click on "File", then click on "Repair Song". Then, when it prompts you to remove all notes that never end and to remove all notes with a duration of 0, click yes. DO NOT CLICK YES IF IT PROMPTS YOU TO REMOVE NOTES LONGER THAN 1 MEASURE.

Anvil Studio will then remove all of the problematic errors. After doing that, try reinserting the song into the rom.

Sorry it took me so long to answer that - I didn't even notice your post T_T
 
Last edited:

RedYoshi

Wah! Yoshi!
215
Posts
16
Years
Nice tutorial. Everything goes along well up until I open up "Song.gba" with sappy. It keeps giving me the message "invalid gamecode - it's all zeroes!". Is there anything I can do about that?
 
Back
Top