Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Android™ Runtime Development

Reply
New Developer
Posts: 5
Registered: ‎02-06-2012
My Device: playbook
My Carrier: verizon

soundpool sounds unable to load

Everything on my android app works great after repackaging and installing on the simulator except my sounds effects. I use a soundpool to load the sounds an play then back with low latency. Sound works on android (see app "Things That Go!" In android market). Logcat in eclipse shows an error to the effect of "unable to load: null" 20 times(once for every sound file I am trying to load into the sound pool). Its almost like the repackager didn't include my mp3's stored in the "res/raw" folder into the new bar file. Any ideas anyone?
Developer
Posts: 40
Registered: ‎04-01-2009
My Device: Torch 9810
My Carrier: Rogers

Re: soundpool sounds unable to load

Try encoding your sound effects in ogg format.  SoundPool has problems with some mp3s (not only on PlayBook, but on some Google TV and other Android devices as well).  In my experience, ogg is a safer option.

New Developer
Posts: 5
Registered: ‎02-06-2012
My Device: playbook
My Carrier: verizon

Re: soundpool sounds unable to load

Thanks, I will try that and repost.  But the official API support page states that ogg is not supported on the Playbook. So far I've tried wav, mp3, and aac. no luck with anyof them on the PlayBook.  All of the formats I've tried work fine on my android devices.....  I've tried repackaging the app through the ADT Plugin and through the online tools, with the same result.  So far this has been very frustrating to port my app over.  Also, the apk2barVerifier tool give me zero warning or errors.

Developer
Posts: 40
Registered: ‎04-01-2009
My Device: Torch 9810
My Carrier: Rogers

Re: soundpool sounds unable to load

I don't really know why the API Support page lists ogg as not supported.  Maybe this information is obsolete? In any case, I have a PlayBook 2.0.0.7111 in front of me with my Android game on it.  Ogg sound effects play just fine through SoundPool.

Highlighted
New Developer
Posts: 5
Registered: ‎02-06-2012
My Device: playbook
My Carrier: verizon

Re: soundpool sounds unable to load

Anything I should know about bitrates or sample rates when I encode my sfx into ogg?  What are you using that you've hard sucess with?  all you're sound effects are in you "raw" folder right?

 

I don't have a Playbook (That's why I'm trying to port this app) so I'm just using the simulator... Maybe it's a problem with the simulator?

 

This is what I've been getting in logcat when running my app on the simulator.  The red error messages occur once for every time I call the SoundPool.load() method. and the yellow warning message occurs when I try to call the SoundPool.play() method.  The app works fine (with simulator lag) otherwise.  But without sound effects, my app is essentially pointless. (its a kids picture book with sounds)

logcat screenshot

Developer
Posts: 40
Registered: ‎04-01-2009
My Device: Torch 9810
My Carrier: Rogers

Re: soundpool sounds unable to load

[ Edited ]

I have two Android apps that I put on the device.  One loads sounds into a SoundPool in onCreate from res/raw.  The sound files are all 128 kbps mp3s, all mono, 11025Hz, 22050Hz, 44100Hz and 48000Hz.  All of them play.

 

The other app originally had its sound effects as mp3 as well.  The files are loaded from assets folder, and they are all 128kbps, stereo and mono mixed, again a variety of sample rates.  The app displayed the same error messages in logcat as you see in yours ("Unable to load" and "sample not ready").  I cannot tell what difference between sound files of app 1 and app 2 makes one app work and the other app fail.  Originally I thought it was stereo vs mono, but app 2 fails to load mono mp3s as well as stereo ones.  I exported my mp3s as ogg for app 2, and all of them loaded an played.

 

I also put the same 2 apps on Logitech Revue with the following result:

app1: no sound at all

app2: no sound with mp3s, works fine with oggs

 

Both apps worked fine with mp3s in them on a variety of Android phones and tablets.

 

I am afraid I am not being very helpful here.  For me it's all trial and error so far.

 

 

New Contributor
Posts: 2
Registered: ‎02-08-2012
My Device: Android developer
My Carrier: N/A

Re: soundpool sounds unable to load

I too found my MP3 sounds didn't work via SoundPool, so I loaded them into Audacity and exported as Ogg (quality level 9) and they now work fine - so that's something to try if anyone has the same problem. One gotcha is to do a "Project / Clean..." in Eclipse before reupping to the simulator - I found the change wasn't picked up until I had done this.

New Developer
Posts: 5
Registered: ‎02-06-2012
My Device: playbook
My Carrier: verizon

Re: soundpool sounds unable to load

I redid all of my sound effects in ogg and now it works fine.... Weird that one of the formats BlackBerry says specifically is NOT supported is the only format I've found that actually works...