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 > MIDI -> MOD,S3M, XM conversion

#37836 - brucesinner - Thu Mar 17, 2005 6:34 pm

Hi folks,

I downloaded some MIDI games from web and I tried to convert it to MOD,S3M or XM format using ModPlug Tracker.

The conversion to XM or S3M went all fine but when I convert to MOD the sound become terrible !!! And as the MOD format is the most popular among the Sound Lib Players, I most wanted to convert to it.

Other question is, I tried to do my own player, from a WAV file. I converted the wav file to c-source using wav2gba tool, but the file was so big huge that when i tried to compile it the compiler went nuts without memory !!!

Any tip on this ? Or do I must use WAV only for small sound effects ?

Thanks
Bruce

#37837 - poslundc - Thu Mar 17, 2005 6:47 pm

brucesinner wrote:
Hi folks,

I downloaded some MIDI games from web and I tried to convert it to MOD,S3M or XM format using ModPlug Tracker.

The conversion to XM or S3M went all fine but when I convert to MOD the sound become terrible !!! And as the MOD format is the most popular among the Sound Lib Players, I most wanted to convert to it.


Features that are standard for MIDI tend to port much better to more complicated/sophisticated formats like XM and S3M than they do to MOD.

This does not denigrate MOD as a format; it's just that the two don't really play all that nice with each other. I have yet to see a converter that smoothly goes from one to the other... if you insist on doing so, you'll probably have to write your own to convert things like key depressions and whatnot to the closest MOD feature.

Quote:
Other question is, I tried to do my own player, from a WAV file. I converted the wav file to c-source using wav2gba tool, but the file was so big huge that when i tried to compile it the compiler went nuts without memory !!!

Any tip on this ? Or do I must use WAV only for small sound effects ?


WAV (raw) sound data consumes a lot of space. I don't know how large your particular sound file was, but it's definitely possible to exceed the available space on a cart, and raw sound is always best restricted to short instrument samples and sound effects. If you want to play really long sound or music, consider a compressed audio format. These are computationally expensive, though, and therefore make a poor choice for games.

Also, if your tool is converting the sound to C source instead of assembly, then a large file could potentially overwhelm the compiler. Find or write a program that either outputs assembly or a binary file that can be directly appended to your project.

Dan.

#37839 - brucesinner - Thu Mar 17, 2005 7:07 pm

And what about to convert the MIDI to XM or S3M foramt first and then converting these formats to MOD ?

I had this idea now, but Im at work and cannot test it.

About the WAV talk, Im just realizing that using MOD or XM format for background music is a lot better than using raw WAV.

Thanks ppl

#37840 - tepples - Thu Mar 17, 2005 7:37 pm

Any conversion from XM or S3M to MOD will lose volume channel data. Best way is to just use a player that supports S3M.

Or take an existing player's mixer and write your own Standard MIDI File interpreter on top of it.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.

#37843 - brucesinner - Thu Mar 17, 2005 8:03 pm

thanks tepples

and there are any s3m or xm open source players that i could benefit from looking the format interpreter from them ?

than i would just implement playback and mixer funcionality...

#37876 - tepples - Fri Mar 18, 2005 3:03 am

http://sourceforge.net/projects/modplug/

I've written a format interpreter as well; PM me if you want it.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.

#39439 - thegamefreak0134 - Fri Apr 08, 2005 10:47 pm

On the wav issue, how long is the file?

And what sound format are you using? You SHOULD be using 8,000 Hz 8-bit mono quality sound. (yes, thats all the system can handle, gt over it.) Anything bigger would fry the converter cause it isn't designed for that big of a file. Remember that GBA games (at least the ROMs) are around 8 MB in size. If your sound file is bigger, then you will probably have issues. :-D
_________________
What if the hokey-pokey really is what it's all about?

[url=http:/www.darknovagames.com/index.php?action=recruit&clanid=1]Support Zeta on DarkNova![/url]

#39442 - poslundc - Fri Apr 08, 2005 11:24 pm

thegamefreak0134 wrote:
And what sound format are you using? You SHOULD be using 8,000 Hz 8-bit mono quality sound. (yes, thats all the system can handle, gt over it.)


???

Since when? O_o

Dan.

#39443 - tepples - Fri Apr 08, 2005 11:27 pm

thegamefreak0134 wrote:
And what sound format are you using? You SHOULD be using 8,000 Hz 8-bit mono quality sound. (yes, thats all the system can handle, gt over it.)

"Mono" and "8-bit" I can handle; "8 kHz" I dispute. For instance, GSM Player nominally runs at 18 kHz.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.

#39444 - poslundc - Fri Apr 08, 2005 11:29 pm

tepples wrote:
thegamefreak0134 wrote:
And what sound format are you using? You SHOULD be using 8,000 Hz 8-bit mono quality sound. (yes, thats all the system can handle, gt over it.)

"Mono" and "8-bit" I can handle; "8 kHz" I dispute. For instance, GSM Player nominally runs at 18 kHz.


Why can't the system handle stereo? Not disputing its wastefulness, of course.

Dan.

#39451 - tepples - Sat Apr 09, 2005 12:05 am

Sure, the GBA can do stereo; just load separate streams into the source addresses for DMA 1 and 2, set their destination addresses to the audio FIFOs, and route each FIFO to a separate channel. However, many GBA developers have deemed true stereo a waste of ROM space. Any stereo effects you get in commercial games will typically be the same mono sample played at different volumes on the two channels, and you're lucky to get even that as stereo mixing is often deemed a waste of CPU time and a DMA channel. Surveys show that only a minority of players habitually use headphones, a Game Boy Player, or a Nintendo DS. (The GBA and GBA SP have a single internal speaker that sums the left and right outputs.)
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.

#39797 - yannis - Tue Apr 12, 2005 12:55 pm

There's a few things you have problems with here.

1) GM Samples in ModPlug use multi-sampled instruments
2) Sample Rate of instruments
3) Bit Rate of samples
4) Sample mixing rate of sound engine

The GBA Only handling 8kHZ is utter rubbish.

Solution:
1) REmove all "instrument data" (this will include the multi-sample map)
2) Remove extra samples Not being used. You may need to retune the single sample that is now what that instrument uses.
3) Find out what is the sample mixing rate of the engine, and convert all samples to that mixing rate.
4) Convert all samples to 8bit

I didn't say it was going to be easy. I've had to do this myself - of course there's a few more trade secrets - but I am not cheap.
_________________
DS & GBA Audio Professional
www.GroovyAudio.com

#39814 - ampz - Tue Apr 12, 2005 4:56 pm

The GBA can actually do something like 9-10bit mono if you use both channels and take advantage of the fact that they are added together in the end.
But the usefulness of this particular solution can be questioned... Only use I can see for such a solution is for mixers so that you don't loose too much precision. But it is probably not worth the additional CPU and bus load even then.