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 begi开发者_运维知识库nning 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.
精彩评论