1## 5.4\. Audio Recording 2 3While some of the requirements outlined in this section are listed as SHOULD 4since Android 4.3, the Compatibility Definition for future versions are planned 5to change these to MUST. Existing and new Android devices are **STRONGLY 6RECOMMENDED** to meet these requirements that are listed as SHOULD, or they 7will not be able to attain Android compatibility when upgraded to the future 8version. 9 10### 5.4.1\. Raw Audio Capture and Microphone Information 11 12If device implementations declare `android.hardware.microphone`, they: 13 14* [C-1-1] MUST allow capture of raw audio content with the following 15characteristics: 16 17 * **Format**: Linear PCM, 16-bit 18 * **Sampling rates**: 8000, 11025, 16000, 44100, 48000 Hz 19 * **Channels**: Mono 20 21* SHOULD allow capture of raw audio content with the following 22characteristics: 23 * **Format**: Linear PCM, 16-bit and 24-bit 24 * **Sampling rates**: 8000, 11025, 16000, 22050, 24000, 32000, 44100, 25 48000 Hz 26 * **Channels**: As many channels as the number of microphones on the 27 device 28 29* [C-1-2] MUST capture at above sample rates without up-sampling. 30* [C-1-3] MUST include an appropriate anti-aliasing filter when the 31sample rates given above are captured with down-sampling. 32* SHOULD allow AM radio and DVD quality capture of raw audio content, which 33means the following characteristics: 34 35 * **Format**: Linear PCM, 16-bit 36 * **Sampling rates**: 22050, 48000 Hz 37 * **Channels**: Stereo 38* [C-1-4] MUST honor the [`MicrophoneInfo`]( 39 https://developer.android.com/reference/android/media/MicrophoneInfo) API 40 and properly fill in information for the available microphones on device 41 accessible to the third-party applications via the 42 [`AudioManager.getMicrophones()`]( 43 https://developer.android.com/reference/android/media/AudioManager#getMicrophones%28%29) 44 API, and the currently active microphones which are accessible to the third 45 party applications via the [`AudioRecord.getActiveMicrophones()`]( 46 https://developer.android.com/reference/android/media/AudioRecord#getActiveMicrophones%28%29) 47 and [`MediaRecorder.getActiveMicrophones()`](https://developer.android.com/reference/android/media/MediaRecorder#getActiveMicrophones%28%29) 48 APIs. 49If device implementations allow AM radio and DVD quality capture of raw audio 50content, they: 51 52* [C-2-1] MUST capture without up-sampling at any ratio higher 53than 16000:22050 or 44100:48000. 54* [C-2-2] MUST include an appropriate anti-aliasing filter for any 55up-sampling or down-sampling. 56 57### 5.4.2\. Capture for Voice Recognition 58 59If device implementations declare `android.hardware.microphone`, they: 60 61* [C-1-1] MUST capture 62 `android.media.MediaRecorder.AudioSource.VOICE_RECOGNITION` audio source at 63 one of the sampling rates, 44100 and 48000. 64* [C-1-2] MUST, by default, disable any noise reduction audio processing when 65 recording an audio stream from the `AudioSource.VOICE_RECOGNITION` audio 66 source. 67* [C-1-3] MUST, by default, disable any automatic gain control when recording 68 an audio stream from the `AudioSource.VOICE_RECOGNITION` audio source. 69* SHOULD record the voice recognition audio stream with approximately flat 70 amplitude versus frequency characteristics: specifically, ±3 dB, from 100 Hz 71 to 4000 Hz. 72* SHOULD record the voice recognition audio stream with input sensitivity set 73 such that a 90 dB sound power level (SPL) source at 1000 Hz yields RMS of 74 2500 for 16-bit samples. 75* SHOULD record the voice recognition audio stream so that the PCM amplitude 76 levels linearly track input SPL changes over at least a 30 dB range from -18 77 dB to +12 dB re 90 dB SPL at the microphone. 78* SHOULD record the voice recognition audio stream with total harmonic 79 distortion (THD) less than 1% for 1 kHz at 90 dB SPL input level at the 80 microphone. 81 82If device implementations declare `android.hardware.microphone` and noise 83suppression (reduction) technologies tuned for speech recognition, they: 84 85* [C-2-1] MUST allow this audio effect to be controllable with the 86 `android.media.audiofx.NoiseSuppressor` API. 87* [C-2-2] MUST uniquely identify each noise suppression technology 88 implementation via the `AudioEffect.Descriptor.uuid` field. 89 90### 5.4.3\. Capture for Rerouting of Playback 91 92The `android.media.MediaRecorder.AudioSource` class includes the `REMOTE_SUBMIX` 93audio source. 94 95If device implementations declare both `android.hardware.audio.output` and 96`android.hardware.microphone`, they: 97 98* [C-1-1] MUST properly implement the `REMOTE_SUBMIX` audio source so that 99when an application uses the `android.media.AudioRecord` API to record from this 100audio source, it captures a mix of all audio streams except for the following: 101 102 * `AudioManager.STREAM_RING` 103 * `AudioManager.STREAM_ALARM` 104 * `AudioManager.STREAM_NOTIFICATION` 105 106### 5.4.4\. Acoustic Echo Canceler 107 108If device implementations declare `android.hardware.microphone`, they: 109 110* SHOULD implement an [Acoustic Echo Canceler](https://en.wikipedia.org/wiki/Echo_suppression_and_cancellation) 111(AEC) technology tuned for voice communication and applied to the capture path 112when capturing using `AudioSource.VOICE_COMMUNICATION` 113 114If device implementations provides an Acoustic Echo Canceler which is 115inserted in the capture audio path when `AudioSource.VOICE_COMMUNICATION` 116is selected, they: 117 118* [C-SR] are STRONGLY_RECOMMENDED to declare this via [AcousticEchoCanceler](https://developer.android.com/reference/android/media/audiofx/AcousticEchoCanceler) 119API method [AcousticEchoCanceler.isAvailable()](https://developer.android.com/reference/android/media/audiofx/AcousticEchoCanceler.html#isAvailable()) 120* [C-SR] are STRONGLY_RECOMMENDED to allow this audio effect to be 121controllable with the [AcousticEchoCanceler](https://developer.android.com/reference/android/media/audiofx/AcousticEchoCanceler) 122API. 123* [C-SR] are STRONGLY_RECOMMENDED to uniquely identify each AEC technology 124implementation via the [AudioEffect.Descriptor.uuid](https://developer.android.com/reference/android/media/audiofx/AudioEffect.Descriptor.html#uuid) 125field. 126 127### 5.4.5\. Concurrent Capture 128 129If device implementations declare `android.hardware.microphone`,they MUST 130implement concurrent capture as described in [this document]( 131https://developer.android.com/features/sharing-audio-input). Specifically: 132 133* [C-1-1] MUST allow concurrent access to microphone by an accessibility 134 service capturing with `AudioSource.VOICE_RECOGNITION` and at least one 135 application capturing with any `AudioSource`. 136* [C-1-2] MUST allow concurrent access to microphone by a pre-installed 137 application that holds an Assistant role and at least one application 138 capturing with any `AudioSource` except for 139 `AudioSource.VOICE_COMMUNICATION` or `AudioSource.CAMCORDER`. 140* [C-1-3] MUST silence the audio capture for any other application, except for 141 an accessibility service, while an application is capturing with 142 `AudioSource.VOICE_COMMUNICATION` or `AudioSource.CAMCORDER`. However, when 143 an app is capturing via `AudioSource.VOICE_COMMUNICATION` then another app 144 can capture the voice call if it is a privileged (pre-installed) app with 145 permission `CAPTURE_AUDIO_OUTPUT`. 146* [C-1-4] If two or more applications are capturing concurrently and if 147 neither app has an UI on top, the one that started capture the most recently 148 receives audio. 149 150### 5.4.6\. Microphone Gain Levels 151 152If device implementations declare `android.hardware.microphone`, they: 153 154* SHOULD exhibit approximately flat amplitude-versus-frequency 155 characteristics in the mid-frequency range: specifically ±3dB from 100 156 Hz to 4000 Hz for each and every microphone used to record the voice 157 recognition audio source. 158* SHOULD set audio input sensitivity such that a 1000 Hz sinusoidal 159 tone source played at 90 dB Sound Pressure Level (SPL) yields a response 160 with RMS of 2500 for 16 bit-samples (or -22.35 dB Full Scale for floating 161 point/double precision samples) for each and every microphone used to 162 record the voice recognition audio source. 163* [C-SR] are STRONGLY RECOMMENDED to exhibit amplitude levels in the low 164 frequency range: specifically from ±20 dB from 5 Hz to 100 Hz compared 165 to the mid-frequency range for each and every microphone used to record 166 the voice recognition audio source. 167* [C-SR] are STRONGLY RECOMMENDED to exhibit amplitude levels in the 168 high frequency range: specifically from ±30 dB from 4000 Hz to 22 KHz 169 compared to the mid-frequency range for each and every microphone used 170 to record the voice recognition audio source. 171