Glenn Kasten | f3902ab | 2015-03-30 11:57:14 -0700 | [diff] [blame] | 1 | page.title=Audio Latency Measurements |
| 2 | @jd:body |
| 3 | |
| 4 | <!-- |
| 5 | Copyright 2015 The Android Open Source Project |
| 6 | |
| 7 | Licensed under the Apache License, Version 2.0 (the "License"); |
| 8 | you may not use this file except in compliance with the License. |
| 9 | You may obtain a copy of the License at |
| 10 | |
| 11 | http://www.apache.org/licenses/LICENSE-2.0 |
| 12 | |
| 13 | Unless required by applicable law or agreed to in writing, software |
| 14 | distributed under the License is distributed on an "AS IS" BASIS, |
| 15 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 16 | See the License for the specific language governing permissions and |
| 17 | limitations under the License. |
| 18 | --> |
| 19 | <div id="qv-wrapper"> |
| 20 | <div id="qv"> |
| 21 | <h2>In this document</h2> |
| 22 | <ol id="auto-toc"> |
| 23 | </ol> |
| 24 | </div> |
| 25 | </div> |
| 26 | |
| 27 | <p> |
| 28 | This article gives round-trip audio latency measurements for select devices and |
| 29 | platform versions. |
| 30 | </p> |
| 31 | |
| 32 | <h2 id="definition">Definition</h2> |
| 33 | |
| 34 | <p> |
| 35 | <a href="http://en.wikipedia.org/wiki/Latency_%28engineering%29">Latency</a> |
| 36 | is an important system performance metric. There are many kinds |
| 37 | of <a href="latency.html">audio latency</a> |
| 38 | metrics. One useful and well-understood metric is |
| 39 | <a href="latency_measure.html#measuringRoundTrip">round-trip latency</a>. |
| 40 | Round-trip latency is defined as the time it takes for |
| 41 | an audio signal to enter the input of a mobile device, be processed |
| 42 | by an app running on the application processor, and exit the output. |
| 43 | </p> |
| 44 | |
| 45 | <img src="images/round_trip_on_device.png" alt="Round-trip audio latency on device" id="figure1" /> |
| 46 | <p class="img-caption"> |
| 47 | <strong>Figure 1.</strong> Round-trip audio latency on device: T<sub>output</sub> - T<sub>input</sub> |
| 48 | </p> |
| 49 | |
| 50 | <h2 id="why">Why we measure latency</h2> |
| 51 | |
| 52 | <p> |
| 53 | We measure and report latency so Android |
| 54 | app developers will have the data they need to make informed decisions about available |
| 55 | latency on actual devices. By sharing these numbers for select Nexus devices, we also hope to |
| 56 | encourage the entire Android community to measure, publish, and reduce |
| 57 | latency on <i>all</i> devices. |
| 58 | Please join us in our commitment to reducing audio latency. |
| 59 | </p> |
| 60 | |
| 61 | <h2 id="app">Application impact on latency</h2> |
| 62 | |
| 63 | <p> |
| 64 | There are two kinds of delays that a signal processing stage can add to latency: |
| 65 | algorithmic delay and computational delay. |
| 66 | Algorithmic delay is inherent and does not vary with the CPU. |
| 67 | An example is the delay added by a |
| 68 | <a href="http://en.wikipedia.org/wiki/Finite_impulse_response">finite impulse response</a> |
| 69 | (FIR) filter. |
| 70 | Computational delay is related to the number of CPU cycles required. |
| 71 | For example, attenuation of a signal is usually done by a multiplication operation, |
| 72 | and this multiplication will take a varying number of cycles depending on the CPU. |
| 73 | </p> |
| 74 | |
| 75 | <h2 id="how">How we measure</h2> |
| 76 | |
| 77 | <p> |
| 78 | The measurements below were taken with the |
| 79 | <a href="loopback.html">Dr. Rick O’Rang audio loopback dongle</a> |
| 80 | and an |
| 81 | <a href="latency_measure.html#larsenTest">audio feedback (Larsen effect) test</a>. |
| 82 | </p> |
| 83 | |
| 84 | <p> |
| 85 | For our measurements, we assume the application signal processing |
| 86 | adds zero algorithmic delay and near zero computational delay. |
| 87 | </p> |
| 88 | |
| 89 | <p> |
| 90 | We measure round-trip latency via the headset connector for several reasons: |
| 91 | </p> |
| 92 | <ul> |
| 93 | <li> |
| 94 | There are important music applications, such as guitar and voice processing, |
| 95 | that use the headset connector. |
| 96 | </li> |
| 97 | <li> |
| 98 | Measuring round-trip latency of the on-device microphone and speaker can |
| 99 | be cumbersome, as it is difficult to keep a feedback loop in open air from entering |
| 100 | uncontrolled oscillation. |
| 101 | </li> |
| 102 | <li> |
| 103 | The on-device transducers are small and sacrifice frequency response |
| 104 | to achieve their small size. To compensate, digital signal processing is |
| 105 | applied but increases algorithmic delay for the on-device path. |
| 106 | </li> |
| 107 | </ul> |
| 108 | |
| 109 | <p> |
| 110 | There are cases where on-device microphone and speaker latencies |
| 111 | <i>do</i> |
| 112 | matter, but they are usually for one direction, not round-trip. |
| 113 | Techniques for measuring unidirectional latency are described at |
| 114 | <a href="latency_measure.html#measuringOutput">Measuring Output Latency</a> |
| 115 | and |
| 116 | <a href="latency_measure.html#measuringInput">Measuring Input Latency</a>. |
| 117 | </p> |
| 118 | |
| 119 | <img src="images/round_trip_via_headset_connector.png" alt="Round-trip latency via headset connector" id="figure2" /> |
| 120 | <p class="img-caption"> |
| 121 | <strong>Figure 2.</strong> Round-trip latency via headset connector: T<sub>output</sub> - T<sub>input</sub> |
| 122 | </p> |
| 123 | |
| 124 | <h2 id="measurements">Example measurements</h2> |
| 125 | |
| 126 | <p> |
| 127 | The measurements shown are specific to a |
| 128 | <a href="{@docRoot}source/build-numbers.html">build number</a>. |
| 129 | Devices are listed in approximate order of initial release and within device by platform version. |
| 130 | The test application uses the Android native audio API based on OpenSL ES. |
| 131 | </p> |
| 132 | |
| 133 | <table> |
| 134 | <tr> |
| 135 | <th>Model</th> |
| 136 | <th>Platform<br />version</th> |
| 137 | <th>Build<br />number</th> |
| 138 | <th>Sample rate<br />(Hz)</th> |
| 139 | <th>Buffer size<br />(frames)</th> |
| 140 | <th>Buffer size<br />(ms)</th> |
| 141 | <th>Round-trip<br />latency (ms)<br />± one buffer</th> |
| 142 | </tr> |
| 143 | |
| 144 | <tr> |
| 145 | <td>Nexus One</td> |
| 146 | <td>2.3.6</td> |
| 147 | <td>GRK39F</td> |
| 148 | <td>44100</td> |
| 149 | <td>768</td> |
| 150 | <td>17.4</td> |
| 151 | <td>345</td> |
| 152 | </tr> |
| 153 | |
| 154 | <tr> |
| 155 | <td>Nexus S</td> |
| 156 | <td>2.3.6</td> |
| 157 | <td>GRK39F</td> |
| 158 | <td>44100</td> |
| 159 | <td>1024</td> |
| 160 | <td>23.2</td> |
| 161 | <td>260</td> |
| 162 | </tr> |
| 163 | |
| 164 | <tr> |
| 165 | <td>Nexus S</td> |
| 166 | <td>4.0.4</td> |
| 167 | <td>IMM76D</td> |
| 168 | <td>44100</td> |
| 169 | <td>1024</td> |
| 170 | <td>23.2</td> |
| 171 | <td>260</td> |
| 172 | </tr> |
| 173 | |
| 174 | <tr> |
| 175 | <td>Nexus S</td> |
| 176 | <td>4.1.2</td> |
| 177 | <td>JZO54K</td> |
| 178 | <td>44100</td> |
| 179 | <td>880</td> |
| 180 | <td>20</td> |
| 181 | <td>210</td> |
| 182 | </tr> |
| 183 | |
| 184 | <tr> |
| 185 | <td>Galaxy Nexus</td> |
| 186 | <td>4.0.1</td> |
| 187 | <td>ITL41D</td> |
| 188 | <td>44100</td> |
| 189 | <td>976</td> |
| 190 | <td>22.1</td> |
| 191 | <td>270</td> |
| 192 | </tr> |
| 193 | |
| 194 | <tr> |
| 195 | <td>Galaxy Nexus</td> |
| 196 | <td>4.3</td> |
| 197 | <td>JWR66Y</td> |
| 198 | <td>44100</td> |
| 199 | <td>144</td> |
| 200 | <td>3.3</td> |
| 201 | <td>130</td> |
| 202 | </tr> |
| 203 | |
| 204 | <tr> |
| 205 | <td>Nexus 4</td> |
| 206 | <td>4.2.2</td> |
| 207 | <td>JDQ39E</td> |
| 208 | <td>48000</td> |
| 209 | <td>240</td> |
| 210 | <td>5</td> |
| 211 | <td>195</td> |
| 212 | </tr> |
| 213 | |
| 214 | <tr> |
| 215 | <td>Nexus 4</td> |
| 216 | <td>5.1</td> |
Glenn Kasten | 501d162 | 2015-04-17 11:00:15 -0700 | [diff] [blame] | 217 | <td>LMY47O</td> |
Glenn Kasten | f3902ab | 2015-03-30 11:57:14 -0700 | [diff] [blame] | 218 | <td>48000</td> |
| 219 | <td>240</td> |
| 220 | <td>5</td> |
| 221 | <td>58</td> |
| 222 | </tr> |
| 223 | |
| 224 | <tr> |
| 225 | <td>Nexus 10</td> |
| 226 | <td>5.0.2</td> |
| 227 | <td>LRX22G</td> |
| 228 | <td>44100</td> |
| 229 | <td>256</td> |
| 230 | <td>5.8</td> |
| 231 | <td>36</td> |
| 232 | </tr> |
| 233 | |
| 234 | <tr> |
| 235 | <td>Nexus 10</td> |
| 236 | <td>5.1</td> |
| 237 | <td>LMY47D</td> |
| 238 | <td>44100</td> |
| 239 | <td>256</td> |
| 240 | <td>5.8</td> |
| 241 | <td>35</td> |
| 242 | </tr> |
| 243 | |
| 244 | <tr> |
| 245 | <td>Nexus 7<br />2013</td> |
| 246 | <td>4.3</td> |
| 247 | <td>JSR78D</td> |
| 248 | <td>48000</td> |
| 249 | <td>240</td> |
| 250 | <td>5</td> |
| 251 | <td>149</td> |
| 252 | </tr> |
| 253 | |
| 254 | <tr> |
| 255 | <td>Nexus 7<br />2013</td> |
| 256 | <td>4.4</td> |
| 257 | <td>KRT16S</td> |
| 258 | <td>48000</td> |
| 259 | <td>240</td> |
| 260 | <td>5</td> |
| 261 | <td>85</td> |
| 262 | </tr> |
| 263 | |
| 264 | <tr> |
| 265 | <td>Nexus 7<br />2013</td> |
| 266 | <td>5.0.2</td> |
| 267 | <td>LRX22G</td> |
| 268 | <td>48000</td> |
| 269 | <td>240</td> |
| 270 | <td>5</td> |
| 271 | <td>64</td> |
| 272 | </tr> |
| 273 | |
| 274 | <tr> |
| 275 | <td>Nexus 7<br />2013</td> |
Glenn Kasten | 501d162 | 2015-04-17 11:00:15 -0700 | [diff] [blame] | 276 | <td>5.1</td> |
| 277 | <td>LMY47O</td> |
Glenn Kasten | f3902ab | 2015-03-30 11:57:14 -0700 | [diff] [blame] | 278 | <td>48000</td> |
| 279 | <td>240</td> |
| 280 | <td>5</td> |
| 281 | <td>55</td> |
| 282 | </tr> |
| 283 | |
| 284 | <tr> |
| 285 | <td>Nexus 5</td> |
| 286 | <td>4.4.4</td> |
| 287 | <td>KTU84P</td> |
| 288 | <td>48000</td> |
| 289 | <td>240</td> |
| 290 | <td>5</td> |
| 291 | <td>95</td> |
| 292 | </tr> |
| 293 | |
| 294 | <tr> |
| 295 | <td>Nexus 5</td> |
Glenn Kasten | 501d162 | 2015-04-17 11:00:15 -0700 | [diff] [blame] | 296 | <td>5.0.0</td> |
Glenn Kasten | f3902ab | 2015-03-30 11:57:14 -0700 | [diff] [blame] | 297 | <td>LRX21O</td> |
| 298 | <td>48000</td> |
| 299 | <td>240</td> |
| 300 | <td>5</td> |
| 301 | <td>47</td> |
| 302 | </tr> |
| 303 | |
| 304 | <tr> |
| 305 | <td>Nexus 5</td> |
| 306 | <td>5.1</td> |
Glenn Kasten | 501d162 | 2015-04-17 11:00:15 -0700 | [diff] [blame] | 307 | <td>LMY47I</td> |
Glenn Kasten | f3902ab | 2015-03-30 11:57:14 -0700 | [diff] [blame] | 308 | <td>48000</td> |
| 309 | <td>240</td> |
| 310 | <td>5</td> |
| 311 | <td>42</td> |
| 312 | </tr> |
| 313 | |
| 314 | <tr> |
| 315 | <td>Nexus 9</td> |
| 316 | <td>5.0.0</td> |
| 317 | <td>LRX21L</td> |
| 318 | <td>48000</td> |
| 319 | <td>256</td> |
| 320 | <td>5.3</td> |
| 321 | <td>35</td> |
| 322 | </tr> |
| 323 | |
| 324 | <tr> |
| 325 | <td>Nexus 9</td> |
| 326 | <td>5.0.1</td> |
| 327 | <td>LRX22C</td> |
| 328 | <td>48000</td> |
| 329 | <td>256</td> |
| 330 | <td>5.3</td> |
| 331 | <td>38</td> |
| 332 | </tr> |
| 333 | |
Glenn Kasten | ae83aab | 2015-05-12 08:15:10 -0700 | [diff] [blame^] | 334 | </tr> |
| 335 | <td>Nexus 9</td> |
| 336 | <td>5.1.1</td> |
| 337 | <td>LMY47X</td> |
| 338 | <td>48000</td> |
| 339 | <td>256</td> |
| 340 | <td>5.3</td> |
| 341 | <td>32</td> |
| 342 | </tr> |
| 343 | |
Glenn Kasten | f3902ab | 2015-03-30 11:57:14 -0700 | [diff] [blame] | 344 | <tr> |
Glenn Kasten | f3902ab | 2015-03-30 11:57:14 -0700 | [diff] [blame] | 345 | <td>Nexus 6</td> |
| 346 | <td>5.0.1</td> |
| 347 | <td>LRX22C</td> |
| 348 | <td>48000</td> |
| 349 | <td>240</td> |
| 350 | <td>5</td> |
| 351 | <td>65</td> |
| 352 | </tr> |
| 353 | |
| 354 | <tr> |
| 355 | <td>Nexus 6</td> |
| 356 | <td>5.1</td> |
| 357 | <td>LMY47I</td> |
| 358 | <td>48000</td> |
| 359 | <td>240</td> |
| 360 | <td>5</td> |
| 361 | <td>42</td> |
| 362 | </tr> |
| 363 | |
| 364 | </table> |
| 365 | |
| 366 | <img src="images/round_trip_bar_graph.png" alt="Round-trip latency bar graph" id="figure3" /> |
| 367 | <p class="img-caption"> |
| 368 | <strong>Figure 3.</strong> Round-trip latency bar graph |
| 369 | </p> |