gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

Audio > Questions on music format

#27177 - Parsec - Tue Oct 05, 2004 3:14 pm

I already know that GBA accepts tracker formats like .mod, but I had a few other questions about it regarding the instrument samples, and I couldn't find the answers:

1. Is there or will there need to be a common instrument base that all the .mods will use, or will each .mod have to have its own individual samples?

2. What format do these samples need to be? Obviously we can't use 44.100 kHz 16 bit stereo or anything, but what IS the limit?

3. Not really that related to the above questions, but does anyone know where I can find 8-Bit NES instrument samples?
_________________
~~~ The Timeline is Safe. ~~~

#27179 - poslundc - Tue Oct 05, 2004 3:45 pm

The GBA doesn't natively "accept" any music formats whatsoever. You need to either obtain or write a program that decodes and plays the MOD for you on the GBA's hardware.

Bearing that in mind...

Quote:
1. Is there or will there need to be a common instrument base that all the .mods will use, or will each .mod have to have its own individual samples?


Depends on your player. If it's a MOD player, then each MOD will contain its own samples, since that is defined by the MOD format.

Quote:
2. What format do these samples need to be? Obviously we can't use 44.100 kHz 16 bit stereo or anything, but what IS the limit?


Again, it depends entirely on your player. If you're playing MODs then you must follow the MOD spec, which means instruments are sampled at a relatively low frequency (around 8000 Hz). Other formats support higher frequencies.

There is also the consideration of the rate at which your mixer runs, which makes the tradeoff between higher frequency and processor consumption. IIRC my mixer runs at 16 kHz, which means any samples recorded at frequencies higher than that will only get downsampled anyway.

One final note is that while there are no built-in instruments on the GBA, the GBA has four specialized wave generators (mostly legacy from the original GB) that can be used to synthesize instruments, sound effects and whatnot. Most music players don't make use of them, however, as no publically adopted music standard supports them.

Dan.

#27185 - ScottLininger - Tue Oct 05, 2004 5:04 pm

One popular player for MOD type music is Krawall, which has been discussed in other threads on this forum. Just do a search for "Krawall" and you should find some info.

Samples in Krawall all get converted to 8-bit, 16KHz and are played in mono, so that's your limit with that tool. However, I'm sure there are other MOD players that handle higher-quality samples (though obviously that will use more of your processing power.)

Krawall's conversion tool is smart enough to discard identical samples across songs, so if you're careful to use the same instruments you can save a lot of ROM space.

Cheers,

Scott

#27186 - Parsec - Tue Oct 05, 2004 5:18 pm

Actually, what I guess I'm really looking for here is the standard format that GBA uses for music. I thought it was .mod, but you have to make a special player for it? Does that mean that all the GBA games out there have special players like that as well, or is there some other standard?
_________________
~~~ The Timeline is Safe. ~~~

#27187 - ScottLininger - Tue Oct 05, 2004 5:40 pm

Like Dan said, there is no standard format. The gameboy sound hardware is very low level. You can't just feed it a WAV or a MOD and have it do anything. You have to write the code that manually inserts sound data into the appropriate memory registers at the appropriate moments.

So yes, every commercial game has a sound engine running underneath it. Most commercial developers have their own library for this, though there are some that have used "3rd party" tools such as Krawall.

-Scott

#27200 - SmileyDude - Wed Oct 06, 2004 3:35 am

Parsec wrote:
Actually, what I guess I'm really looking for here is the standard format that GBA uses for music. I thought it was .mod, but you have to make a special player for it? Does that mean that all the GBA games out there have special players like that as well, or is there some other standard?


The standard "format" for the GBA is 8-bit PCM channels at arbitrary bit rates. You get two of them, and you can send them to the left, right, or both speakers (in headphones).

What this basically means is that for anything more complex than playing 2 sounds at once is that you need a mixer and some kind of tracking functionality to control what is being mixed in the mixer. As said above, there are a few libraries around that will play various formats (MOD being one of them).

Depending on what you are wanting to do (add sounds/music to a game, write a standalone music player, learn how to write sound code), you have a number of alternatives.

If all you want to do is add some music in a somewhat standard format to your game, I would probably just use one of the libraries -- AAS is free for non-commercial use. There are others as well. Saves you the time of writing your own.

If you are wanting a standalone player, that implies that you have more CPU time to make the quality a little higher. You might even try playing music that would be too complex to play within a game. But, the one limit that you'll run into is that the sound channels are 8-bit, so it'll never sound as good as it would on a PC. For this, you might use an existing library, or you might want to write your own.

The third option (wanting to learn how to write sound code) means that you'll be writing your own, of course. As to format, pick whatever format you want -- I would suggest an easier format at first (like MOD), but with an eye towards expanding it in the future. If one of the existing formats doesn't do what you want, you can always create your own format. The skies the limit here. Just remember that the further you stray off the path, the harder it will be to get content for your player :)
_________________
dennis