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.
Advanced Audio Coding, or AAC files (also known as MPEG-4 AAC), take up very little space and are good for streaming, especially over mobile devices. Requiring less than 1 MB per minute of music and sounding better than MP3 at the same bitrate, the AAC format is used by iTunes/Apple Music, YouTube, and Android.
A lossless audio file format is the best format for sound quality. These include FLAC, WAV, or AIFF. These types of files are considered “hi-res” because they are better or equal to CD-quality. The tradeoff is that these files will be very large.
MP3 is the most commonly used format for audio, songs, and ringtones, but it's not the only one. Android all supports M4A, WAV, and OGG.
Introduction to Android Audio Effects Audio effects are used to enhance audibility of sound or to improve a specific audio feature. Android source code comes with few default audio effects like bassboost, equalizer, loudness enhancer which are then applied to the track using AudioFlinger while playing audio.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With