Skip to content

Some thoughts on Android development and the latency question

March 18, 2012

As some of us have discovered very quickly, audio latency on Android is high. There were some indications that the figure of 45ms would somehow be achievable (ie. a buffer of 2048 frames a 44.1kHz), however, I am not sure it is achievable anywhere. On my Galaxy Tab 10.1, which is brand new, I am getting around 200 ms, which is about four times that figure.

There have been some efforts showing that given the right software support, lower latencies are possible. In this blog, for instance, we see the use of pulseaudio on an Android phone, with a 20ms latency reported. The crucial point however is this: do we want to develop for a custom system? The answer, as far as I am concerned is no. In my view, we need to use the OS as-is, off-the-shelf. Customised systems, rooted devices, etc., might be good for playing around, but it is not a productive way to go. Eventually, we would like the user down the street to be able to run our apps on her/is device.

I see similarities with the way pro-audio developed on Linux. In the early days with OSS devices and non-preemtible kernels, many people took to customising their systems to get some sort of decent audio support. But then slowly things start to change. First, better support for devices came with ALSA, then Jack was released, followed by more readily-available low-latency kernel patches (and prebuilt kernels). Then stock kernels got preemption support, so that now 10-15ms latency (not ‘low’ but acceptable) is standard and millisecond-level latency is available in specialised kernels. People can develop for this, knowing that the Linux desktop user will be able to take advantage of it.

So, for the time being, we need to keep asking the Android team to give us lower latencies. Develop apps that will benefit from it. Show them how it can make a difference. The way I see this, there is enough in Android to make it a very good platform for what we do, we only need the latency issue addressed.  Hopefully, they are hearing this loud and clear.


From → Android

  1. D. Josef permalink

    Quoting ALSA as a step ahead is pretty daring. It is a flaming pile of crap, with some of the worst latency and fidelity around that you can get out of a PC.

    • I am not sure what you are referring to but ALSA is not in general responsible for higher latencies, the OS is. Low-latency Linux kernels with ALSA can give you ms-level latency, which is better than any other desktop OS. But ALSA should not be accessed directly by applications, a layer like Jack should be used.

  2. bee permalink

    looks like low latency has come

  3. I follow your blog! Thanks for providing such a wonderful insight to these topics. I really want to request you to explore the advancement in this area with Android Jelly Bean platform. And come up with a post if it allows low latency or have any advancement at all related. All the best! Keep up the great work!

  4. yes, it is starting to look good. I am trying to source a Google Nexus tab to try it out. As soon as I do, I will post some more.

  5. Way cool! Some very valid points! I appreciate you penning this write-up and also the rest of
    the site is really good.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: