Android: sound API (deterministic, low latency)

后端 未结 5 665
天涯浪人
天涯浪人 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 13:48

    About the problem of a deterministic/constant latency, here you can find an interesting article:

    APPROACHES FOR CONSTANT AUDIO LATENCY ON ANDROID

    The core of their investigations is: Because the Audio HAL, which is one of the deeper levels of the audiopath and responsible for the timing of the audio-callback-events, is vendor-implemented the relative latencies can vary, especially in cheap hardware. So they suggest two approaches to reduce the variance of the latency. One is to take care of the callback-timing by inserting audio in fixed intervals, the other one is to filter the callback times to estimate the time at which a constant latency callback should have occured by appliyng a smoothing filter. With this two approaches the could significantly reduce the variance of the latency.

    It should also be mentioned, that there is a new native Android-Audio-API, AAudio.

    AAudio API

    It's available/stable from Android Oreo 8.1 (API Level 27). There is also a wrapper, which dynamically chooses between OpenSL ES and AAudio and is much easier to code the OpenSL ES. It's still in developer preview.

    Oboe Audio Library

提交回复
热议问题