[[["เข้าใจง่าย","easyToUnderstand","thumb-up"],["แก้ปัญหาของฉันได้","solvedMyProblem","thumb-up"],["อื่นๆ","otherUp","thumb-up"]],[["ไม่มีข้อมูลที่ฉันต้องการ","missingTheInformationINeed","thumb-down"],["ซับซ้อนเกินไป/มีหลายขั้นตอนมากเกินไป","tooComplicatedTooManySteps","thumb-down"],["ล้าสมัย","outOfDate","thumb-down"],["ปัญหาเกี่ยวกับการแปล","translationIssue","thumb-down"],["ตัวอย่าง/ปัญหาเกี่ยวกับโค้ด","samplesCodeIssue","thumb-down"],["อื่นๆ","otherDown","thumb-down"]],["อัปเดตล่าสุด 2025-06-12 UTC"],[],[],null,["# Configure preprocessing effects\n\nThe Android 10 release includes the following\nrequirements for capture with `VOICE_COMMUNICATION`.\n\n- Implementations should provide an acoustic echo canceler (AEC) on the capture path when capturing with `VOICE_COMMUNICATION`.\n- If providing an AEC, it must be discoverable and controllable through the SDK API's `AcousticEchoCanceler`.\n\nThe Android platform provides audio effects on supported devices in the\n[`audiofx`](http://developer.android.com/reference/android/media/audiofx/package-summary.html) package, which is available for developers to access.\nFor example, the Nexus 10 supports the following preprocessing effects:\n\n- [Acoustic\n Echo Cancellation](http://developer.android.com/reference/android/media/audiofx/AcousticEchoCanceler.html)\n- [Automatic Gain Control](http://developer.android.com/reference/android/media/audiofx/AutomaticGainControl.html)\n- [Noise\n Suppression](http://developer.android.com/reference/android/media/audiofx/NoiseSuppressor.html)\n\nPair with AudioSource instances\n-------------------------------\n\nPreprocessing effects are paired with the use case mode in which the\npreprocessing is requested. In Android app development, a use case is referred\nto as an `AudioSource` instance; and app developers request to use the\n`AudioSource` abstraction instead of the actual audio hardware\ndevice. The Android Audio Policy Manager maps an `AudioSource` instance to a\ngiven capture path configuration (including device, gain, and pre processing) according\nto product-specific rules. The following sources are exposed to developers:\n\n- `android.media.MediaRecorder.AudioSource.CAMCORDER`\n- `android.media.MediaRecorder.AudioSource.VOICE_COMMUNICATION`\n- `android.media.MediaRecorder.AudioSource.VOICE_CALL`\n- `android.media.MediaRecorder.AudioSource.VOICE_DOWNLINK`\n- `android.media.MediaRecorder.AudioSource.VOICE_UPLINK`\n- `android.media.MediaRecorder.AudioSource.VOICE_RECOGNITION`\n- `android.media.MediaRecorder.AudioSource.MIC`\n- `android.media.MediaRecorder.AudioSource.DEFAULT`\n\nThe default preprocessing effects applied for each `AudioSource` instance\nare specified in the `/vendor/etc/audio_effects.xml` file. To\nspecify your own default effects for every `AudioSource` instance, create a\n`/vendor/etc/audio_effects.xml` file and specify the\npreprocessing effects to turn on. For an example, see the implementation for\nthe Nexus 10 in `device/samsung/manta/audio_effects.xml`.\n`AudioEffect` instances acquire and release a session when created and destroyed,\nenabling the effects (such as the Loudness Enhancer) to persist throughout the\nsession.\n| **Warning:** For the `VOICE_RECOGNITION` use case, don't enable the noise suppression preprocessing effect. It shouldn't be turned on by default when recording from this audio source, and you shouldn't enable it in your own `audio_effects.xml` file. Turning on the effect by default causes the device to fail the [compatibility requirement](/docs/compatibility) regardless of whether this was on by default due to the configuration file, or the audio HAL implementation's default behavior.\n\nThe following example enables preprocessing for the VoIP\n`AudioSource` and Camcorder `AudioSource` instances. By declaring\nthe `AudioSource` configuration in this manner, the framework\nautomatically requests the use of those effects from the HAL. \n\n```carbon\n\u003cpreprocess\u003e\n \u003cstream type=\"voice_communication\"\u003e\n \u003capply effect=\"aec\"/\u003e\n \u003capply effect=\"ns\"/\u003e\n \u003c/stream\u003e\n \u003cstream type=\"camcorder\"\u003e\n \u003capply effect=\"agc\"/\u003e\n \u003c/stream\u003e\n \u003c/preprocess\u003e\n```\n\nSource tuning\n-------------\n\n`AudioSource` tuning doesn't have explicit requirements on audio\ngain or audio processing with the exception of voice recognition\n(`VOICE_RECOGNITION`). Requirements for voice recognition include:\n\n- Flat frequency response (+/- 3 dB) from 100 Hz to 4 kHz\n- Close-talk config: 90 dB SPL reads RMS of 2500 (16 bit samples)\n- Level tracks linearly from -18 dB to +12 dB relative to 90 dB SPL\n- THD \\\u003c 1% (90 dB SPL in 100 to 4000 Hz range)\n- Near-ultrasound requirements (for testing, see [Near Ultrasound\n Tests](/docs/compatibility/cts/near-ultrasound)):\n - Support for `SUPPORT_PROPERTY_MIC_NEAR_ULTRASOUND` as defined in section 7.8.3 of the CDD.\n - Support for one or both of 44100 or 48000 sampling rates with no band-pass or antialiasing filters.\n- Effects/preprocessing disabled by default\n\nExamples of tuning different effects for different sources are:\n\n- Noise Suppressor\n - Tuned for wind noise suppressor for `CAMCORDER`\n - Tuned for stationary noise suppressor for `VOICE_COMMUNICATION`\n- Automatic Gain Control\n - Tuned for close-talk for `VOICE_COMMUNICATION` and main phone mic\n - Tuned for far-talk for `CAMCORDER`\n\nResources\n---------\n\nFor more information, refer to the following resources:\n\n- Android documentation for [audiofx\n package](http://developer.android.com/reference/android/media/audiofx/package-summary.html)\n- Android documentation for [Noise\n Suppression audio effect](http://developer.android.com/reference/android/media/audiofx/NoiseSuppressor.html)\n- `/device/google/crosshatch/audio_effects.xml` file for the Pixel 3"]]