Home | History | Annotate | Download | only in accessories
      1 page.title=Building Audio Accessories
      2 @jd:body
      3 
      4 <!--
      5     Copyright 2015 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>When implementing an audio accessory such as a headset, headphone amplifier,
     28 microphone, DAC/ADC, or dock, consider how the accessory connects to Android
     29 devices. The following sections describe wired 3.5 mm headset connections,
     30 Universal Serial Bus (USB) connections, and Bluetooth connections for streaming
     31 music or other audio content.</p>
     32 
     33 <h2 id="audio-over-35mm">Audio over 3.5 mm headset connector</h2>
     34 <p>Many Android devices include a 3.5 mm (&#8220;mini&#8221;) headset connector.
     35 In addition to traditional stereo output and mono input features, the
     36 <a href="headset/specification.html">Wired audio headset specification</a>
     37 defines standard impedances and functions that enable interoperability between
     38 a range of Android devices and headsets.</p>
     39 
     40 <h2 id="audio-over-usb">Audio over USB</h2>
     41 <p>Android can use USB in several modes:</p>
     42   <ul>
     43     <li><strong>Development</strong>. Does not support audio. </li>
     44     <li><strong>Accessory</strong>. Provided by Android Open Accessory (AOA) 2.0
     45     and provides limited audio capability, as described in
     46     <a href="custom.html#audio-over-usb">Connecting custom audio over USB</a>.
     47     </li>
     48     <li><strong>Host</strong>. Enables the Android device to drive the USB bus
     49     and operate with a wide range of USB-based peripherals, including audio
     50     interfaces. Host mode audio is described in
     51     <a href="{@docRoot}devices/audio/usb.html">USB Digital Audio</a>.</li>
     52   </ul>
     53 
     54 <h2 id="audio-over-bluetooth">Audio over Bluetooth</h2>
     55 <p>An accessory that connects with Android over Bluetooth can use an Advanced
     56 Audio Distribution Profile (A2DP) connection stream music for playback. Playing
     57 audio over a Bluetooth with A2DP is supported on Android 1.5 (API Level 3) and
     58 higher. An Android user can connect to an accessory that supports this profile
     59 using the system Settings &gt; Bluetooth and play music directly to the
     60 accessory without a secondary application.</p>
     61 
     62 <p>As of Android 3.0 (API Level 11), applications can operate an A2DP connection
     63 using the
     64 <a href="http://developer.android.com/reference/android/bluetooth/BluetoothA2dp.html">
     65 <code>BluetoothA2dp</code></a> class. To provide a custom application for
     66 output to an audio accessory, you must use Android 3.0 or higher.
     67 </p>
     68 
     69 <h3 id="next-steps_1">Next steps</h3>
     70 <p>To get started building an audio accessory that uses a Bluetooth connection:
     71 </p>
     72 <ul>
     73 <li>Select a hardware platform or build an hardware device that can support
     74 Bluetooth communications and the A2DP connection profile.</li>
     75 <li>Review the ADK 2012
     76   <a href="http://developer.android.com/tools/adk/adk2.html#src-download">firmware
     77   source code</a> (<code>&lt;adk-src&gt;/adk2012/board/library/ADK2/</code>),
     78   which includes an example implementation of an audio playback accessory using
     79   a Bluetooth connection.</li>
     80 </ul>
     81 
     82 <p class="note"><strong>Note:</strong> The ADK 2012 source code includes an open
     83 source Bluetooth stack built for the Texas Instruments CC2564 chip, but is
     84 designed to work with any Bluetooth chip that implements a standard
     85 Host/Controller Interface (HCI).</p>
     86 
     87 <h2 id="midi-over-usb">MIDI over USB and Bluetooth LE</h2>
     88 <p>Both USB and Bluetooth Low Energy can be used as transports for the
     89 <a href="http://en.wikipedia.org/wiki/MIDI">MIDI</a> protocol. For details, see
     90 <a href="{@docRoot}devices/audio/midi.html">MIDI</a>.</p>