1page.title=Building Audio Accessories 2@jd:body 3 4<!-- 5 Copyright 2014 The Android Open Source Project 6 7 Licensed under the Apache License, Version 2.0 (the "License"); 8 you may not use this file except in compliance with the License. 9 You may obtain a copy of the License at 10 11 http://www.apache.org/licenses/LICENSE-2.0 12 13 Unless required by applicable law or agreed to in writing, software 14 distributed under the License is distributed on an "AS IS" BASIS, 15 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 See the License for the specific language governing permissions and 17 limitations under the License. 18--> 19<div id="qv-wrapper"> 20 <div id="qv"> 21 <h2>In this document</h2> 22 <ol id="auto-toc"> 23 </ol> 24 </div> 25</div> 26 27<p>In implementing an audio accessory, such as a headset, headphone amplifier, 28microphone, DAC/ADC, or dock, you should consider how your accessory will 29connect with Android devices. In particular, you should decide 30if your accessory will use wired a 3.5 mm headset connector, Universal Serial 31Bus (USB), or a Bluetooth connection to stream music or other audio content.</p> 32<h2 id="audio-over-35mm">Audio over 3.5 mm headset connector</h2> 33<p>Many Android-based devices include a 3.5 mm (“mini”) headset connector. In 34addition to the traditional stereo output and mono input features, the <a 35href="headset-spec.html">Wired audio headset specification</a> defines standard 36impedances and functions so a range of Android devices and headsets can inter-operate.</p> 37 38<h2 id="audio-over-usb">Audio over USB</h2> 39<p>Android can use USB in several modes:</p> 40 <ul> 41 <li>debug 42 <li>accessory 43 <li>host 44 </ul> 45<p>In the traditional debug mode, there is no audio capability.</p> 46<p>Accessory mode is provided by the Open Accessory (AOA) protocol version 2.0. 47There is limited audio capability in accessory mode, as described in <a 48href="custom.html#audio-over-usb">Connecting custom audio over USB</a>.</p> 49<p>Host mode enables the Android device to drive the USB bus and operate with a 50wide range of USB-based peripherals, including audio interfaces. Host mode 51audio is described in <a href="{@docRoot}devices/audio_usb.html">USB Digital Audio</a> 52 53<h2 id="audio-over-bluetooth">Audio over Bluetooth</h2> 54<p>An accessory that connects with Android over Bluetooth can use an Advanced Audio Distribution 55Profile (A2DP) connection stream music for playback. Playing audio over a Bluetooth with A2DP is 56supported on Android 1.5 (API Level 3) and higher. An Android user can connect to an accessory 57that supports this profile using the system Settings > Bluetooth and play music directly to the 58accessory without the need for a secondary application.</p> 59<p><strong>Note:</strong> If you want to provide a custom application for output to your audio 60accessory, note that the Android 3.0 (API Level 11) allows applications to operate an A2DP 61connection using the 62<a href="http://developer.android.com/reference/android/bluetooth/BluetoothA2dp.html"><code>BluetoothA2dp</code></a> 63class.</p> 64<h3 id="next-steps_1">Next steps</h3> 65<p>To get started on building an audio accessory that uses a Bluetooth connection:</p> 66<ul> 67<li>Select a hardware platform or build an hardware device that can support Bluetooth 68 communications and the A2DP connection profile.</li> 69<li>Review the ADK 2012 70 <a href="http://developer.android.com/tools/adk/adk2.html#src-download">firmware source code</a> 71 (<code><adk-src>/adk2012/board/library/ADK2/</code>), which includes an example implementation 72 of an audio playback accessory using a Bluetooth connection.</li> 73</ul> 74<p><strong>Note:</strong> The ADK 2012 source code includes an open source Bluetooth stack that 75is built for the Texas Instruments CC2564 chip, but can work with any Bluetooth chip that 76implements a standard Host/Controller Interface (HCI).</p> 77