Android 5.0 (L-Release) is set to improve Audio and Video experience by huge margin.
Not only does Android 5.0 enables Pro Photography, it will be welcomed by audio processing applications including composition, production and karaoke for the first time.
Audio on Android had sucked big time. There was not just output delay (which was fixed by a good margin in KitKat); there is significant input delay as well. The delay is sometimes as large as 600ms, thereby making it a deal breaker for Audio processing enthusiasts. With recent changes to L release, its all changing for good.
Let’s go over all the Audio improvements in Android 5.0 aka L release:
1. Low latency (Input / Output) - Audio patch-panel
Kitkat introduced OpenSL based accelerated audio to reduce output audio delay, but it was still high enough to be usable for Audio processing apps.
With Android 5.0 comes Audio patch-panel that ensure significantly lower input-latency (~20ms) which is not perfect but very usable. Output latency and whole audio processing is also accelerated to reduce significantly, to enable Real-time audio for the first time.
2. 24bits per sample
Sample resolution is up from 16bit PCM to 24bit for better precision. In Kitkat and older releases, Android was 16bit per sample throughout the processing system. Even though several 2013 and newer phones supported24bit 96khz DAC, Android core never really made use of it. Some OEMs like LG did make alter the Android AudioFlinger and kernel to leverage 24bit but it was never contributed back to Android community.
3. 96khz sampling rate
Yes, up from 44khz/48khz, now Android supports 96khz sampling rate.
4. Floating point for Sampling
Floating point is a scary word for every programmer coz not only its costly (double the memory), its painfully slow. Google is trying to change the impression Floating points have. They have made the whole Audio system floating point compatible, arguing that FPs are as fast as Integers on modern SIMD processors, and the advantages are significant. Immediate advantages of using FPs are:
- No audio clipping
- Better precision – Better quality
- Better dynamic range
- greater headroom
Floating-point arithmetic is especially useful during intermediate calculations. Playback end-points use integer format for audio data, and with lower bit-depth. (In the L Developer Preview, portions of the internal pipeline are not yet floating-point.)
For developers: Use android.media.AudioFormat.ENCODING_PCM_FLOAT
5. Better Resampling
Android 5.0 improves on the Linear interpolator used to resample audio streams. Most audio files have either 44khz or 48khz or 96khz sampling. In order to play jitter free, it needs to be resampled if it doesn’t match the phone’s DAC supported sampling rate. e.g. Nexus 5 supports 48khz sampling rate. So in order to play a 44khz Mp3, it must be resampled to 48khz. Resampling is a mess in pre-5.0 Androids coz the linear interpolator adds lots of aliasing and artifacts.
5.0 Resampler is written ground up for minimal resampling aliasing by increasing sampling to twice.
6. Improved AV sync
Android had Audio and Video sync problems (of the order of 10 – 100ms) since a very long time now. Finally it has been addressed with new synchronized methods that ensure audio track matches with video keyframes, at all times.
7. USB audio
Yes, USB audio is now officially supported. Out of the box, you should be able to use external Soundcards (or DAC) and route all audio through it. This is a big news for Android Audiophiles who use USB DACs like Fiio E7, Meridian Explorer, Audioquest DragonFly DAC checkout this thread for USB DAC compatibility list.
8. API improvements (For developers)
- Your app can now supply audio data as a
ByteBuffer, in the same format as provided by
- New NDK Media APIs
WRITE_NON_BLOCKINGoption can simplify buffering and multithreading for some apps.