Android Sound Programming

Thought i’d post this for those out there doing some sound programming on Android phones. Ran into a really annoying bug/limitation while trying to get sounds working. To get sounds and music playing in your apps you have two options, a rather simple MediaPlayer class and slightly more complicated SoundPool class. Being a previous sound programmer I of course opt for more control and go with creating my own sound manager using SoundPool. It all worked great playing little sounds and such until I inserted a song to play. The song wouldn’t play at all or would only play for 5 seconds or so then suddenly cut out. It seems there’s a 1MB limit when working with sounds in the SoundPool, go over that limit and weird things happen. Of course this is completely undocumented (Android docs are good for very basic knowledge of getting set up, but anything beyond that and you’re on your own). 1MB is pretty limiting when it comes to music, I had a small theme song I was trying to play in the background of my app, it was around 800kb as an MP3, but uncompressed it comes out at around 6MB. After several days of pulling my hair out I finally ran across someone that had actually dug into the android code and found this 1MB limit in SoundPool. MediaPlayer on the other hand happily takes large sound files and plays them just fine. So, lesson learned, use SoundPool for more control and small sound effects in your app, and if you need to play background music or larger sound files you may have to go with MediaPlayer. Hopefully this will save somebody out there some headache as they work with sound on Android.

Some errors you might see in LogCat when running into this problem:
AudioFlinger could not create track, status: -12
Error creating audio track
Something about buffer underuns


Finished up The Elder Scrolls V: Skyrim – Mini Review

Fun single player RPG game. I hadn’t played Oblivion (aka Elder Scrolls IV), so I was a bit lost on some of the storylines floating around, but it didn’t affect game play, and there seems to have been plenty of fresh content so I wasn’t too alienated. The graphics were quite nice, I don’t have a power house machine, but it’s not a slouch either (i5 quad core, nVidia GT 240 1GB vid) and I found myself stopping and enjoying the view in the game more than once, which is a rare thing for me to do.

Content of the game was overflowing. More quests than you would ever want to do, although I can’t say there was a big variety in the type of quests. Most quests involved some disgruntled person wanting back an item or piece of equipment they had lost which somehow invariably ends up at the end of a dungeon, please go retrieve it. There were much more involved and intricate quests than this in the main story of course, but if you stuck to side quests it does get a tad monotonous. Another thing I found strangely lacking in variety was the monsters. Dungeons were usually filled with regular npc types, zombies, or spiders/rats, nothing to write home about. Maybe they spent too much time working on the dizzying amount of quests.

One of the funner things about the game was Dragons. They seem to show up randomly at times while you’re trekking across the land, you’ll get an uneasy feeling and realize there’s a shadow circling over you. Quick scan of the sky shows that indeed there’s a dragon scoping you high in the sky, ready to make a meal out of you. It’s often best at this point to send your horse into a full gallup and head to the nearest group of people you can find, doesn’t matter if they’re good guys or bad, dragons attack indiscriminately and mayhem usually breaks out. There’s lots of fun little touches like this to the game that make it stand out above the pack.

If you find yourself with a bit of free time, you may want to pick up this game since it is very nice about letting you decide if you want it to be a one day of playing game, or something that lasts weeks. If you focus on the main quest you could literally be done in a day of play, if you tend to get lost on side quests and exploring you could stretch it out for a lot of play.

Previous Page