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