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 > Easiest Music/Sound Implementation

#1562 - darkcloud - Mon Jan 20, 2003 5:09 am

What is the easiest, most simple, basic way to implement sound/music in a game? I just want to some music without having to do too much work.
_________________
Maybe in order to understand mankind, we have to look at the word itself: "Mankind". Basically, it's made up of two separate words - "mank" and "ind". What do these words mean ? It's a mystery, and that's why so is mankind.

#1567 - Quirky - Mon Jan 20, 2003 10:12 am

The easiest way I found was to use the Belogic.com "wav" playing code. It won't produce small final binary files if you use an entire wav for music, but it works a treat for smaller sound fx files. Use the wav2raw program in the gbadev.org tools section to convert the wavs to raws for inclusion in a project.

An alternative for music is the NMOD player, which works really well for playing mods. It's fast and fairly easy to add to a project. That will give you more reasonable file sizes and probably better quality music too. It can be downloaded from gbadev too, but you have to hunt back a few weeks in the news archives.

Another way is to use Krawall, which can be used for sound fx and music. I had some problems with this one, though it gives a "richer" sound for playing mods than NMOD (I don't know how to describe it properly, I'm tone deaf ;) It isn't quite as fast I don't think, but has proper documentation and a working GCC example. The modified crt0.s that comes with the krawall download is useful for the NMOD player though, as it sets up the interupt table so that the timer1 interupt is not interupted itself (to reduce the likelihood of the music skipping) Though if you are familiar with asm you could probably do that modification yourself (I'm not, so I couldn't.)

Finally there's Codewaves. This worked in the demo program provided, but was more difficult to add to another project, so I gave up with it. It plays mod files and wavs for sound fx though.

#1586 - darkcloud - Mon Jan 20, 2003 4:03 pm

Thanks I'll try all those out and see what works for me.
_________________
Maybe in order to understand mankind, we have to look at the word itself: "Mankind". Basically, it's made up of two separate words - "mank" and "ind". What do these words mean ? It's a mystery, and that's why so is mankind.

#1608 - JonH - Mon Jan 20, 2003 6:40 pm

Just a summary of the options I've tried so far:

MusicWave by Codewaves
Good replayer, and easy to implement. This was my choice for protracker .mod playing until recently, when I discovered that for some reason it wouldn't let me use hardware sprites while playing the tune.

BoyScout Advance
Great idea for synth sound, very easy to implement and use... but has the unfortunate drawback that it only plays correctly on the emulators :( On real hardware it seems that sound channel 3 is very badly distorted.

NMod
Just downloaded this, and it looks like it could be a good method for integrating a mod with a Demo, since it has callback functions. The demo sounds good, but I couldn't get the thing to work... something about "can't find makefile.1" when trying to compile it.

Krawall
Recently moved to this sound system, and indeed it is the best and easiest to use (in my opinion) so far - as in that it does what i want and i'm not too worried about Rom size or processor speed ;) its easy to implement and sounds damn good.

thats all i've tried so far, the next step for me will be trying the Belogic.com tutorials to play raw sound fx. hope that helps?

laters!

#1609 - darkcloud - Mon Jan 20, 2003 6:43 pm

Thanks, any info I can get about gba sound will help.
_________________
Maybe in order to understand mankind, we have to look at the word itself: "Mankind". Basically, it's made up of two separate words - "mank" and "ind". What do these words mean ? It's a mystery, and that's why so is mankind.

#1659 - darkcloud - Tue Jan 21, 2003 4:37 am

When I try to convert my wav file with Wav2Raw I get an error message saying 'Cannot create RAW file'. What could cause this?
_________________
Maybe in order to understand mankind, we have to look at the word itself: "Mankind". Basically, it's made up of two separate words - "mank" and "ind". What do these words mean ? It's a mystery, and that's why so is mankind.

#1671 - Quirky - Tue Jan 21, 2003 11:51 am

Are you using "Wav2Raw v1.0 for Game Boy Advance by Sylvain Rochette"? If so, it needs to be an 8 bit mono wav file - there are several progs on the web to convert wav types to other types.

As for Nmod, the GCC make file that comes with it is not correct. Neimod did post on here saying it would need fixing before it'd work (or that might have been about a C version..) Anyway, I use this straightforward makefile to compile nmod.s:

Code:

ASFLAGS = -mthumb-interwork -marm7tdmi

all:  nmod.lib

nmod.lib : nmod.s
   as $(ASFLAGS) -o nmod.lib nmod.s


Then link that into my game by doing this sort of thing:

Code:


LIBS = ../nmod/nmod.lib
#plus other libs

#linking step ...
gcc $(LDFLAGS) -o main.elf $(OFILES) $(LIBS)



I didn't manage to recompile the demo that came with the Neimod distrib on gbadev.org, nor did I try too hard, but it was easy enough to add it to my own game.

#1720 - darkcloud - Tue Jan 21, 2003 10:41 pm

Yes I am using that Wav2Raw and it still doesn't seem to work for me. Could I send you my audio file and see if you could convert it for me?
_________________
Maybe in order to understand mankind, we have to look at the word itself: "Mankind". Basically, it's made up of two separate words - "mank" and "ind". What do these words mean ? It's a mystery, and that's why so is mankind.

#1828 - darkcloud - Thu Jan 23, 2003 11:48 pm

Well nevermind, I got it to work. I found another program that converted it. Now everything works fine.
_________________
Maybe in order to understand mankind, we have to look at the word itself: "Mankind". Basically, it's made up of two separate words - "mank" and "ind". What do these words mean ? It's a mystery, and that's why so is mankind.

#1830 - darkcloud - Fri Jan 24, 2003 12:02 am

Well nevermind, I got it to work. I found another program that converted it. Now everything works fine.
_________________
Maybe in order to understand mankind, we have to look at the word itself: "Mankind". Basically, it's made up of two separate words - "mank" and "ind". What do these words mean ? It's a mystery, and that's why so is mankind.