O Google tem o compromisso de promover a igualdade racial para as comunidades negras. Saiba como.
Esta página foi traduzida pela API Cloud Translation.
Switch to English

Configurando efeitos de pré-processamento

The Android 10 release includes the following requirements for capture with VOICE_COMMUNICATION.

  • Implementations should provide an acoustic echo canceler (AEC) on the capture path when capturing with VOICE_COMMUNICATION.
  • If providing an AEC, it must be discoverable and controllable through the SDK API's AcousticEchoCanceler.

The Android platform provides audio effects on supported devices in the audiofx package, which is available for developers to access. For example, the Nexus 10 supports the following preprocessing effects:

Pairing with AudioSources

Preprocessing effects are paired with the use case mode in which the preprocessing is requested. In Android app development, a use case is referred to as an AudioSource instance; and app developers request to use the AudioSource abstraction instead of the actual audio hardware device. The Android Audio Policy Manager maps an AudioSource instance to a given capture path configuration (including device, gain, and pre processing) according to product-specific rules. The following sources are exposed to developers:

  • android.media.MediaRecorder.AudioSource.CAMCORDER
  • android.media.MediaRecorder.AudioSource.VOICE_COMMUNICATION
  • android.media.MediaRecorder.AudioSource.VOICE_CALL
  • android.media.MediaRecorder.AudioSource.VOICE_DOWNLINK
  • android.media.MediaRecorder.AudioSource.VOICE_UPLINK
  • android.media.MediaRecorder.AudioSource.VOICE_RECOGNITION
  • android.media.MediaRecorder.AudioSource.MIC
  • android.media.MediaRecorder.AudioSource.DEFAULT

The default preprocessing effects applied for each AudioSource instance are specified in the /vendor/etc/audio_effects.xml file. To specify your own default effects for every AudioSource instance, create a /vendor/etc/audio_effects.xml file and specify the preprocessing effects to turn on. For an example, see the implementation for the Nexus 10 in device/samsung/manta/audio_effects.xml. AudioEffect instances acquire and release a session when created and destroyed, enabling the effects (such as the Loudness Enhancer) to persist throughout the session.

The following example enables preprocessing for the VoIP AudioSource and Camcorder AudioSource instances. By declaring the AudioSource configuration in this manner, the framework automatically requests the use of those effects from the HAL.

        <stream type="voice_communication">
            <apply effect="aec"/>
            <apply effect="ns"/>
        <stream type="camcorder">
            <apply effect="agc"/>

Source tuning

AudioSource tuning doesn't have explicit requirements on audio gain or audio processing with the exception of voice recognition (VOICE_RECOGNITION). Requirements for voice recognition include:

  • Flat frequency response (+/- 3 dB) from 100 Hz to 4 kHz
  • Close-talk config: 90 dB SPL reads RMS of 2500 (16 bit samples)
  • Level tracks linearly from -18 dB to +12 dB relative to 90 dB SPL
  • THD < 1% (90 dB SPL in 100 to 4000 Hz range)
  • Near-ultrasound requirements (for testing, see Near Ultrasound Tests):
    • Support for SUPPORT_PROPERTY_MIC_NEAR_ULTRASOUND as defined in section 7.8.3 of the CDD.
    • Support for one or both of 44100 or 48000 sampling rates with no band-pass or antialiasing filters.
  • Effects/preprocessing disabled by default

Examples of tuning different effects for different sources are:

  • Noise Suppressor
    • Tuned for wind noise suppressor for CAMCORDER
    • Tuned for stationary noise suppressor for VOICE_COMMUNICATION
  • Automatic Gain Control
    • Tuned for close-talk for VOICE_COMMUNICATION and main phone mic
    • Tuned for far-talk for CAMCORDER


For more information, refer to the following resources: