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

Adobe AIR Development

Reply
Super Contributor
JeffLemon
Posts: 440
Registered: ‎01-13-2011
My Device: Playbook
My Carrier: NA

Sound?

What's the best way to play sound? Should I embed each file or laod each one in?

 

What are you doing?

 

Thanks

--------------------------------------------------------------------------------------------------
BlackBerry Apps: Instruments | ARTPAD | Piano | Drums | Xylophone
Please use plain text.
Developer
pedgarcia
Posts: 119
Registered: ‎03-10-2010
My Device: Bold 9000
My Carrier: Rogers

Re: Sound?

Hi Jeff,

 

Following advices from here, I'm embedding small sound files, for sound effects. It seems quicker to load and start playing.

 

Cheers

 

 



(*) Kudo-me if you really think I helped you!
My plug: I'm doing a Mobile Experiment, reported on my Blog: Check it out!.
---------------------------
Paulo Garcia
http://www.mobilecreators.com - Twitter: http://twitter.com/mobilecreators
Please use plain text.
Developer
jtegen
Posts: 6,541
Registered: ‎10-27-2010
My Device: HTC One, PlayBook, LE Z10, DE Q10
My Carrier: Verizon

Re: Sound?

If the sound needs are simple, the Sound class works fine.  The Adobe Flex/AIR SDK has good documentation on this as well as there are some threads here about it.

 

If the sould file is small and you need very quick access to it (e.g. mouse clicks, button presses, etc), then I would embed.  If it is a longer sound effect for things like background special sound effects, then I would load dynamically (URLRequest) from app-storage.

 

Sound does not currently work on the 0.9.3 simulator, but it did in 0.9.2.  Works as an AIR application as well.

 

Good luck

Please use plain text.
New Developer
daniel_wind
Posts: 56
Registered: ‎02-07-2011
My Device: BB Playbook
My Carrier: ---

Re: Sound?

Hi Jeff,

 

That decision highly depends on what type of app you are building and more importantly, what level of importance the audio plays within your app. Generally the following guidelines apply:

 

1. Use .mp3 format where possible. For short sounds try diminishing quality as long as possible.

 

2. Embed background ambient track and loop it thru code:

backgroundLoop.play(0, int.MAX_VALUE);   //you can assign a channel too.

 

3. Short Sound Effects can be loaded dynamically (make sure you reuse them in some way though. Also, note that loading assets dynamically several times is not recommended practice.).

 

4. Try merging common sound effects in the main background sound asset (if exists). Sometimes, some sound effects are played at regular intervals so merging them is one excellent way to avoid overloading.

 

These are my general advices on sound. I hope it helps.

 

Cheers,

 

-------------------------------------
www.danielwind.net

Playbook App:
Grab Da Crab
Please use plain text.