Wednesday, November 10, 2010

Wiseandroid.com | Intro to the three Android Audio APIs

Wiseandroid.com | Intro to the three Android Audio APIs: "Conclusion: Choosing the right audio API
Here’s a table that might help you find your way between the three audio APIs that you have on Android.

Question If Yes
Do you need low latency, such as in games or sound effects? Use SoundPool; if it’s not flexible enough, use AudioTrack
Do you need to play video that has an audio track? Use MediaPlayer
Do you have a set of short sounds that you expect to play many times? Use SoundPool
Do you need to stream audio from an external source, e.g. HTTP or TCP stream? Try using MediaPlayer; if it doesn’t support your case, use AudioTrack
Do you need to generate audio from scratch, such as by using math formulas / frequency modulation? Use AudioTrack
Do you need to play background music? Use MediaPlayer
Do you need to modify the audio on the fly? Use AudioTrack
This table is far from being complete, but hopefully it could help you choose the right API for your"