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.
Membuat aksesori audio
Tetap teratur dengan koleksi
Simpan dan kategorikan konten berdasarkan preferensi Anda.
Saat menerapkan aksesori audio seperti headset, amplifier headphone,
mikrofon, DAC/ADC, atau dok, pertimbangkan cara aksesori terhubung ke perangkat
Android. Bagian berikut menjelaskan koneksi headset berkabel 3,5 mm,
koneksi Universal Serial Bus (USB), dan koneksi Bluetooth untuk streaming
musik atau konten audio lainnya.
Audio melalui konektor headset 3,5 mm
Banyak perangkat Android menyertakan konektor headset 3,5 mm (“mini”).
Selain fitur output stereo dan input mono tradisional,
spesifikasi headset 3,5 mm
menentukan impedansi dan fungsi standar yang memungkinkan interoperabilitas antara
berbagai perangkat dan headset Android.
Audio melalui USB
Android dapat menggunakan USB dalam beberapa mode:
- Pengembangan. Tidak mendukung audio.
- Aksesori. Disediakan oleh Android Open Accessory (AOA) 2.0
dan memberikan kemampuan audio terbatas, seperti yang dijelaskan dalam
Menghubungkan audio kustom melalui USB.
- Host. Memungkinkan perangkat Android untuk menggerakkan bus USB
dan beroperasi dengan berbagai periferal berbasis USB, termasuk antarmuka
audio. Perangkat yang menerapkan mode host akan kompatibel dengan headset
USB yang mengikuti
spesifikasi
headset USB.
Audio mode host dijelaskan dalam
Audio digital USB.
Audio melalui Bluetooth
Aksesori yang terhubung dengan Android melalui Bluetooth dapat menggunakan koneksi Advanced
Audio Distribution Profile (A2DP) untuk melakukan streaming musik untuk diputar. Memutar
audio melalui Bluetooth dengan A2DP didukung di Android 1.5 (API Level 3) dan
yang lebih tinggi. Pengguna Android dapat terhubung ke aksesori yang mendukung profil ini
menggunakan Setelan sistem > Bluetooth dan memutar musik langsung ke
aksesori tanpa aplikasi sekunder.
Mulai Android 3.0 (API Level 11), aplikasi dapat mengoperasikan koneksi A2DP
menggunakan
class
BluetoothA2dp
. Untuk menyediakan aplikasi kustom untuk
output ke aksesori audio, Anda harus menggunakan Android 3.0 atau yang lebih tinggi.
Langkah berikutnya
Untuk mulai mem-build aksesori audio yang menggunakan koneksi Bluetooth:
- Pilih platform hardware atau buat perangkat hardware yang dapat mendukung
komunikasi Bluetooth dan profil koneksi A2DP.
- Tinjau kode sumber
firmware (
<adk-src>/adk2012/board/library/ADK2/
) ADK 2012,
yang menyertakan contoh implementasi aksesori pemutaran audio menggunakan
koneksi Bluetooth.
Catatan: Kode sumber ADK 2012 menyertakan stack
Bluetooth open source yang dibuat untuk chip Texas Instruments CC2564, tetapi
dirancang untuk berfungsi dengan chip Bluetooth apa pun yang mengimplementasikan Host/Controller Interface (HCI)
standar.
MIDI melalui USB dan Bluetooth LE
USB dan Bluetooth Hemat Energi dapat digunakan sebagai transpor untuk
protokol MIDI. Untuk mengetahui detailnya, lihat
MIDI.
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-07-27 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-07-27 UTC."],[],[],null,["# Build audio accessories\n\nWhen implementing an audio accessory such as a headset, headphone amplifier,\nmicrophone, DAC/ADC, or dock, consider how the accessory connects to Android\ndevices. The following sections describe wired 3.5 mm headset connections,\nUniversal Serial Bus (USB) connections, and Bluetooth connections for streaming\nmusic or other audio content.\n\nAudio over 3.5 mm headset connector\n-----------------------------------\n\nMany Android devices include a 3.5 mm (\"mini\") headset connector.\nIn addition to traditional stereo output and mono input features, the\n[3.5 mm headset specification](/docs/core/interaction/accessories/headset/plug-headset-spec)\ndefines standard impedances and functions that enable interoperability between\na range of Android devices and headsets.\n\nAudio over USB\n--------------\n\nAndroid can use USB in several modes:\n\n- **Development**. Does not support audio.\n- **Accessory** . Provided by Android Open Accessory (AOA) 2.0 and provides limited audio capability, as described in [Connecting custom audio over USB](/docs/core/interaction/accessories/custom#audio-over-usb).\n- **Host** . Enables the Android device to drive the USB bus and operate with a wide range of USB-based peripherals, including audio interfaces. Devices that implement host mode will be compatible with USB headsets that follow the [USB\n headset specification](/docs/core/interaction/accessories/headset/usb-headset-spec). Host mode audio is described in [USB digital audio](/docs/core/audio/usb).\n\nAudio over Bluetooth\n--------------------\n\nAn accessory that connects with Android over Bluetooth can use an Advanced\nAudio Distribution Profile (A2DP) connection to stream music for playback. Playing\naudio over Bluetooth with A2DP is supported on Android 1.5 (API Level 3) and\nhigher. An Android user can connect to an accessory that supports this profile\nusing the system Settings \\\u003e Bluetooth and play music directly to the\naccessory without a secondary application.\n\nAs of Android 3.0 (API Level 11), applications can operate an A2DP connection\nusing the\n[`BluetoothA2dp`](http://developer.android.com/reference/android/bluetooth/BluetoothA2dp.html) class. To provide a custom application for\noutput to an audio accessory, you must use Android 3.0 or higher.\n\n### Next steps\n\nTo get started building an audio accessory that uses a Bluetooth connection:\n\n- Select a hardware platform or build a hardware device that can support Bluetooth communications and the A2DP connection profile.\n- Review the ADK 2012 [firmware\n source code](http://developer.android.com/tools/adk/adk2.html#src-download) (`\u003cadk-src\u003e/adk2012/board/library/ADK2/`), which includes an example implementation of an audio playback accessory using a Bluetooth connection.\n\n**Note:** The ADK 2012 source code includes an open\nsource Bluetooth stack built for the Texas Instruments CC2564 chip, but is\ndesigned to work with any Bluetooth chip that implements a standard\nHost/Controller Interface (HCI).\n\nMIDI over USB and Bluetooth LE\n------------------------------\n\nBoth USB and Bluetooth Low Energy can be used as transports for the\n[MIDI](http://en.wikipedia.org/wiki/MIDI) protocol. For details, see\n[MIDI](/docs/core/audio/midi)."]]