I profiled my programs, and it turned out a large portion of CPU was spent on SoundPool.play().

The game has ~10 sound files, each under 1 second. Currently they are 64kbs variable MP3s. They are loaded to a SoundPool at the beginning and played frequently throughout the game.

My question: What audio format (e.g. mp3, ogg, etc.) is most friendly to cpu and battery consumption on mobile devices? I use them only for sound effects, and there's no need for simultaneous playbacks.

Many thanks.

有帮助吗?

解决方案

As far as I know, there will be not much difference, as Android uncompresses the audio files before putting them into the SoundPool, in order to be able to quickly play them afterwards. That's also the reason that you cannot put very many (or large) sounds into a sound pool without running out of memory.

其他提示

I'd expect audio formats with little compression like WAV and MIDI to consume fewer CPU cycles than MP3 or Ogg at the cost of higher RAM usage.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top