Refined Appshttp://www.refined-apps.com
Quality Apps 4 AndroidSo, 23 Okt 2016 10:02:04 +0000de-DEhourly1Updated Latency Measurementshttp://www.refined-apps.com/music/updated-latency-measurements/
Wed, 20 Nov 2013 10:03:34 +0000http://www.refined-apps.com/?p=1873The audio latency of the new Nexus 7 (2013) is not 40ms!. He mentioned this tip:
"Also, always measure latency through the headphone jack, because it's quite common to have to postprocess audio for the (poor-quality) speakers in devices."
OK, time for some additional measurements. I also used this opportunity to check some possible optimizations to my apps that could improve latency. Those optimizations are not part of the official releases so far and since they implicate larger changes, they probably will not for some time. However, the measurements show what can be achieved. I also added values for an Acer A500 as example of a "third-level device".
[Read More]]]>Update (2013/12/21): It seems possible to improve these values even more. I cant give specific values at the moment, but there still seems to be some room for improvement. More to come…
A few days ago, I got a mail from Dan Galpin as an answer to my previous blog entryThe audio latency of the new Nexus 7 (2013) is not 40ms!. He mentioned this tip:
„Also, always measure latency through the headphone jack, because it’s quite common to have to postprocess audio for the (poor-quality) speakers in devices.“

OK, time for some additional measurements. I also used this opportunity to check some possible optimizations to my apps that could improve latency. Those optimizations are not part of the official releases so far and since they implicate larger changes, they probably will not for some time. However, the measurements show what can be achieved. I also added values for an Acer A500 as example of a „third-level device“.

First, be aware that I just took the averages of 5 measurements, no scientifically rigorous measurements. Since the measurements can deviate significantly, the averages of 5 measurements can also deviate by quite some amount.

My conclusions:

The headphone jack makes a difference, but only for the Nexus 7/2013. There is an interesting detail here: If the headphones are plugged in while app already runs, it doesn’t make a difference. The headphones have to be plugged in before the app is started.

The measurements confirm the three levels. However, the second level may be significantly better than I thought, at least with headphones.

There have been many rumors before the release of the new Nexus 7 (2013). Personally, I was interested in one specific detail: audio latency (the time needed to output audio data). It’s the main reason why Android is not a good platform for interactive music apps like virtual instruments (see issue 3434).

For a long time, I could not find information about it.

Then, a day before the official announcement, android police leaked some information: they claimed a latency of 40ms as reported by Caustic 2. This number made it into many other articles. So many actually, that I first thought: „Great, finally there seems to be some interest in latency on Android. That may cause some pressure for the manufacturers“.

However, that number is totally flawed.

I was very aware, right from the start, that that number could not be real. It just doesn’t make sense. There’s no good way to automatically determine that latency in an app, at least without user intervention. So I tried to find out how Caustic 2 comes up with that number. On reddit, the author of Caustic 2 („StinkyRej“), describes how he calculates the number: „To clarify, I’m querying the minimum buffer size for a standard 44Khz 16bit audio stream via the AudioTrack API.“ The AudioTrack API can be used e.g. for mp3 player apps, but it has (almost) nothing to do with low latency audio output on Android.

Ok, so the number is flawed. However, accidentally it’s the same number as given for the Galaxy Nexus and thus, I had some hope that the new Nexus 7 could reach the same level the Galaxy Nexus reached. Finally, there might be a current Android device that can be recommended to musicians.

Since yesterday, the new Nexus 7 (2013) is available in Germany. So, I got one and made some (unscientific) measurements.

I took the old Nexus 7 (2012), the new Nexus 7 (2013) and a Galaxy Nexus for comparison. I installed the current version of my music app „Grand Piano Pro“ (version 2.0.8). It triggers low latency audio (the „fast path“) on all 3 devices. I then used an audio recorder program (audacity) on my notebook to record the noise while I pressed hard on the screen. In the audio recorder, I then measured the time from the start of the touch sound until the piano sound started. In addition, I connected a midi keyboard on the devices and measured the time from touching a key on the keyboard until the piano sound could be heard. They way I made these measurements doesn’t satisfy any scientific standard, but they are precise enough to compare the devices.

To interpret the numbers, it’s necessary to be aware of the current situation on Android regarding latency.

The best low latency Android device I know of is the Galaxy Nexus. It’s outdated, but none of the more recent devices matches its latency.

The Nexus 7 (2012) is on a second tier, reaching about 90-110ms. As far as I know, the Nexus 4, the Nexus 10 and the Sony Xperia Z/ZL should be in this tier too, but that’s hearsay. Please, be aware that the Nexus 4 has a problem with USB-Host/OTG.

As far as I know, almost all other devices have worse latency, often in the range of 150-300ms.

The new Nexus 7 2013 clearly belongs onto the second tier.

From the point of view of a music app developer, that’s a disaster.

With those numbers, the new Nexus 7/2013 is better than the bulk of Android devices, but still cannot really be recommended to musicians.

Even Google itself seems not to be capable of providing real low latency devices reliably. Or did they concentrate their efforts on Android 4.4/Kitkat?

Seems like all I can do is to buy me some coffee and continue waiting.