1 <html devsite> 2 <head> 3 <title>Building Audio Accessories</title> 4 <meta name="project_path" value="/_project.yaml" /> 5 <meta name="book_path" value="/_book.yaml" /> 6 </head> 7 <body> 8 <!-- 9 Copyright 2017 The Android Open Source Project 10 11 Licensed under the Apache License, Version 2.0 (the "License"); 12 you may not use this file except in compliance with the License. 13 You may obtain a copy of the License at 14 15 http://www.apache.org/licenses/LICENSE-2.0 16 17 Unless required by applicable law or agreed to in writing, software 18 distributed under the License is distributed on an "AS IS" BASIS, 19 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 20 See the License for the specific language governing permissions and 21 limitations under the License. 22 --> 23 24 25 26 <p>When implementing an audio accessory such as a headset, headphone amplifier, 27 microphone, DAC/ADC, or dock, consider how the accessory connects to Android 28 devices. The following sections describe wired 3.5 mm headset connections, 29 Universal Serial Bus (USB) connections, and Bluetooth connections for streaming 30 music or other audio content.</p> 31 32 <h2 id="audio-over-35mm">Audio over 3.5 mm headset connector</h2> 33 <p>Many Android devices include a 3.5 mm (“mini”) headset connector. 34 In addition to traditional stereo output and mono input features, the 35 <a href="headset/plug-headset-spec.html">3.5 mm headset specification</a> 36 defines standard impedances and functions that enable interoperability between 37 a range of Android devices and headsets.</p> 38 39 <h2 id="audio-over-usb">Audio over USB</h2> 40 <p>Android can use USB in several modes:</p> 41 <ul> 42 <li><strong>Development</strong>. Does not support audio. </li> 43 <li><strong>Accessory</strong>. Provided by Android Open Accessory (AOA) 2.0 44 and provides limited audio capability, as described in 45 <a href="custom.html#audio-over-usb">Connecting custom audio over USB</a>. 46 </li> 47 <li><strong>Host</strong>. Enables the Android device to drive the USB bus 48 and operate with a wide range of USB-based peripherals, including audio 49 interfaces. Devices that implement host mode will be compatible with USB 50 headsets that follow the 51 <a href="/devices/accessories/headset/usb-headset-spec.html">USB 52 headset specification</a>. 53 Host mode audio is described in 54 <a href="/devices/audio/usb.html">USB Digital Audio</a>. 55 </ul> 56 57 <h2 id="audio-over-bluetooth">Audio over Bluetooth</h2> 58 <p>An accessory that connects with Android over Bluetooth can use an Advanced 59 Audio Distribution Profile (A2DP) connection to stream music for playback. Playing 60 audio over Bluetooth with A2DP is supported on Android 1.5 (API Level 3) and 61 higher. An Android user can connect to an accessory that supports this profile 62 using the system Settings > Bluetooth and play music directly to the 63 accessory without a secondary application.</p> 64 65 <p>As of Android 3.0 (API Level 11), applications can operate an A2DP connection 66 using the 67 <a href="http://developer.android.com/reference/android/bluetooth/BluetoothA2dp.html"> 68 <code>BluetoothA2dp</code></a> class. To provide a custom application for 69 output to an audio accessory, you must use Android 3.0 or higher. 70 </p> 71 72 <h3 id="next-steps_1">Next steps</h3> 73 <p>To get started building an audio accessory that uses a Bluetooth connection: 74 </p> 75 <ul> 76 <li>Select a hardware platform or build a hardware device that can support 77 Bluetooth communications and the A2DP connection profile.</li> 78 <li>Review the ADK 2012 79 <a href="http://developer.android.com/tools/adk/adk2.html#src-download">firmware 80 source code</a> (<code><adk-src>/adk2012/board/library/ADK2/</code>), 81 which includes an example implementation of an audio playback accessory using 82 a Bluetooth connection.</li> 83 </ul> 84 85 <p class="note"><strong>Note:</strong> The ADK 2012 source code includes an open 86 source Bluetooth stack built for the Texas Instruments CC2564 chip, but is 87 designed to work with any Bluetooth chip that implements a standard 88 Host/Controller Interface (HCI).</p> 89 90 <h2 id="midi-over-usb">MIDI over USB and Bluetooth LE</h2> 91 <p>Both USB and Bluetooth Low Energy can be used as transports for the 92 <a href="http://en.wikipedia.org/wiki/MIDI">MIDI</a> protocol. For details, see 93 <a href="/devices/audio/midi.html">MIDI</a>.</p> 94 95 </body> 96 </html> 97