Links on Android Authority may earn us a commission. Learn more.
Android Marshmallow edges closer to "Pro Audio" with lower audio latency
Despite a number of smartphone manufacturers offering improved audio hardware in their latest smartphones, Android’s software latency has historically been very poor, preventing many professional audio applications from making their way to the hugely popular mobile platform. However, the folks over at Superpowered have gone back to have a look at Android Marshmallow’s round trip audio latency and there appear to have been a number of improvements.
Before we go any further, round-trip audio latency is very important for real time applications, as users don’t want to have to contend with a noticeable delay when recording, editing or playing back content. Round-trip refers to the time it takes for audio to enter the system, be put into software for processing, and then put back out from a speaker or headphone jack. Human delay perception ends at under 20ms (milliseconds), so the latency of any real time system should be below this figure, with 10ms being the target that is perceived as instantaneous.
Previous testing on Android KitKat and Lollipop devices revealed round-trip latency figures in the hundreds of milliseconds, resulting in a very noticeable delay and making the operating system useless for real-time applications. Even the best Android devices struggled to go lower than 40ms. However, Google has made some major improvements with Android 6.0 Marshmallow, allowing for figures in the sub-20ms range. The Nexus 6P clocks in at 18ms, while the Nexus 9 manages 15ms.
Google appears to have made two notable changes with Marshmallow: a smaller ring buffer size and a new professional audio flag feature. The buffer size has been chopped in half to 128 samples. A buffer stores a selection of samples before these are all sent off into the system together and a smaller buffer means that the whole system updates much more frequently. Buffers and batch processing are often more efficient than sample by sample transfers and processing, so there are trade-offs to find the ideal buffer size.
This smaller buffer saving halves the latency throughout the ALSA (Advanced Linux Sound Architecture) and AudioFlinger sections for both input and output paths, making a noticeable difference to the round-trip times. The graphics below show the audio paths and times recorded with the Nexus 9 tablet.
Android Marshmallow (API 23) also introduces a new FEATURE_AUDIO_PRO flag for developers to look for to reduce the audio output buffer size for the lowest possible latency. A look through Google’s documentation states that devices using this flag must offer 20ms or less round-trip latency and should aim for 10ms. USB audio class devices are also supported through USB host mode, so low latency USB add-ons are now also a practical possibility.
As an added bonus, Android now also supports MIDI as part of the Professional Audio package. Although, this hasn’t been implemented into the native layer. This flag marks a major effort to differentiate Android devices that are capable of professional audio applications, and is a major improvement over the FEATURE_AUDIO_LOW_LATENCY flag from the Gingerbread days, which offers at best a 50ms round-trip.
If you’re interested, Superpowered offers a very detailed explanation of how this all breaks down, including a look at the slightly different latency results when using built-in and external hardware. Android still has a number of issues, but the situation is gradually improving for real-time professional audio.
Previously we have seen that Google’s Nexus devices have been the better performers when it comes to audio latency and this latest testing hasn’t yet shown if these improvements can and have been applied to other Marshmallow powered devices. Google states that only the Nexus 5X, 6P and 9 are “Pro Audio” Nexus devices, so there are probably some hardware requirements in addition to Marshmallow’s software improvements.
Samsung, which offers its own Audio SDK to tap into low latency audio, will be releasing a Samsung Professional Audio SDK 3.0 with its upcoming Galaxy S7 flagship smartphone, which will hopefully match these Nexus results. We will just have to wait and see if other manufacturers support these improved features. Still, there are promising signs that Android may eventually be useful as a real-time audio platform.