Recommended Android music format - mp3, ogg or other? [closed]
Asked Answered
R

4

32

I've been asked which format I need the music for my project in and, looking through the documentation, it seems that the Android platform offers a good choice.

Audio is certainly not my forte so I'm wondering if there's a specific format that is best suited for Android playback? The main factors that come to mind are size and CPU overhead for decompression and playback. (The music is to be played in the background of a game, but it's not a particularly CPU intensive game).

Any advice would be very welcome.

Roach answered 25/3, 2011 at 9:38 Comment(0)
H
21

Ogg is the "free" choice, of course, and you are using Android. ;)

I'm not aware of any really significant differences in performance for decoding Ogg and Mp3 equivalent audio.

Mp3 might be the better choice if you intend to use your software on several platforms. The implementation would probably be more consistent than Ogg.

Hymenium answered 25/3, 2011 at 9:43 Comment(2)
What's a good bit rate to choose?Warfourd
Note that MP3 at 320kbit is still not "transparent" for certain sounds (it introduces artifacts) and has issues with bitrate scaling due to audio in the 16-22kHz band (MP3 SFB 21 for the curious). OGG is "transparent" at high enough VBR settings, but is slightly more computationally complex to decode (i.e., takes more cpu cycles per sample).Eudora
U
9

Android 2.3 and up uses OpenSL ES API, which has great support for MP3. All previous versions and bugs and difficulties with audio here and there. I would still go with MP3 for earlier API versions. Ogg would be a pain to implement. In fact, before Android 2.3 API (version 9, I believe), there were lots of complaints about developing any kind of audio applications for Android.

CORRECTION Android does have .ogg compatibility starting with API version 8.

Unyoke answered 25/3, 2011 at 14:43 Comment(0)
P
3

SoundPool is known to have problems with MP3 files. I prefer using OGG files.

Pigpen answered 10/6, 2012 at 12:45 Comment(0)
K
2

why not use .wav files :D

You can have it in a non encoded format, that you can play on the AudioTrack without any need for implementation of a decoder. I've made a music player, with several equalization effect where i use .wav files for playback.

Kendricks answered 25/3, 2011 at 9:51 Comment(1)
Bcos .wav is raw and takes up a lot of space. Would be good for audio applications where you still want to mix and come up new revisions but not a great choice to package with an app as game sound.Modernism

© 2022 - 2024 — McMap. All rights reserved.