1## 5.10\. Professional Audio
2
3If device implementations report support for feature
4`android.hardware.audio.pro` via the
5[android.content.pm.PackageManager](
6http://developer.android.com/reference/android/content/pm/PackageManager.html)
7class, they:
8
9*    [C-1-1] MUST report support for feature
10`android.hardware.audio.low_latency`.
11*    [C-1-2] MUST have the continuous round-trip audio latency, as defined in
12[section 5.6 Audio Latency](#5_6_audio_latency), MUST be 20 milliseconds or less and SHOULD be
1310 milliseconds or less over at least one supported path.
14*    [C-1-3] MUST include a USB port(s) supporting USB host mode and USB
15peripheral mode.
16*    [C-1-4] MUST report support for feature `android.software.midi`.
17*    [C-1-5] MUST meet latencies and USB audio requirements using both the
18[OpenSL ES](https://developer.android.com/ndk/guides/audio/opensl-for-android.html)
19PCM buffer queue API and at least one path of the [AAudio native audio](https://developer.android.com/ndk/guides/audio/aaudio/aaudio.html)
20API.
21*    [SR] Are STRONGLY RECOMMENDED to meet latencies and USB audio requirements
22using the [AAudio native audio](https://developer.android.com/ndk/guides/audio/aaudio/aaudio.html)
23API over the [MMAP path](https://source.android.com/devices/audio/aaudio).
24*    [C-1-6] MUST have Cold output latency of 200 milliseconds or less.
25*    [C-1-7] MUST have Cold input latency of 200 milliseconds or less.
26*    [SR] Are STRONGLY RECOMMENDED to provide a consistent level of CPU
27performance while audio is active and CPU load is varying. This should be tested
28using the Android app version of [SynthMark](https://github.com/google/synthmark)
29commit id [09b13c6f49ea089f8c31e5d035f912cc405b7ab8](https://github.com/google/synthmark/commit/09b13c6f49ea089f8c31e5d035f912cc405b7ab8).
30SynthMark uses a software synthesizer running on a simulated audio framework
31that measures system performance. The SynthMark app needs to be run using the
32“Automated Test” option and achieve the following results:
33    * voicemark.90 >= 32 voices
34    * latencymark.fixed.little <= 15 msec
35    * latencymark.dynamic.little <= 50 msec
36
37See the SynthMark [documentation](https://github.com/google/synthmark/blob/master/docs/README.md)
38for an explanation of the benchmarks.
39
40*    SHOULD minimize audio clock inaccuracy and drift relative to standard time.
41*    SHOULD minimize audio clock drift relative to the CPU `CLOCK_MONOTONIC`
42when both are active.
43*    SHOULD minimize audio latency over on-device transducers.
44*    SHOULD minimize audio latency over USB digital audio.
45*    SHOULD document audio latency measurements over all paths.
46*    SHOULD minimize jitter in audio buffer completion callback entry times, as this
47affects usable percentage of full CPU bandwidth by the callback.
48*    SHOULD provide zero audio glitches under normal use at reported latency.
49*    SHOULD provide zero inter-channel latency difference.
50*    SHOULD minimize MIDI mean latency over all transports.
51*    SHOULD minimize MIDI latency variability under load (jitter) over all transports.
52*    SHOULD provide accurate MIDI timestamps over all transports.
53*    SHOULD minimize audio signal noise over on-device transducers, including the
54period immediately after cold start.
55*    SHOULD provide zero audio clock difference between the input and output sides of
56corresponding end-points, when both are active. Examples of corresponding
57end-points include the on-device microphone and speaker, or the audio jack input
58and output.
59*    SHOULD handle audio buffer completion callbacks for the input and output sides
60of corresponding end-points on the same thread when both are active, and enter
61the output callback immediately after the return from the input callback.  Or
62if it is not feasible to handle the callbacks on the same thread, then enter the
63output callback shortly after entering the input callback to permit the
64application to have a consistent timing of the input and output sides.
65*    SHOULD minimize the phase difference between HAL audio buffering for the input
66and output sides of corresponding end-points.
67*    SHOULD minimize touch latency.
68*    SHOULD minimize touch latency variability under load (jitter).
69*    SHOULD have a latency from touch input to audio output of less than or
70equal to 40 ms.
71
72If device implementations meet all of the above requirements, they:
73
74*   [SR] STRONGLY RECOMMENDED to report support for feature
75`android.hardware.audio.pro` via the [`android.content.pm.PackageManager`](
76http://developer.android.com/reference/android/content/pm/PackageManager.html)
77class.
78
79If device implementations include a 4 conductor 3.5mm audio jack, they:
80
81*   [C-2-1] MUST have the continuous round-trip audio latency to be 20
82milliseconds or less over the audio jack path.
83*   [SR] STRONGLY RECOMMENDED to comply with
84section [Mobile device (jack) specifications](
85https://source.android.com/devices/accessories/headset/jack-headset-spec)
86of the [Wired Audio Headset Specification (v1.1)](
87https://source.android.com/devices/accessories/headset/plug-headset-spec).
88*   The continuous round-trip audio latency SHOULD be 10 milliseconds
89or less over the audio jack path.
90
91If device implementations omit a 4 conductor 3.5mm audio jack and
92include a USB port(s) supporting USB host mode, they:
93
94*   [C-3-1] MUST implement the USB audio class.
95*   [C-3-2] MUST have a continuous round-trip audio latency of 20
96milliseconds or less over the USB host mode port using USB audio class.
97*   The continuous round-trip audio latency SHOULD be 10 milliseconds
98or less over the USB host mode port using USB audio class.
99*   [C-SR] Are STRONGLY RECOMMENDED to support simultaneous I/O up to 8 channels
100    each direction, 96 kHz sample rate, and 24-bit or 32-bit depth, when used
101    with USB audio peripherals that also support these requirements.
102
103If device implementations include an HDMI port, they:
104
105*   SHOULD support output in stereo and eight channels at 20-bit or
10624-bit depth and 192 kHz without bit-depth loss or resampling,
107in at least one configuration.
108