1page.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>
28This article gives round-trip audio latency measurements for select devices and
29platform 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>
36is an important system performance metric. There are many kinds
37of <a href="latency.html">audio latency</a>
38metrics.  One useful and well-understood metric is
39<a href="latency_measure.html#measuringRoundTrip">round-trip latency</a>.
40Round-trip latency is defined as the time it takes for
41an audio signal to enter the input of a mobile device, be processed
42by 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>
53We measure and report latency so Android
54app developers will have the data they need to make informed decisions about available
55latency on actual devices.  By sharing these numbers for select Nexus devices, we also hope to
56encourage the entire Android community to measure, publish, and reduce
57latency on <i>all</i> devices.
58Please join us in our commitment to reducing audio latency.
59</p>
60
61<h2 id="app">Application impact on latency</h2>
62
63<p>
64There are two kinds of delays that a signal processing stage can add to latency:
65algorithmic delay and computational delay.
66Algorithmic delay is inherent and does not vary with the CPU.
67An 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.
70Computational delay is related to the number of CPU cycles required.
71For example, attenuation of a signal is usually done by a multiplication operation,
72and 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>
78The measurements below were taken with the
79<a href="loopback.html">Dr. Rick O'Rang audio loopback dongle</a>
80and an
81<a href="latency_measure.html#larsenTest">audio feedback (Larsen effect) test</a>.
82</p>
83
84<p>
85For our measurements, we assume the application signal processing
86adds zero algorithmic delay and near zero computational delay.
87</p>
88
89<p>
90We 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>
110There are cases where on-device microphone and speaker latencies
111<i>do</i>
112matter, but they are usually for one direction, not round-trip.
113Techniques for measuring unidirectional latency are described at
114<a href="latency_measure.html#measuringOutput">Measuring Output Latency</a>
115and
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>
127The measurements shown are specific to a
128<a href="{@docRoot}source/build-numbers.html">build number</a>.
129Devices are listed in approximate order of initial release and within device by platform version.
130The 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 />&plusmn; 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>
217  <td>LMY47O</td>
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>
276  <td>5.1</td>
277  <td>LMY47O</td>
278  <td>48000</td>
279  <td>240</td>
280  <td>5</td>
281  <td>55</td>
282</tr>
283
284<tr>
285  <td>Nexus 7<br />2013</td>
286  <td>6.0</td>
287  <td>MRA58K</td>
288  <td>48000</td>
289  <td>240</td>
290  <td>5</td>
291  <td>55</td>
292</tr>
293
294<tr>
295  <td>Nexus 5</td>
296  <td>4.4.4</td>
297  <td>KTU84P</td>
298  <td>48000</td>
299  <td>240</td>
300  <td>5</td>
301  <td>95</td>
302</tr>
303
304<tr>
305  <td>Nexus 5</td>
306  <td>5.0.0</td>
307  <td>LRX21O</td>
308  <td>48000</td>
309  <td>240</td>
310  <td>5</td>
311  <td>47</td>
312</tr>
313
314<tr>
315  <td>Nexus 5</td>
316  <td>5.1</td>
317  <td>LMY47I</td>
318  <td>48000</td>
319  <td>240</td>
320  <td>5</td>
321  <td>42</td>
322</tr>
323
324<tr>
325  <td>Nexus 5</td>
326  <td>6.0</td>
327  <td>MRA58K</td>
328  <td>48000</td>
329  <td>192</td>
330  <td>4</td>
331  <td>38</td>
332</tr>
333
334<tr>
335  <td>Nexus 9</td>
336  <td>5.0.0</td>
337  <td>LRX21L</td>
338  <td>48000</td>
339  <td>256</td>
340  <td>5.3</td>
341  <td>35</td>
342</tr>
343
344<tr>
345  <td>Nexus 9</td>
346  <td>5.0.1</td>
347  <td>LRX22C</td>
348  <td>48000</td>
349  <td>256</td>
350  <td>5.3</td>
351  <td>38</td>
352</tr>
353
354<tr>
355  <td>Nexus 9</td>
356  <td>5.1.1</td>
357  <td>LMY47X</td>
358  <td>48000</td>
359  <td>256</td>
360  <td>5.3</td>
361  <td>32</td>
362</tr>
363
364<tr>
365  <td>Nexus 9</td>
366  <td>6.0</td>
367  <td>MRA58K</td>
368  <td>48000</td>
369  <td>128</td>
370  <td>2.6</td>
371  <td>15</td>
372</tr>
373
374<tr>
375  <td>Nexus 6</td>
376  <td>5.0.1</td>
377  <td>LRX22C</td>
378  <td>48000</td>
379  <td>240</td>
380  <td>5</td>
381  <td>65</td>
382</tr>
383
384<tr>
385  <td>Nexus 6</td>
386  <td>5.1</td>
387  <td>LMY47I</td>
388  <td>48000</td>
389  <td>240</td>
390  <td>5</td>
391  <td>42</td>
392</tr>
393
394<tr>
395  <td>Nexus 6</td>
396  <td>6.0</td>
397  <td>MRA58K</td>
398  <td>48000</td>
399  <td>192</td>
400  <td>4</td>
401  <td>33</td>
402</tr>
403
404<tr>
405  <td>Nexus 5X</td>
406  <td>6.0</td>
407  <td>MDA89E</td>
408  <td>48000</td>
409  <td>192</td>
410  <td>4</td>
411  <td>18</td>
412</tr>
413
414<tr>
415  <td>Nexus 6P</td>
416  <td>6.0</td>
417  <td>MDA89D</td>
418  <td>48000</td>
419  <td>192</td>
420  <td>4</td>
421  <td>18</td>
422</tr>
423
424</table>
425
426<p></p>
427<p></p>
428
429<script type="text/javascript" src="https://www.google.com/jsapi?autoload={'modules':[{'name':'visualization','version':'1.1','packages':['bar']}]}"></script>
430    <script type="text/javascript">
431
432
433google.setOnLoadCallback(drawChart);
434      function drawChart() {
435        var data = google.visualization.arrayToDataTable([
436        ['Device', '2.3', '4.0', '4.1', '4.2', '4.3', '4.4', '5.0', '5.1', '6.0'],
437        ['Nexus One', 345, null, null, null, null, null, null, null, null,],
438        ['Nexus S', 260, 260, 210, null, null, null, null, null, null,],
439        ['Galaxy Nexus', null, 270, null, null, 130, null, null, null, null,],
440        ['Nexus 4', null, null, null, 195, null, null, null, 58, null,],
441        ['Nexus 10', null, null, null, null, null, null, 36, 35, null,],
442        ['Nexus 7 2013', null, null, null, null, 149, 85, 64, 55, 55,],
443        ['Nexus 5', null, null, null, null, null, 95, 47, 42, 38,],
444        ['Nexus 9', null, null, null, null, null, null, 38, 32, 15,],
445        ['Nexus 6', null, null, null, null, null, null, 65, 42, 33,],
446        ['Nexus 5X', null, null, null, null, null, null, null, null, 18,],
447        ['Nexus 6P', null, null, null, null, null, null, null, null, 18,]
448      ]);
449
450        var options = {
451          chart: {
452            title: 'Round Trip Audio Latency',
453            subtitle: 'Over headset, using native APIs',
454          },
455          bars: 'horizontal', // Required for Material Bar Charts.
456          bar: {groupWidth: '100%'},
457          hAxis: {
458            title: 'Milliseconds'
459          },
460          height: 800,
461          width: 600
462        };
463
464        var chart = new google.charts.Bar(document.getElementById('chart_div'));
465
466        chart.draw(data, google.charts.Bar.convertOptions(options));
467
468      }
469</script>
470
471    <div id="chart_div"></div>
472    <p></p>
473    <p class="img-caption">
474<strong>Figure 3.</strong> Round trip latencies.</p>