Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development

Reply
Contributor
Posts: 18
Registered: ‎01-23-2011
My Device: Not Specified
Accepted Solution

mp3 vs wav files for game sound effects

I am working on a video game and have the audio working using OpenAL and wav files.

 

I was just adding the backing track and noticed that the wav file was pretty big 4mb vs 1 mb vs the original mp3 file

 

I am trying to get the game to work with the mp3 files to save on space (can not get this to work see other post)

 

But that has gotten me thinking.

After doing lots of reading on the web I have noted that most sources recommend using wav files over mp3

 

I would have thought "space" would be a concern for mobile apps such as this, but that does not seem to be an issue in these discussions.

 

Do people not care about the actual bar size? (effects transmission and space on the tablet)

Should I care?

 

The bar file is currently about 4-5mb with the backing track it would be 8-9mb

 

Please note that I have already reduced the bit rate (and done some other tricks) to minimize the file size, the fact remains the mp3 file is much smaller then the wav file.

 

I also appreciate that there are some legal/philosophical reasons not to use mp3 but I am only thinking about the technical ones.

 

BlackBerry Development Advisor
Posts: 668
Registered: ‎11-29-2011
My Device: developer
My Carrier: other

Re: mp3 vs wav files for game sound effects

Have you considered shipping as an mp3 and decompressing it to wav when your app installs?

Just a thought.

 

Most folks will recommend wav files for games because you often want to save cpu cycles for your game, instead of spending them on mp3 decoding.  Also, you can much-more easily do random access on a wav file in case you need to do looping, or start playback from some position other than the start of the file, etc.

 

 

 

BlackBerry Development Advisor
Posts: 668
Registered: ‎11-29-2011
My Device: developer
My Carrier: other

Re: mp3 vs wav files for game sound effects

and instead of decompressing at install time, you could always just decompress an mp3 file into ram when your app starts up and forego decoding it on-the-fly in-game.  saves disk space, saves download time, but at the expense of some more ram used at runtime.

Contributor
Posts: 18
Registered: ‎01-23-2011
My Device: Not Specified

Re: mp3 vs wav files for game sound effects

Thanks for your response.

 

I could not see a recommended way to convert an mp3 to wav file.

Is this something I would need to figure out myself, perhaps using some open source library?

Highlighted
Contributor
Posts: 18
Registered: ‎01-23-2011
My Device: Not Specified

Re: mp3 vs wav files for game sound effects

Update

 

It turns out the reason it was crashing was a stupid error on my part

once I fixed that it stopped crashing

 

After plenty of trial and error I got it to work.

I am also able to play multiple mp3 files at any given time.

 

I think I will use a hybrid model though, .wav files for the sound effects and .mp3 files for the backing track.  I am finding the mp3 files do not seem to be as spunky was the wav file and they just seem off timing wise sometimes.

 

I am also a little surpised that mmr_stop() is so expensive, it caused glitches in my game, but I moved it to a different thread and all seems fine.