Android: sound API (deterministic, low latency)

后端 未结 5 682
天涯浪人
天涯浪人 2020-12-04 13:07

I\'m reviewing all kinds of Android sound API and I\'d like to know which one I should use. My goal is to get low latency audio or, at least, deterministic behavior regardin

5条回答
  •  一向
    一向 (楼主)
    2020-12-04 14:12

    The lowest latency you can get is from SoundPool. There's a limit on how big of a sound you can play that way, but if you're under the limit (1Mb, IIRC) it's pretty low latency. Even that's probably not 40ms, though.

    But it is faster than what you can get by streaming, at least in my experience.

    Caveat: You may see occasional crashes in SoundPool on Samsung devices. I'm have a theory that it only happens when you access the SoundPool from multiple threads, but I haven't verified this.

    EDIT: OpenSL ES apparently has extremely HIGH latency on Kindle Fire, while SoundPool is much better, but the reverse may be true on other platforms.

提交回复
热议问题