3 ms·
Up to now I've been referring to round-trip audio latency. Round-trip latency involves three components in the audio chain: audio input, audio processing and au
by userbinator 6y ago
Up to now I've been referring to round-trip audio latency. Round-trip latency involves three components in the audio chain: audio input, audio processing and audio output.
I read through the whole article and that's the most detail given about any testing methodology; I don't see any more description of how these numbers are being measured.
My rule of thumb for computer speed measurements and efficiency has always been in terms of CPU instructions; the goal of 10ms, while seeming very tiny, is still roughly ten million instructions of a 1GHz CPU. The other numbers mentioned are proportionally more, which then makes one wonder where all the time is being spent.
Relatedly, I've actually written audio drivers (HD audio for Windows 3.x/9x, long story but I won't digress...) and the output latency measured from the app writing a buffer to the signal appearing at the headphone jack is probably in the dozens to hundreds of microseconds range (thousands of CPU instructions, including virtualisation overhead) at most --- but those OSs have extremely thin abstraction layers, and the call stack between the app and writing to the hardware registers is very shallow.
The fact that newer hardware/software seems to have more audio latency reminds me of this: https://danluu.com/input-lag/ https://danluu.com/input-lag/
- klodolph 6y ago> I read through the whole article and that's the most detail given about any testing methodology; I don't see any more description of how these numbers are being measured. The details usually aren’t that interesting. What you can do is record an input signal, pass the signal through to the output, and wire the output back in to another input. You end up with two copies of the input signal, one delayed by the total round-trip time relative to the other. It’s fairly easy.
- userbinator 6y agoIt's certainly interesting because they can have a huge effect on the measurement results. For example, with HDA and I suspect other audio codec systems, what you described can be done with essentially 0 delay by configuring the codec to do the in/out mix itself. If you are measuring output from application buffers to input to application buffers, then how big they are and at what sample rates and bit depths will also affect the latency you see, etc.
- _flux 6y agoCertainly nobody would then agree this is measuring the latency of the audio _system_, it would only measure the latency of the audio device, right? I think we can give the benefit of the doubt and assume they are not trying to actively deceive.
- donturner 6y agoI'm the author. My testing methodology was to run the round-trip latency test using OboeTester: https://github.com/google/oboe/tree/master/apps/OboeTester/docs https://github.com/google/oboe/tree/master/apps/OboeTester/d.... It's a simple test: produce a tone (either on built-in speaker or over wired headphones if using a loopback dongle), measure the time it takes for that tone to reach the audio input. For devices which I didn't have access to (our team has a limited number of test devices) I used the figures from Superpowered, but with some assumptions/rules: #1 If AAudio was available on the device I used the measurements from that rather than OpenSL ES #2 No measurements from custom ROMs #3 I used the measurements from the latest version of Android which the OEM had released for that device. For example, if a device was originally released with Lollipop but it was possible to upgrade to Marshmallow then I used the figures for Marshmallow. For touch screen latency measurements I used a WALT device (https://github.com/google/walt https://github.com/google/walt)
- chemag 6y agoI'm actually very interested in the details. I have a few questions, in case you have cycles to help me understand. # audio latency From your comment and the original "An update on Android's audio latency" article, there seems to be 2 different ways to calculate "audio latency". * 1. play a well-known sound (a tone), listen for it in real-time IIUC, the exact operation of this would be something like this: open recorder loop: timestamp1 <- getclock() play audio file keep listening to input frames until detecting audio file signature timestamp2 <- getclock() sample := timestamp2 - timestamp1 * 2. measure audio loopback feedback (larsen effect) Operation should be as follows: open recorder play audio file loop: keep listening to input frames for 1-2 seconds # analyze captured file look for 2x consecutive appearances of the original audio file sample := timestamp2 - timestamp1 Q1: Did I get this right? Any hunch about the pros&cons of both approaches? # downlink/uplink latency Many of the latency measurements break the latency down between audio downlink and uplink. Q2: How is this measured? The android doc discusses using a GPIO to have a zero-latency signal. You swap the signal on a well-known GPIO, and then play a well-known audio file. You then connect the GPIO to a speaker, and measure the latency between the GPIO-fed speaker, and the actual device speaker. As an optimization, you plug both the GPIO and the audio jack that feeds the actual device speaker into an oscilloscope, and get the distance there. Is this how audio downlink latency is measured? Q3: If this is how downlink latency is measured, how do you implement it in prod devices (no access to the board)? Is this something that can be simulated using the usb-c plug? # tools The android doc/some googling points to several tools. I found oboetester, splatency, drrickorang, and google walt. I tested all but the walt one. The first interesting thing is that oboetest, drrickorang, and walt seem to need an external jack-based dongle. Q3: Why is this needed for? The audio latency approaches mentioned above should only need a speaker and a mic. The experience has not been great for any of the tools. Operationally, I'd like to script these tests. Instead, I need to click on GUIs. Also, all the tools I tested seem to fail often, so I have to repeat the experiments multiple times. Also, I miss better documentation on exactly what they do. Thanks for any help edit: s/markdown/formatdoc/g