PDA

View Full Version : [Tutorial] The ELF Method of inserting Music into a Rom - Hands on!


daigonite
February 9th, 2009, 07:05 PM
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.

Gamer2020
February 9th, 2009, 08:40 PM
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?

daigonite
February 10th, 2009, 03:14 AM
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.

darkmewham2
February 10th, 2009, 12:45 PM
This is great! It helps me a lot because I am putting Pokemon XD music into my hack and it sounds so crackly! @.@ I hope Anvil Studio fixes it...

AmineX
February 10th, 2009, 03:45 PM
Voila une methode bien compliqué pour inserer une musique !!
pour ne pas utiliser Sappy?

Liquid Shadow
February 10th, 2009, 05:42 PM
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?

Larsie13
February 11th, 2009, 01:08 AM
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.

daigonite
February 13th, 2009, 05:42 PM
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 >_<

RoyMaster4
February 13th, 2009, 06:18 PM
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.

daigonite
February 13th, 2009, 06:47 PM
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.

Liquid Shadow
February 13th, 2009, 08:36 PM
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.

RoyMaster4
February 14th, 2009, 09:28 AM
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
February 14th, 2009, 09:30 AM
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?

Liquid Shadow
February 14th, 2009, 03:19 PM
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"?

daigonite
February 14th, 2009, 03:37 PM
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.

Liquid Shadow
February 14th, 2009, 04:37 PM
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

daigonite
February 14th, 2009, 04:53 PM
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

Red Apple™
February 26th, 2009, 10:23 AM
can u give me a link for anvil studios? plz plz plz!!!!!!

