Mulai 27 Maret 2025, sebaiknya gunakan android-latest-release, bukan aosp-main, untuk mem-build dan berkontribusi pada AOSP. Untuk mengetahui informasi selengkapnya, lihat Perubahan pada AOSP.
Tetap teratur dengan koleksi
Simpan dan kategorikan konten berdasarkan preferensi Anda.
Rilis Android 10 menyertakan persyaratan
berikut untuk pengambilan dengan VOICE_COMMUNICATION.
Implementasi harus menyediakan pengurangan gema akustik (AEC) di jalur pengambilan saat
mengambil dengan VOICE_COMMUNICATION.
Jika menyediakan AEC, AEC tersebut harus dapat ditemukan dan dikontrol melalui
AcousticEchoCanceler SDK API.
Platform Android menyediakan efek audio di perangkat yang didukung dalam
paket
audiofx, yang tersedia untuk diakses oleh developer.
Misalnya, Nexus 10 mendukung efek prapemrosesan berikut:
Efek prapemrosesan disambungkan dengan mode kasus penggunaan tempat
prapemrosesan diminta. Dalam pengembangan aplikasi Android, kasus penggunaan disebut
sebagai instance AudioSource; dan developer aplikasi meminta untuk menggunakan
abstraksi AudioSource, bukan perangkat hardware
audio yang sebenarnya. Android Audio Policy Manager memetakan instance AudioSource ke
konfigurasi jalur pengambilan tertentu (termasuk perangkat, gain, dan prapemrosesan) sesuai
dengan aturan khusus produk. Sumber berikut ditampilkan kepada developer:
Efek prapemrosesan default yang diterapkan untuk setiap instance AudioSource
ditentukan dalam file /vendor/etc/audio_effects.xml. Untuk
menentukan efek default Anda sendiri untuk setiap instance AudioSource, buat
file /vendor/etc/audio_effects.xml dan tentukan
efek prapemrosesan yang akan diaktifkan. Misalnya, lihat implementasi untuk
Nexus 10 di device/samsung/manta/audio_effects.xml.
Instance AudioEffect memperoleh dan merilis sesi saat dibuat dan dihancurkan,
sehingga efek (seperti Loudness Enhancer) dapat dipertahankan selama
sesi.
Contoh berikut mengaktifkan prapemrosesan untuk instance AudioSource
VoIP dan AudioSource Camcorder. Dengan mendeklarasikan
konfigurasi AudioSource dengan cara ini, framework
otomatis meminta penggunaan efek tersebut dari HAL.
Penyesuaian AudioSource tidak memiliki persyaratan eksplisit pada penguatan
audio atau pemrosesan audio, kecuali pengenalan suara
(VOICE_RECOGNITION). Persyaratan untuk pengenalan suara mencakup:
Respons frekuensi datar (+/- 3 dB) dari 100 Hz hingga 4 kHz
File /device/google/crosshatch/audio_effects.xml untuk Pixel 3
Konten dan contoh kode di halaman ini tunduk kepada lisensi yang dijelaskan dalam Lisensi Konten. Java dan OpenJDK adalah merek dagang atau merek dagang terdaftar dari Oracle dan/atau afiliasinya.
Terakhir diperbarui pada 2025-06-12 UTC.
[[["Mudah dipahami","easyToUnderstand","thumb-up"],["Memecahkan masalah saya","solvedMyProblem","thumb-up"],["Lainnya","otherUp","thumb-up"]],[["Informasi yang saya butuhkan tidak ada","missingTheInformationINeed","thumb-down"],["Terlalu rumit/langkahnya terlalu banyak","tooComplicatedTooManySteps","thumb-down"],["Sudah usang","outOfDate","thumb-down"],["Masalah terjemahan","translationIssue","thumb-down"],["Masalah kode / contoh","samplesCodeIssue","thumb-down"],["Lainnya","otherDown","thumb-down"]],["Terakhir diperbarui pada 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"]]