1 ## 5.6\. Audio Latency 2 3 Audio latency is the time delay as an audio signal passes through a system. 4 Many classes of applications rely on short latencies, to achieve real-time 5 sound effects. 6 7 For the purposes of this section, use the following definitions: 8 9 * **output latency**. The interval between when an application writes a frame 10 of PCM-coded data and when the corresponding sound is presented to environment 11 at an on-device transducer or signal leaves the device via a port and can be 12 observed externally. 13 * **cold output latency**. The output latency for the first frame, when the 14 audio output system has been idle and powered down prior to the request. 15 * **continuous output latency**. The output latency for subsequent frames, 16 after the device is playing audio. 17 * **input latency**. The interval between when a sound is presented by 18 environment to device at an on-device transducer or signal enters the device via 19 a port and when an application reads the corresponding frame of PCM-coded data. 20 * **lost input**. The initial portion of an input signal that is unusable or 21 unavailable. 22 * **cold input latency**. The sum of lost input time and the input latency 23 for the first frame, when the audio input system has been idle and powered down 24 prior to the request. 25 * **continuous input latency**. The input latency for subsequent frames, 26 while the device is capturing audio. 27 * **cold output jitter**. The variability among separate measurements of cold 28 output latency values. 29 * **cold input jitter**. The variability among separate measurements of cold 30 input latency values. 31 * **continuous round-trip latency**. The sum of continuous input latency plus 32 continuous output latency plus one buffer period. The buffer period allows 33 time for the app to process the signal and time for the app to mitigate phase 34 difference between input and output streams. 35 * **OpenSL ES PCM buffer queue API**. The set of PCM-related 36 [OpenSL ES](https://developer.android.com/ndk/guides/audio/opensl/index.html) 37 APIs within [Android NDK](https://developer.android.com/ndk/index.html). 38 * **AAudio native audio API**. The set of 39 [AAudio](https://developer.android.com/ndk/guides/audio/aaudio/aaudio.html) APIs 40 within [Android NDK](https://developer.android.com/ndk/index.html). 41 42 If device implementations declare `android.hardware.audio.output` they are 43 STRONGLY RECOMMENDED to meet or exceed the following requirements: 44 45 * [SR] Cold output latency of 100 milliseconds or less 46 * [SR] Continuous output latency of 45 milliseconds or less 47 * [SR] Minimize the cold output jitter 48 49 If device implementations meet the above requirements after any initial 50 calibration when using the OpenSL ES PCM buffer queue API, for continuous output 51 latency and cold output latency over at least one supported audio output device, 52 they are: 53 54 * [SR] STRONGLY RECOMMENDED to report low latency audio by declaring 55 `android.hardware.audio.low_latency` feature flag. 56 * [SR] STRONGLY RECOMMENDED to also meet the requirements for low-latency 57 audio via the AAudio API. 58 59 If device implementations do not meet the requirements for low-latency audio 60 via the OpenSL ES PCM buffer queue API, they: 61 62 * [C-1-1] MUST NOT report support for low-latency audio. 63 64 If device implementations include `android.hardware.microphone`, they are 65 STRONGLY RECOMMENDED to meet these input audio requirements: 66 67 * [SR] Cold input latency of 100 milliseconds or less 68 * [SR] Continuous input latency of 30 milliseconds or less 69 * [SR] Continuous round-trip latency of 50 milliseconds or less 70 * [SR] Minimize the cold input jitter