News:

As a consequence of the forum being updated and repaired, the chatbox has been lost.
However, you can still come say hi on our Discord server!

Main Menu

Golden Sun Music editing

Started by MaxiPower, 03, January, 2009, 08:32:00 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

MaxiPower

just found this video posted on youtube.

http://ie.youtube.com/watch?v=dHyRkH4XXhs

just thought i would share it

Atrius (He/Him)

Ah, that has to be Charon from Golden Sun Realm's work.

When I told her the Pokemon games for GBA, and Golden Sun use the same music data format I expected her to put Golden Sun music in her Pokemon hack, not the other way around  
[sprite=220,4,0]I'm shaking my head in general disapproval of everything[/sprite]

Charon

After seeing this, I decided to sign up here. Sorry if this is considered a revive.

Yeah, I did a bit of GS:TLA music hacking. Here are some more videos if you are interested:
Diamond And Pearl Music in GS (pictures)
Felix for Pokemon Battle, Pokemon Battle for Felix

Also, very recently, I discovered how to edit the actual insturments that make up the soundtrack, as shown in this video:
Gaia Rock: Before and After

To Atrius:
Well, while I was experimenting with Tile Molester and Pokemon Jupiter, I found out a way to change the actual sound of the instruments.

Basically, if you look at the instrument data, it turns out that the weird bytes all over the place are the pointers to the data. Not like you'd actually be changing the instruments in GS, but it explains the reason why you were having trouble transfer the instruments into Pokemon Ruby. It could be also possible to add more instruments through this method. If you transfer a 8 bit, 11,250 Hz Wav file to a GBA Pokemon Rom using Pokecry, its possible to transfer that file to instrument data and play that sound as an insturment.

Looking at the GS:TLA Instrument data, I realized something that I hadn't noticed for a long while - all of the songs use the same instruments! Why Pok

Atrius (He/Him)

QuoteIt could be also possible to add more instruments through this method. If you transfer a 8 bit, 11,250 Hz Wav file to a GBA Pokemon Rom using Pokecry, its possible to transfer that file to instrument data and play that sound as an insturment.

Mmm... Actually the way GBA games handle music & sound effects is identical.  A sound effect like that is usually just a music track that only plays one note using a special instrument that's actually the audio clip for the sound effect.  Also, the instrument data itself is virtually identical to a Wav file, if you knew how you could even, oh... let's say... Insert Wav format voice clips to add voice acting to a game    
[sprite=220,4,0]I'm shaking my head in general disapproval of everything[/sprite]

Charon

Hmm, I guess I was trying to say that... Pokecry is a nifty program that inserts the wavs for you, so that's why I brought it up. Unfortunately, it only works for Pokemon R/S (and maybe FR/LG, but I don't really know), but transfering the bytes is pretty easy with Tile Molester anyways, so...

I figured that out yesterday, actually, so I'm going to mess around with it for a while.

Hey, Atrius, I have a question. I noticed that there are a few bytes from the begining of the sound (I think it's the 8th byte in; or maybe it's a word, I suck with all this lingo), that seems to change the frequency of the sound. Do you happen to know how much you have to change the number to play an octave lower? Because many of the String Ensamble and Flute parts are a bit... high... and I really don't want to go and change every single song to accomidate.

Atrius (He/Him)

1 Word = 4 Bytes
1 Byte = 2 Hexadecimal characters

So yes, it's a Word in.

I'm not knowledgeable when it comes to music at all, but I believe to increase/decrease a frequencies octave you multiply/divide it by 2.


In case you're curious you can convert that value to the actual frequency it represents by dividing it by 1024.
[sprite=220,4,0]I'm shaking my head in general disapproval of everything[/sprite]

Charon

Yep, you're right. (test'd!)

I already began to change the tracks, though... they needed a remixing, anyways. I'm not going for pure perfection, but something really close to it.

Charon

MEH. This is annoying me.

Where is the offset to the main synth insturment in Golden Sun (the one that plays the lead track in the original battle theme, NOT the polysynth but it sounds like the Lead 2 Sawtooth)?

Charon

As I thought. Pokemon has those too.

So with a little messing around it could be possible to play the sound as is? That's weird, because polysynth is completely normal.

Atrius (He/Him)

Does it?  Can you tell me where one is?
[sprite=220,4,0]I'm shaking my head in general disapproval of everything[/sprite]

Charon

If you're refering to Polysynth (It's used in the Jenna Theme), it's here in the original GS: 0x81315D0

