The PokéCommunity Forums

The PokéCommunity Forums (https://www.pokecommunity.com/index.php)
-   Binary Hack Research & Development (https://www.pokecommunity.com/forumdisplay.php?f=195)
-   -   Research Music Hacking Info from the Fire Emblem Community (https://www.pokecommunity.com/showthread.php?t=256363)

ArchsageX July 3rd, 2011 11:06 PM

Music Hacking Info from the Fire Emblem Community
 
A fond "hello" from the Fire Emblem ROM Hacking community! Myself and my hacking cohorts thought it might be helpful to share some stuff about music hacking around here, to aid in the hacking effort and such.

First of all, found this floating around in the Japanese GBA Hacking community boards. Not sure if you were aware of it, but I didn't notice any signs of that awareness.

http://dl.dropbox.com/u/5490460/sappy2006mod15.zip

Main thing of interest for me is IT DOESN'T FREAKING CRASH like the other Sappy 2006 when on Vista or Windows 7 and you load a ROM.

Another nice feature is "Edit Voice Table" function. Details are in the spoiler below.

Spoiler:
http://i22.photobucket.com/albums/b336/shadowofchaos725/Hacking/Sappy2006Mod15.png


Readme (If I put it in a text file, it'll turn back into gibberish again):
http://dl.dropbox.com/u/5490460/Sappy%202006%20Mod%2015%20Readme.doc

Google Translate Edition:
http://dl.dropbox.com/u/5490460/Sappy%202006%20Mod%2015%20Readme%20Google%20Translate%20Edition.doc

Quote:

To collect the information needed to play the song, the driver reads the information from the table the following songs in order.

┌ ─ ─ ─ ─ ─ ┐
│ │ table song
└ ─ ─ ─ ─ ─ ┘

(Reference)

┌ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ┐
Music Information │ (Header) │
└ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ┘
↓ ↓
(Reference) (Reference)
↓ ↓
┌ ─ ─ ─ ─ ─ ─ ─ ─ ┐ ┌ ─ ─ ─ ─ ─ ─ ─ ─ ─ ┐
Sequence data Voice group │ │ │ │
└ ─ ─ ─ ─ ─ ─ ─ ─ ┘ └ ─ ─ ─ ─ ─ ─ ─ ─ ─ ┘
│ │ │ │
┌ ─ (see) ─ ┘ │ │ └ (see) ┐
↓ │ │ ↓
┌ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ┐ │ │ ┌ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ┐
Drum Voice group │ │ (reference) voice output table specified │ │ │
└ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ┘ │ │ └ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ┘
│ │ │
└ (see) ┐ │ └ (see) ┐
↓ ↓ ↓
┌ ─ ─ ─ ─ ─ ─ ─ ┐ ┌ ─ ─ ─ ─ ─ ─ ─ ─ ┐
Real memory data │ │ │ │ voice waveform data
└ ─ ─ ─ ─ ─ ─ ─ ┘ └ ─ ─ ─ ─ ─ ─ ─ ─ ┘


Table songs are strung together with the binary data and 8 bytes of data per song.

The FR, which begins this song 467f0ch table includes 347 songs written in all of information.
This area would not have to fiddle in particular, if there is a need to extend the table if the song, please refer to the following.


But more than just a Sappy update, there's also a tool that the FE Community has adopted (created by one of our members) called Zahlman's Song Editor. It can basically import songs from any GBA game (including their voicegroups) and even insert MIDIs, using specified instrument maps.

Another thing from the FE community that sorta links into Zahlman's editor, and I'm not sure if the Pokemon Hackers have done this already, is the use of MIDI instruments in the GBA ROMs. The "Instrument Patch" imports the MIDI instrument map from the song.gba file generated by MIDI2GBA, which allows for MIDIs to be directly inserted directly into the ROM in their original state.

A great example, one FE ROM Hacker (mariobro3828) ported a song from Golden Sun with this editor, and himself ported the instruments from Golden Sun to Fire Emblem. This is probably one of the most advanced things we've come up with, a direct instrument-for-instrument, note-for-note port of a song from an entirely different game.

colcolstyles July 3rd, 2011 11:14 PM

I've never seen a tool with support for the attack, decay, etc. values in voicegroup entries. It's a pain to edit them by hand and ever since I stumbled upon this document, I've wondered how long it would take for someone to make a tool that allows easy editing of voicegroup/instrument data. Neat stuff. Thanks for sharing. :)

shadowofchaos July 3rd, 2011 11:26 PM

I haven't experimented it much, but it's much easier than modifying it manually.

Thanks for posting for me Arch :P

Custom Sound effects are also possible with wav2gba. Maybe I should link that too... at least once I get 15 posts.

Darthatron July 3rd, 2011 11:30 PM

This is a wonderful gift, thanks!

Does Zahlman's Song Editor only support the Sappy Engine? Because I like to hack FFTA and only like 20% of the songs use the Sappy Engine. :(

Mariobro3828 July 3rd, 2011 11:43 PM

The video of mine that Arch linked you to, it's an older version of the ported song, just follow the link in the description and it'll take you to my newer version.

To avoid credit grubbing, the ability to port instrument data is part of Zahlman's editor (to preserve the quality of the song). Most of the instruments I did not import manually, but I did successfully manage to port the GS drums manually (which...incidentally is like porting 20+ instruments at once because of the multiple tracks of the set...it's a nightmare, I don't recommend it unless Zahlman implements a way to port multi sample instruments).

The main thing I wanted to showcase with that video was the fact that I repointed some of the voice groups and made kind've a hybrid instrument map with two instruments from a midi instrument patch, and the rest directly from golden sun, using the midi instruments only when a certain instrument was incompatible with porting (gs drums sounded weird in FE for some reason...yes I did all that manual porting for nothing. Oh well, at least I proved it can be done manually. Also, the sawtooth synth instrument relies on GS's specific music engine, so I had to midi that too). I think I got it to sound pretty decent.

The other thing was the fact that I manually spliced tracks together. This is a handy little trick that helps you avoid the whole track limit thing. If you have knowledge of the music's score (I almost went the music major route so it helped me here), and how that is represented in data, splicing the tracks is easy. You just have to count notes and rests. The tracks can't overlap either. Though in the case of directly ported tracks, the game creators liked to use the B3 command (jump) to conserve space, which is always followed by a pointer, so it was a pain repointing about 80 or so pointers. Tracks inserted from midis should not have this problem. I used this technique to take a 10 track song and splice it down to 8 tracks, fitting within Fire Emblem's 8 track limit. Maybe someday there will be an app to do this very thing automatically.

Anyways, sorry for the jumbled mess of text I just typed. It's late...


Quote:

Originally Posted by Darthatron (Post 6727339)
This is a wonderful gift, thanks!

Does Zahlman's Song Editor only support the Sappy Engine? Because I like to hack FFTA and only like 20% of the songs use the Sappy Engine. :(

What exactly do you mean by sappy engine?

When porting a song, you feed the editor the offset of the header. With the information of the header, the editor ports every track there is a pointer to, leaving every byte of the tracks intact, save for the pointers, which it repoints automatically. It then looks at the pointer to the voice group data, grabs the necessary instrument samples for the songs, repoints etc, creates a custom instrument map for that song and puts it into the destination offset. If one of the voice groups has a pointer to a sub group (like drumsets do) then it does not import that track, because Zahlman hasn't programmed his editor to do something that intricate yet. The name of the game is lossless quality, it takes up a lot of data yes, but it's usually worth it.

shadowofchaos July 3rd, 2011 11:58 PM

Quote:

Originally Posted by Darthatron (Post 6727339)
This is a wonderful gift, thanks!

Does Zahlman's Song Editor only support the Sappy Engine? Because I like to hack FFTA and only like 20% of the songs use the Sappy Engine. :(

I've never actually tried. I know Tales of Phantasia doesn't use the Sappy Engine, and I've never experimented with Zahlman's application for those kinds of games.

If the table functions the same way, then it SHOULD theoretically be able to rip the song as well the voice sample.

Darthatron July 4th, 2011 12:03 AM

Quote:

Originally Posted by shadowofchaos (Post 6727374)
I've never actually tried. I know Tales of Phantasia doesn't use the Sappy Engine, and I've never experimented with Zahlman's application for those kinds of games.

If the table functions the same way, then it SHOULD theoretically be able to rip the song as well the voice sample.

Turns out the version of Sappy that ArchsageX posted works with a lot more songs anyway. ^_^ Yeah, replacing the songs was never a problem. It was just tedious having to manually find the song number by playing through the game and setting a breakpoint on play_music routine. >_<

Once again, thanks for posting.

shadowofchaos July 4th, 2011 12:19 AM

He's the guy that posted for me, since I didn't have high enough of a post count to do so.

I also have never used Sappy to rip or insert songs. I'm actually kind of wondering how it works to set the voicegroups. I've always used Zahlman's song editor since it was always importing from one Fire Emblem to the other. XD

Also, I still can't post links, but I should probably share wav2gba. Since sound effects you hear are usually just "one long note" and the "instrument" of the sound effect, it's pretty useful for having the GBA have the updated Fire Emblem "Get Item" or "Weapon Broke" sounds.

I just thought I'd share what we found to help you out and then mysteriously disappear... except the darned post count thing is preventing me from doing so. Well, I kinda understand. I'm pretty sure that prevents spam bots from causing a problem.


Edit: It SEEMS like I'm blind. That Sappy 2006 Mod 15 I found in the a Japanese GBA ROM hacking forum... I failed to see the "Import Sample" function.

Seems like my complicated process of making custom sounds... is now obsolete. XD

Platinum Lucario July 4th, 2011 4:39 AM

This is excellent! Thanks so muchly, ArchsageX! For one thing, now we don't have to worry about Sappy crashing anymore, I really do think this modified version of Sappy should be spread around to everyone here on PC and to let them know how much better it is compared to the normal Sappy 2006 that has a load of bugs in it and doesn't read some of the waveform data in the voicegroup/soundbank, not only that but the original Sappy 2006 crashed at certain loop points when testing a song.

I am so glad we've actually an improved version of Sappy, I wonder if the program really is open sourced after all? Seeing that there's a newer one built by someone already means that the person has their hands on the source code of Sappy 2006. ^^

This surely is going to help me with inserting customized songs and editing the voicegroups/soundbank, so I could even make it sound even better. :o

Platinum Lucario July 4th, 2011 1:08 PM

Quote:

Originally Posted by Team Fail (Post 6728073)
Oh, I like. I like. I will take a look at this because it will help with MIDI exporting a lot.

It doesn't like any of my Pokemon games. It crashes when trying to play files, and it doesn't like scanning for the soundtable in FireRed BPRE.

If you're wondering about Sappy 2006 Mod15 not showing the tracks in FireRed, well here's the interesting part. Sappy doesn't need an .xml file to be able to play and read the tracks in the ROM, you can just change and type in a higher number for which song you want to edit or play. In FireRed, the sound effects go from 1-255, while the BGM goes from 256-346, remember... the song number is in decimal, not hexadecimal.

Try typing in 298, then press play, and you'll hear the Kanto wild Pokémon battle music.

Maybe we'll have to see who is actually good at making a .xml file so that anyone can choose the song they desire, or you can always import the .xml from the normal Sappy 2006 (the buggy one of course). But I think it's best if someone creates a better .xml list for song list from what Kawa listed, like SE01, BGM01 and so on, because anyone is bound to insert new songs into their ROM Hack.

Oh and on another note, Sappy will only freeze if you select a song number that is blank and empty (that's right, free space!). So here's what you do, don't click play after when you put in a number higher than 346, instead... just click anywhere on the main amplifier area on Sappy and it will act like nothing happened. And you can insert new songs into the blank and empty spots.

shadowofchaos July 4th, 2011 1:09 PM

Quote:

Originally Posted by Team Fail (Post 6728073)
Oh, I like. I like. I will take a look at this because it will help with MIDI exporting a lot.

It doesn't like any of my Pokemon games. It crashes when trying to play files, and it doesn't like scanning for the soundtable in FireRed BPRE.

It occasionally crashes for some reason, just like Sappy 2005.

As for your scanning the sound table, if it can't find it.. meh.

But if you know where it is, you'd best modify the sappy.xml file.

If you have used another Sappy before, you can probably use that Sappy.xml file.

ArchsageX July 4th, 2011 4:39 PM

Just realized something! The instrument patch I shared only works for the game, Fire Emblem 7.

Instrument patch is a UPS patch that only works for FE7. Here's a raw hex version of it that you can paste into your ROMs manually.

http://dl.dropbox.com/u/5490460/Mid2GBA%20Instrument%20Patch.dmp

And paste it in your ROM at the offset 0x11C3AC0 (expand your ROM if you don't have that offset). That expands a ROM to about 20MB, so if you're warry about that sorta thing, you can also repoint the table to your own offset.

tl;dr summary for my version:

Patch your ROM/Paste the dmp at offset 0x11C3AC0.
When inserting MIDIs, reference the instrument map at 0x12F471C.

Sierraffinity July 4th, 2011 5:07 PM

Quote:

Originally Posted by Team Fail (Post 6728270)


Hm. I'll have to do that. Is it also normal to sound like raw midi? I remember Sappy played music like it did on the GBA.

Go to Options>Use Wave driver. ;)

shadowofchaos July 4th, 2011 6:20 PM

Quote:

Originally Posted by ArchsageX (Post 6728491)
...20MB, so if you're warry about that sorta thing, you can also repoint the table to your own offset.

Arch, no... you CAN'T.

Took me hours to do that for Mageknight404.

ArchsageX July 4th, 2011 6:22 PM

You did it, didn't you? There's a different between "impossible" and "not advised."

Sierraffinity July 5th, 2011 9:54 AM

Quote:

Originally Posted by Team Fail (Post 6729396)
Weird. The old version of Sappy didn't require this. IIRC.

Well, the first time you run it, it uses wave, but if you choose MIDI, then it stays like that for the next startup, so you must have chosen MIDI while trying to get it to work on Windows 7 (or something, IDK).

Shiny Quagsire July 5th, 2011 10:56 AM

*throws sappy into recycle bin* I'm loving this new Sappy! The table editing is awesome, as well as the import samples thing. Compatibility isn't my issue, since I have XP! :P

shadowofchaos July 5th, 2011 7:10 PM

Considering how this version of Sappy is more useful than the old one...

Does that qualify as justification for updating the old topic/making a new thread on the Toolbox section?

I kinda only ended up here because most of the results/top results of "Sappy error" google search, like the "ActiveX object failed" or something like that results in one of this forum's very outdated topic, with no info on how to solve it, especially if those Sappy versions crash outright when you're running Vista or Windows 7.

As for any "source"... I don't have enough Japanese knowledge to decipher much on that site discussing "Sappy 2006 mod 12".

So getting the source code is VERY unlikely.

Shiny Quagsire July 6th, 2011 9:02 AM

Quote:

Originally Posted by shadowofchaos (Post 6730539)
Considering how this version of Sappy is more useful than the old one...

Does that qualify as justification for updating the old topic/making a new thread on the Toolbox section?

I kinda only ended up here because most of the results/top results of "Sappy error" google search, like the "ActiveX object failed" or something like that results in one of this forum's very outdated topic, with no info on how to solve it, especially if those Sappy versions crash outright when you're running Vista or Windows 7.

As for any "source"... I don't have enough Japanese knowledge to decipher much on that site discussing "Sappy 2006 mod 12".

So getting the source code is VERY unlikely.

Most errors when starting sappy can be fixed my installing actual sappy from http://helmet.kafuka.org/, then copying the better one over it.

Xenesis July 9th, 2011 10:31 PM

Modifying voicegroups?

Sweet.

Music hacking's still probably the most complicated part of hacking a GBA game but what the heck, at least the tools are improving.

Mr.Pkmn July 10th, 2011 12:34 AM

Let me tell you: this Sappy version is a GODSEND!

Quote:

Originally Posted by Xenesis (Post 6738387)
Music hacking's still probably the most complicated part of hacking a GBA game but what the heck, at least the tools are improving.

For me it's the easiest along with scripting. I found more tedious storywriting and mapping :P
Hell, I'll show you what this new sappy allowed me to do!


Mr.Pkmn July 12th, 2011 10:35 AM

Quote:

Originally Posted by Team Fail (Post 6742088)
That is seriously awesome! I so want that in my hack, but it's a DS hack. Maybe I could implement it somehow.

Can I haz patch?

If you're hacking a ds game you should probably port directly track and samples from Black/White. Sappy edits only GBA music.

AmineX July 12th, 2011 5:17 PM

MM kinda cool i finally got what are the 4 last bytes of instrument string are: attack,decay,sustain and release!! very usful thanks!
Still i prefer manual work since i developed my own tools to do that stuff :)
another interessting point is the ability to play song in real mode out put

Mr.Pkmn July 12th, 2011 11:58 PM

Quote:

Originally Posted by Team Fail (Post 6742967)
I do know that. But I use Sappy to log MIDI files so I can port them to NDS from GBA. You h ave a stripped-down version (I think) of that song, so it will take up less memory in the .SDAT.

No, I've used the full MIDI extracted from VGMTrans. Why bother of the MIDI when you can copy-paste its files from the rom?

shadowofchaos July 19th, 2011 4:48 PM

Quote:

Originally Posted by Xenesis (Post 6738387)
Modifying voicegroups?

Sweet.

Music hacking's still probably the most complicated part of hacking a GBA game but what the heck, at least the tools are improving.


Quote:

Originally Posted by Mr.Pkmn (Post 6738479)
Let me tell you: this Sappy version is a GODSEND!

Hell, I'll show you what this new sappy allowed me to do!


Glad I could help someone by delving into the moonspeak ridden forums. XD


I actually use it more for importing/making new sound effects from other sources.




Importing samples takes up a lot of space though, sheesh. >_>;


All times are GMT -8. The time now is 8:39 AM.


Like our Facebook Page Follow us on Twitter © 2002 - 2018 The PokéCommunity™, pokecommunity.com.
Pokémon characters and images belong to The Pokémon Company International and Nintendo. This website is in no way affiliated with or endorsed by Nintendo, Creatures, GAMEFREAK, The Pokémon Company or The Pokémon Company International. We just love Pokémon.
All forum styles, their images (unless noted otherwise) and site designs are © 2002 - 2016 The PokéCommunity / PokéCommunity.com.
PokéCommunity™ is a trademark of The PokéCommunity. All rights reserved. Sponsor advertisements do not imply our endorsement of that product or service. User generated content remains the property of its creator.

Acknowledgements
Use of PokéCommunity Assets
vB Optimise by DragonByte Technologies Ltd © 2023.