Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

For android media player mp3 vs. wav

I want to know if it is faster to load and play a small wav than a small mp3 file on android media player. The wavs are about 30 KB and the same files as mp3s are about 20 kb. The mp3s have the advantage to save resource space. The sound files have to be played with split second timing.

like image 988
Tim Wayne Avatar asked Jun 27 '10 00:06

Tim Wayne


2 Answers

For such small sounds, you will get best results with SoundPool.

like image 143
ognian Avatar answered Sep 24 '22 16:09

ognian


Even the weakest android devices have ample computing power to play an mp3, and probably have hardware acceleration for it as well. The real question is the setup overhead for playing a wav vs. playing an mp3, which should be fairly easy to measure programmatically.

I'm a little surprised you're getting such a poor compression ratio with mp3. Even lossless compression algorithms tend to get a 2:1 compression ratio with wav. Given that an android device probably isn't hooked up to audiophile-quality speakers, you should be able to get away with 64 kbit/s mono mp3 compression, or even lower. If you can get the file size under 4K, it'll fit in a single memory page, which is about as low as you can get for OS overhead.

If for whatever reason you're stuck with a 1.5:1 compression ratio, it's probably not worth the extra work.

like image 32
Chris Avatar answered Sep 22 '22 16:09

Chris