AmineX
February 26th, 2009, 01:49 PM
anvil studio here: www.AnvilStudio.com (http://www.pokecommunity.com/www.AnvilStudio.com)

RedYoshi
March 6th, 2009, 10:54 PM
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?

TSK
March 12th, 2009, 10:09 AM
I have edited the .html for the latest Sappy Version(I believe). It now supports Golden Sun 2 and has some songs(a few) in the selection list. I'll upload it if anyone is interested.

Liquid Shadow
March 12th, 2009, 01:32 PM
I have edited the .html for the latest Sappy Version(I believe). It now supports Golden Sun 2 and has some songs(a few) in the selection list. I'll upload it if anyone is interested.

Yes I'm interested. Can you upload it? Also do you mind adding Golden Sun 1 to it also? Or I can try that myself.

daigonite
March 12th, 2009, 02:11 PM
Red Yoshi, try repairing your song.

I have edited the .html for the latest Sappy Version(I believe). It now supports Golden Sun 2 and has some songs(a few) in the selection list. I'll upload it if anyone is interested.
Yes I'm interested. Can you upload it? Also do you mind adding Golden Sun 1 to it also? Or I can try that myself.

Golden Sun 1 I'm still working on. I have TLA's list, though. Here:
Golden Sun Songs
0002 Alhafra
0003 Temple 1
0004 Dalia
0005 Apooji
0006 Normal Gaia Rock Town
0007 Bummed Gaia Rock Town
0008 Sad Song
0009 Temple
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 Great Kimombo 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's Getaway
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 (password transfer)
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...
END
ENDFILE

Note: This list does not include fanfares/sound effects.

Copy and paste that into Notepad and save it as GSTLA.lst or something. Then, open up Sappy .lst and add this line somewhere:
AGFE, Golden Sun: The Lost Age (U), sapphire, GSTLA, blank, &H1C4530, 0, 0

MAKE SURE YOU'RE SAVING IN SAPPY'S DATA FOLDER.

It should work the next time you load sappy.

This works for those using Sappy 1.6, so if you need the latest version, wait for TSK for the list.

By the way, when I say (Broken Seal), that's refering to the song from the first game, because, for example, both games have Sailing songs but they are both very different.

Now don't you all start making Pokemon Mars/Venus/Mercury versions now in imitation of Jupiter...

TSK
March 13th, 2009, 09:46 AM
I'll add Jupiter's GS2(OP) list to the xml(will take some time).

Edit: That actually didn't take very long. =]

Edit: Download link Sappy2006.xml (http://www.sendspace.com/file/f6m99m)
Enjoy =D

Note about the Midi's you get from Sappy. Some tracks sound an octave to low( because the modulations are gone?). What I do is put all notes an octave higher manually. Did anyone else notice this?

daigonite
March 13th, 2009, 11:25 AM
Actually, the reason why the tracks octaves are low (or high for the bass notes) is because, unlike Pokemon, all of the instruments are set at the same frequency. Unless you import every single last instrument wav, you'll have to edit them manually. And I'm keeping how to do this a secret until a later release of Jupiter *wink*

I've hacked TLA's songs before, it's kind of hard to get the instruments to sound correct.

Oh yes, I just remembered that "That town with the dead dude" is really called "Yallam". Damn me being so inconsiderate of the fictional deceased.

Liquid Shadow
March 13th, 2009, 01:37 PM
Actually, the reason why the tracks octaves are low (or high for the bass notes) is because, unlike Pokemon, all of the instruments are set at the same frequency. Unless you import every single last instrument wav, you'll have to edit them manually. And I'm keeping how to do this a secret until a later release of Jupiter *wink*

I've hacked TLA's songs before, it's kind of hard to get the instruments to sound correct.

Oh yes, I just remembered that "That town with the dead dude" is really called "Yallam". Damn me being so inconsiderate of the fictional deceased.

Mmk. Sorry to sound stupid here but.. what's an octave lol? Also when you are done with the Golden Sun 1 VM me or post it here. Thanks in advance.

Oh, and TSK. Thanks a lot. Now I don't have to go through the hassle of looping the songs, I can just export tracks using modern sappy =).

EDIT: I see what you guys mean by octaves... xD. So I guess I CAN'T import the tracks and make them sound right without editing the instruments (which I don't want to do since I'm importing a variety of music, not just Golden Sun). I guess I'll do it the old way and loop em myself. It sounds better that way, because the volume isn't all messed up and the instruments aren't all messed up. Thanks anyway, I might still use it for some songs that don't sound messed up as much though.

daigonite
July 7th, 2009, 05:50 AM
Some new stuff about GBA music hacking!

A list of commands/arguments from Atrius:
The audio track data is a list of commands and arguments for playing music/sound effects.

Anything below 0x80 is an argument, and anything 0x80 and above is a command.

0x80 - 0xB0 = Rest commands of varying lengths, to wait a certain amount of time before playing each note.

0xB1 = Stop command, to signal the end of the audio track. From what I've noticed even if a song loops it has one of these after the loop command.

0xB2 = Jump command, to jump the playback pointer to another location in memory. Often used to loop songs by jumping back to the beginning of it.

0xB3 = Jump command where playback can jump back to after it again later. Used when you want to repeat part of a song before continuing with the rest of it.

0xB4 = Return to last 0xB3 command.

0xB5-0xBA = Unidentified

0xBB = Set Tempo

0xBC = Set Pitch offset

0xBD = Set instrument

0xBE = Set Volume

0xBF = Set Panning

0xC0 - 0xCE = Unidentified

0xCF - 0xFF = Play notes of varying lengths.


So to break apart the track information I gave you:

BE FF BC 00 BB 01 BD 00-CF 3C 7F B0 B1

BE FF = A volume command with an argument of 0xFF (Volume is an odd exception to the rule that arguments must be less than 0x80)

BC 00 = Set the pitch offset to zero

BB 01 = Very low tempo so that the note is drawn out long enough for voice samples to play their full length.

BD 00 = Set the instrument to the first entry in the instrument map.

CF 3C 7F = Play a note with a pitch of 0x3C (Right in the middle of the available range), and a volume of 0x7F (The maximum available)

B0 = Wait long enough for the note to finish playing

B1 = End the audio track

And some arguments for those commands:
Pitch

Pitch is very easy to understand. As Atrius noted, it is follows the byte 0xBC (which is usually the first byte in a given track anyhow). Pitch works like this:

0x00 is the base, equivalent to Middle C.

0x0C is one octave higher; High C.

0xF4 is one octave lower; Low C.

If you haven't noticed, it goes by increments of 0x0C, so for higher increments, they would be 0x18, 0x24, ect, while for lower increments they would be 0xE8, 0xDC, ect.

Tracks can be transposed by any value, however, so if you wanted it to be in a different key, you could change these values. If done, make sure to add/subtract 0x0C when raising/lowering octaves.

Tempo
Tempo is simply the tempo transfered into Hex. So, if your original tempo was 80, you would put in 0x50. It follows a 0xBB byte.

Instruments
The instruments correspond with the instruments of the voicegroup. Although the instruments can be anything you want, the typical way is to have the instruments correspond directly. It follows a 0xBD The direct map:

PIANO
0x00 Acoustic Grand (often used as a drum kit)
0x01 Bright Acoustic
0x02 Electric Grand
0x03 Honky-Tonk
0x04 Electric Piano 1
0x05 Electric Piano 2
0x06 Harpsichord
0x07 Clav

CHROMATIC PERCUSSION
0x08 Celesta
0x09 Glockenspiel
0x0A Music Box
0x0B Vibraphone
0x0C Marimba
0x0D Xylophone
0x0E Tubular Bells
0x0F Dulcimer

ORGAN
0x10 Drawbar Organ
0x11 Percussive Organ
0x12 Rock Organ
0x13 Church Organ
0x14 Reed Organ
0x15 Accoridan
0x16 Harmonica
0x17 Tango Accordian

GUITAR
0x18 Acoustic Guitar(nylon)
0x19 Acoustic Guitar(steel)
0x1A Electric Guitar(jazz)
0x1B Electric Guitar(clean)
0x1C Electric Guitar(muted)
0x1D Overdriven Guitar
0x1E Distortion Guitar
0x1F Guitar Harmonics

BASS
0x20 Acoustic Bass
0x21 Electric Bass(finger)
0x22 Electric Bass(pick)
0x23 Fretless Bass
0x24 Slap Bass 1
0x25 Slap Bass 2
0x26 Synth Bass 1
0x27 Synth Bass 2

STRINGS
0x28 Violin
0x29 Viola
0x2A Cello
0x2B Contrabass
0x2C Tremolo Strings
0x2D Pizzicato Strings
0x2E Orchestral Strings
0x2F Timpani

ENSEMBLE
0x30 String Ensemble 1
0x31 String Ensemble 2
0x32 SynthStrings 1
0x33 SynthStrings 2
0x34 Choir Aahs
0x35 Voice Oohs
0x36 Synth Voice
0x37 Orchestra Hit

BRASS
0x38 Trumpet
0x39 Trombone
0x3A Tuba
0x3B Muted Trumpet
0x3C French Horn
0x3D Brass Section
0x3E SynthBrass 1
0x3F SynthBrass 2

REED
0x40 Soprano Sax
0x41 Alto Sax
0x42 Tenor Sax
0x43 Baritone Sax
0x44 Oboe
0x45 English Horn
0x46 Bassoon
0x47 Clarinet

PIPE
0x48 Piccolo
0x49 Flute
0x4A Recorder
0x4B Pan Flute
0x4C Blown Bottle
0x4D Shakuhachi
0x4E Whistle
0x4F Ocarina

SYNTH LEAD
0x50 Lead 1 (square)
0x51 Lead 2 (sawtooth)
0x52 Lead 3 (calliope)
0x53 Lead 4 (chiff)
0x54 Lead 5 (charang)
0x55 Lead 6 (voice)
0x56 Lead 7 (fifths)
0x57 Lead 8 (bass+lead)

SYNTH PAD
0x58 Pad 1 (new age)
0x59 Pad 2 (warm)
0x5A Pad 3 (polysynth)
0x5B Pad 4 (choir)
0x5C Pad 5 (bowed)
0x5D Pad 6 (metallic)
0x5E Pad 7 (halo)
0x5F Pad 8 (sweep)

SYNTH EFFECTS
0x60 FX 1 (rain)
0x61 FX 2 (soundtrack)
0x62 FX 3 (crystal)
0x63 FX 4 (atmosphere)
0x64 FX 5 (brightness)
0x65 FX 6 (goblins)
0x66 FX 7 (echoes)
0x67 FX 8 (sci-fi)

ETHNIC
0x68 Sitar
0x69 Banjo
0x6A Shamisen
0x6B Koto
0x6C Kalimba
0x6D Bagpipe
0x6E Fiddle
0x6F Shanai

PERCUSSIVE
0x70 Tinkle Bell
0x71 Agogo
0x72 Steel Drums
0x73 Woodblock
0x74 Taiko Drum
0x75 Melodic Tom
0x76 Synth Drum
0x77 Reverse Cymbal

SOUND EFFECTS
0x78 Guitar Fret Noise
0x79 Breath Noise
0x7A Seashore
0x7B Bird Tweet
0x7C Telephone Ring
0x7D Helicopter
0x7E Applause
0x7F Gunshot (also commonly used as a drum kit)


Volume
Volume is a simple concept as well, but unlike most of the song arguments, it must be a value less than 0x80, or else (for some whacked out reason) it acts as a rest o.o

It follows 0xBE.

Panning
I need to investigate panning a little more, but I do believe that 0x00 is the neutral value. Either that, or it's 0x0C. I believe that pan's range is from 0x00 to 0x0F.

Full Metal
July 7th, 2009, 09:54 AM
I'm sorry but I don't understand any of this, would someone be willing to add screenies?
in peticular the copying part and sappy part, I'm able to get the song.gba just fine, and the end of the file isn't just 00's or nothin it's a variety, I just don't understand what i'm supposed to copy (the entire file? the part at the end that seems to separate itself from rest of song.gba?) and where i'm to put the copied part, and then how to do the stuff with sappy.
Wait....
do you just take the 'song part' put it at the beginning of the file then delete the rest of song.gba?
then import that track through sappy?
I'm confused so badly right now.
And to help further my understanding, is the stuff we copy the equivelant of using mid2gba (hex wise)?
eg mid2gba makes a track the same as TR makes a song.gba that contains a track equivelent to midgba output?
I hope that i wasn't very confusing....

Crimson Stardust
July 7th, 2009, 03:08 PM
i hope you will put up screen soon...
as it will help me better visualisation of the steps..XD

daigonite
July 7th, 2009, 03:33 PM
It's mainly hex editing, so a screen wouldn't really help. o.o

Crimson Stardust
July 7th, 2009, 06:12 PM
It's mainly hex editing, so a screen wouldn't really help. o.o
owhokae....then i will try it again..btw this is a good tut...xD

Full Metal
July 28th, 2009, 08:06 AM
actually could you tell me what tile editor / viewer u use?
tilemolesteralternate does not tell you what byte your song starts with.
Also, is it possible to do this without taking songs from TLA?
e.g. skip to the "tr.exe" part if you have your midi's split into one track files?
*edit* also could someone post a link or pm/email/im me a link to the sappy 1.6? i can't find it on google :\ just 06

ThePoketrix
January 8th, 2010, 07:41 AM
Now don't you all start making Pokemon Mars/Venus/Mercury versions now in imitation of Jupiter...
why not a Pokemon Earth/Saturn/Uranus/Neptune/Pluto version?

:laugh: just kidding

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....
On my Sappy, the "INI" file is an XML document.
And that means I can't use the "ELF" method, 'cause I can't edit XML documents.
How do you either turn it into a TXT, or get the 1.6 version?

gamesharkhacker
February 15th, 2011, 09:51 PM
Nice tutorial corvidae! But my songs screw up when I try to loop them using the B2 and B1 Hex bytes. A little help anyone? And does anyone know where I can get like an updated version of Sappy 1.6 or just an ini-file thing that has FireRed in it.
Thanks, GSH

AyameHikaru
February 16th, 2011, 07:51 AM
EDIT: NVM on that.

Now I've got the problem of not having a 'tr' in midi2gba to open. My files are:

a.out
as.exe
cygwin1.dll
ld.exe
mend.o
mid2agb.exe
MPlayDef.s
ms.s
objcopy.exe
pat.s
tmp.s

?????????????

daigonite
July 23rd, 2011, 11:21 AM
Well this seems odd. I don't seem to have posted my video tutorials here! They are available here:

dwRywPiW0-I

This goes over the basics of inserting a song that doesn't loop.

The final result of which produced this:

gRNWzniFeoU

Le2EUNzyXbg

This goes over looping and a few track properties.

The final result which produced this:

3eKtoRrHie4

Also, I've tried this method with even games that don't use samples, like the fairly obscure Suikoden Card Stories, and it will still work (starts at about 1:05 of this video). Many many MANY earlier GBA games (most big names before 2004 and some in 2005 even) use this method so it can be used with many titles.

d464_iVkcGc

Please note that trying to add samples to a game like this causes the game to crash.