I also found the Bird Tweet: 0x142a80

These are both referring to the original GS by the way...

If you're refering to the System made sounds, they're in insturment data, and have no offset to their information. It's kind of weird. I still don't get how it exactly works yet (which is why in Sappy Synth instuments do not play for Pokemon Roms)

Atrius (He/Him)

Both of those are WAV samples.

Aside from it's direct sound channel the GBA also has 4 Programmable Sound Generators.

The part of the instrument data that looks like 0x00003C00 for most of TLA's instruments is what decides which channel an instrument is played on.  The last hex digit at the right is the important one for this, if it's 0 or 8 it's played on the direct sound channel and uses an offset.  1, 2, 3, 4, 9, A, B, and C all use a different programmable sound channel, and only 3 and B need an offset, but their data is different from what you'd see for 0, or 8.  These generate the audio through the GBA's hardware, while the instrument I referred to in my post before my last post generates it through software, which I don't believe Pokemon's music system is programmed to do.

There are also instrument types that point to whole sets of other instruments, like drum kits.
[sprite=220,4,0]I'm shaking my head in general disapproval of everything[/sprite]

Charon

Yep, both of those are WAVs.

I've seen WAV's and the last thing you mentioned used in Pokemon, but not sure about the thing in the middle. I'll check it out.

It turns out the Bird Tweet is the first sound it plays when you raise your stats (there are two, the first is played when the energy or whatever is going on your character or party, it's played once. The second is when the sword/shield animation is played and it's played for each character the stat boosts act on).

Atrius (He/Him)

That would be... 0x081E68B4 I believe.

Oooh, that'd be one of those weird instrument types I mentioned in the message I sent you on YouTube that's programmatically generated.  Even if you transferred it's data into Pokemon perfectly it wouldn't be able to play it.

You can tell which ones those are when the 8 bytes following the frequency are all set to zero.  Usually those values would indicate how long the audio data is, and where to loop it at.


EDIT: Sorry, I was looking at The Lost Age, in Golden Sun that instrument is at 0x0811DAC8

This post has been edited by Atrius on Feb 7 2009, 12:34 PM
[sprite=220,4,0]I'm shaking my head in general disapproval of everything[/sprite]

Rolina

Holy crap... checking out some of those vids of GBA music in Pokemon...

Jenna's Battle theme sounds really good!  In fact, many of the GS themes sound great on it.

On the other hand... Pokemon on GS is really high...  guess the two are set an octave apart.

Charon

Yeah, I found out the hard way that GS's insturments are offsetted a little unusually.

In other news, I inserted some of Golden Sun's insturments into the Pokemon Rom. Let me tell you, the first route song (GS Overworld) and the Pokemon Center (Regular Sanctum) sound perfect. You will be having flashbacks hearing them.

I'm getting a beta of the IPS up in like 2-3 days. It's going to be a jaw dropper. I'll post a link here, since I'm getting quite a bit of support from Atrius, Maxipower and Nick.

MaxiPower

Quote from: Charon on 08, February, 2009, 09:33:00 PMI'm getting a beta of the IPS up in like 2-3 days. It's going to be a jaw dropper. I'll post a link here, since I'm getting quite a bit of support from Atrius, Maxipower and Nick.
I look forward to it. cant wait to hear the music in a different tone

Charon

Sweetness.

By the way, is anybody interested in the ELF method of inserting Music Hacking? People are bugging me to put it up. I'll get a video on Youtube ASAP.

It's better than Sappy's assembler for 3 reasons - it works for all GBA roms, you control everything so if you mess up it's easier to fix, and it always works if you follow through correctly. The only real disadvantage is if you really suck at using a tile viewer and don't understand how the palattes work, you're bound to screw something up.

I think it's possible to do the same in a hex editor, but I prefer doing things in a more visual manner =P

Cerulyth

Hm.  Can I ask how you're accomplishing this?  Because I can get Pok

Charon

THE ELF METHOD



Roms used in this tutorial:

AGFE: Golden Sun: The Lost Age (a lot of people have been asking how I get the music into Pokemon, so I'm making a tutorial. This method works for any song, and it's more reliable than Sappy's built in assembler. Sappy doesn't even work on my computer anyways...)



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 Alhafra
0003 Temple 1
0004 Dalia
0005 Apooji
0006 Normal Izumo
0007 Bummed Izumo
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.

You may start loving me for life now.