News:

11 March 2016 - Forum Rules

Main Menu

Rip GBA Instruments to soundfont

Started by soulred12, July 11, 2011, 05:28:59 PM

Previous topic - Next topic

soulred12

Hi there,

First I'd like to say, I've googled this to hell and back, with nothing worthwhile to show for it. =/ And: I originally posted this at emuforums but someone there advised me to ask here.

Anyway, I'm involved with a rather large fangame project for Megaman Battle Network. This is being made from scratch with Game Maker, and I'm the musician.

Right now, the tracks I've written sound similar to the game's music, but not exact. If possible I'd like to somehow take the actual "instruments" used by the game and compile them into one or more soundfonts (.sf2 files).

I'm not experienced with ROMs (hence why I put this in the newbie board) but I'd imagine the sound channel settings (waveform, etc.) and the sample data would be stored somewhere in the ROM and could be retrieved by some sort of program. I was hoping that there would be some way to put those settings and samples into soundfonts so I could pop those into my daw and compose directly with them. I've seen soundfonts from the music of other games, so I'm also hoping that means it can be done with the megaman battle network games as well.

Basically, I want to use actual Megaman Battle Network "instruments" (sound settings/samples) to compose "my own" tracks that REALLY sound straight from the game. Does anyone have any ideas or tips on how to do this?

Dwedit

You can always get the samples "the hard way", where you load the GBA file into Goldwave or something as 8-bit unsigned mono.  You lose information on when one sample ends and the next begins, or where the loop points are.
Or you could parse the instruments table, but I haven't successfully done that yet.
"We are merely sprites that dance at the beck and call of our button-pressing overlord."

Jandazekon

I prefer DLS format, instead of SF2.
And sappy.exe can't export instruments to sf2, neither dls.
It only let's you export samples and midi.
The only sample format with loop points is: ITS, ImpulseTracker samples,
Write sample file name pattern as $I.its or $P.its
It can record to midi, it plays the song, gba2mid.

henke37

You might want to read up on the audio hardware in a gba. It might not be quite as compatible as you expect.

Dwedit

All GBA audio is pretty much synthesized in software anyway, so reading about how the hardware works won't really help much.  Except for the classic GB sound channels of course, those are still there as well.
Reading up on the most common GBA audio system used by almost all GBA roms is probably a better idea.
"We are merely sprites that dance at the beck and call of our button-pressing overlord."

Bregalad

Instersting idea. I absolutely love how MMBN sounds. Basically it uses a lot of squarewaves, made with the original GBC channels, added with some simple chords or percussions made with the GBA channels.
The good news is that you'd have to only rip the simple chords and percussions from the game with a program named GBA2MID, and you can get them easily from the game.

The bad news is that perfect square waves are hard to reproduce in SF2, because of interpolation. Most/All soundfont-midi compatible drivers will use interpolation and deteriorate significantly the sharp edges of a square wave. Also, the Square Waves from the GBA are not exactly pure square waves but are bandpass-filtered. I'm pretty sure the difference is noticeable by hear. If you only use one square wave sample, the filtering will "translate" as you will go to different tonality, and add the interpolation problem to that and you get some very inaccurate sound.

So your best bet would be to actually "record" the square waves from a real GBA or from an emulator (I'm not sure how well the bandpass filtering is emulated), and do it for regular pitch intervals (for example every 5th). You can be pretty sure that the translation of the filtering and the interpolation will not be noticeable by hear for pitches close enough to the original.
So with some decent set of squarewave samples, I'm pretty sure it's possible to get accurate gameboy-like sound in a soundfont, it's just not that easy. Also you'd have to do that will all the 3 possible duty cycles, and maybe some different waveforms that can be used by Gameboy channel 3 (but I'm pretty sure only square is used in MMBN games).

soulred12

Thanks Bregalad, this definitely helps.  The other posts do too, but I can't really understand what they're talking about (I really don't know what I'm doing when it comes to hacking stuff--all that stuff about memory etc. is gibberish...I know about memory addresses etc. but I've no idea how they correspond with GBA/emulator/hacking stuff).  I read up on the links they gave, and beyond the descriptions of the sounds made by each channel (which I was already familiar with), I couldn't make heads or tails of what would and wouldn't help me.

QuoteThe bad news is that perfect square waves are hard to reproduce in SF2, because of interpolation. Most/All soundfont-midi compatible drivers will use interpolation and deteriorate significantly the sharp edges of a square wave. Also, the Square Waves from the GBA are not exactly pure square waves but are bandpass-filtered. I'm pretty sure the difference is noticeable by hear. If you only use one square wave sample, the filtering will "translate" as you will go to different tonality, and add the interpolation problem to that and you get some very inaccurate sound.

I didn't realize there would be that many problems with trying to recreate the waves in an sf2.  But, I've got a nice 8-bit plugin for my daw, so if I could at least find the settings for each channel I could recreate them using my plugin (thus avoiding having to build sf2s for those).  Is there any way to discover that, or a site that lists common configurations for various games...or anything that would help?  I can apply a bandpass filter myself and I guess I could play with the settings until it sounds right.

Then I could try to record the samples from mp3s of the games' music.  And would anyone by any chance have a suggestion for a good (preferably free, or very cheap) program to put together sf2s in case I get lucky trying to record the samples?

Bregalad

Vienna (with two n) is an official program that came with Soundlaster cards.
Viena (with only one n) is free but is somewhat still in it's beta phase.

If your only goal is to record the music (and that you don't need to exchange it in MIDI form) maybe you should use sf2 only for the drums and chords, and use your 8-bit plugin for Square waves ? It sounds like a very good approach to me.
Another one would be to use AGB2MIDI to insert other music back into the game so it'd be actually MMBN hacked to play some different music (like I did with my FF6 advance hack, but you'd only have to change the music and not the instruments). The main drawback of this method is that it'd be complicated to use, but you could claim it's "actual GBA music".

If you still want to use the method I described for Square Waves in an SF2, problems could arrose if you use very large pitch bending, where the filter translation and interpolation could end up audible, but overall it would work well.