4 ms·
Below is a collaborative answer from myself and my colleague, Phil Burk who is a SWE on the audio framework team. Thanks for your interest in the details of An
by donturner 6y ago
Below is a collaborative answer from myself and my colleague, Phil Burk who is a SWE on the audio framework team.
Thanks for your interest in the details of Android Latency measurement techniques.
Some of the measurements were collected by third parties. We cannot describe their techniques but they are probably similar to ours.
We use OboeTester to measure latency. You can find a description of how to measure Tap-to-Tone Latency and Round Trip Latency in this doc:
https://github.com/google/oboe/blob/master/apps/OboeTester/docs/Usage.md https://github.com/google/oboe/blob/master/apps/OboeTester/d...
We do not use the Larsen Effect any more because it was too sensitive to variations in gain. We now use a random encoded bit stream that sounds like a short noise burst. We can get a better correlation peak with that signal.
> Many of the latency measurements break the latency down between
> audio downlink and uplink.
It is very hard to separate the input and output latency without special hardware (like the WALT device).
You can measure combined input+output latency using a loopback test. Input latency tends to be much lower than output latency. This is because, when the full duplex stream is stable, the input buffer is close to empty and the output buffer is close to full. Then, if there is a preemption, the input buffer fills up and the output buffer drains, providing glitch protection.
You can measure touch+output latency using tap-to-tone. The screen touch latency is about 15-30 msec. If you use a hardware MIDI controller (like a keyboard or drum pad) instead of tapping the touch screen then you can get a “touch” latency of about 1 msec (MIDI is a lightweight and low latency protocol). Then you can get a better estimate of just the output latency.
> The android doc discusses using a GPIO to have a zero-latency signal.
We don’t normally use that technique because it requires special hardware.
> I found oboetester, splatency, drrickorang, and google walt.
Our group supports OboeTester.
> The first interesting thing is that oboetest, drrickorang, and walt seem to need an external jack-based dongle.
The lowest latency path is usually over the headphone jack (either through 3.5mm or USB dongle). To test this path you do need a "jack-based dongle" aka loopback adapter.
The reason why wired headphones usually give you lower latency is that OEMs often introduce digital signal processing for the speaker to improve the acoustics/quality, which can introduce additional latency. Side note: this is why you will often see "best with headphones" on games and music apps.
That said, OboeTester will work over the speakers and mic in a quiet room. That is because the new random bit technique is more robust.
> I'd like to script these tests.
OboeTester can be scripted. We use it for continuous integration testing. https://github.com/google/oboe/blob/master/apps/OboeTester/docs/AutomatedTesting.md https://github.com/google/oboe/blob/master/apps/OboeTester/d...
- chemag 6y agoThanks Don and Phil for the great answer. Some further comments: * I find interesting that you are getting better correlations when you add a well-known noise burst instead of a less chaotic signal (e.g. a tone or a chirp). In retrospect, it makes sense * for the uplink/downlink breakup, I see in the Usage.md file in oboetester that you're isolating the downlink measurement with the tap-to-tone experiment. For this experiment, the doc suggests to use (a) the jack to avoid the speaker processing extra latency, and (b) a USB-MIDI input device to replace the touch screen latency (15-30 ms). 2 questions here: * Q1: I assume that, if instead of the jack, you use a usb-c audio adapter accessory mode, there should be no extra latency either, right? (I'm using late pixel phones) * Q2: which device are you using for the USB-MIDI input? Thanks again! edit: s/markdown/formatdoc/g
- donturner 6y ago> * Q1: I assume that, if instead of the jack, you use a usb-c audio adapter accessory mode, there should be no extra latency either, right? (I'm using late pixel phones) That's correct, by using either the 3.5mm jack, or USB-C adapter you won't incur any additional latency introduced by DSP to improve the speaker acoustics. However, the USB path typically does have a few ms higher latency than the 3.5mm jack path. > * Q2: which device are you using for the USB-MIDI input? We've used a variety of devices and found the latency differences to be negligible. At the moment I test with an old AKAI LPK25.