blob: 72c5e1d75b2719fa5962a4d9dadeb1c57ccb1dda [file] [log] [blame]
page.title=Building Audio Accessories
Copyright 2015 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
See the License for the specific language governing permissions and
limitations under the License.
<div id="qv-wrapper">
<div id="qv">
<h2>In this document</h2>
<ol id="auto-toc">
<p>When implementing an audio accessory such as a headset, headphone amplifier,
microphone, DAC/ADC, or dock, consider how the accessory connects to Android
devices. The following sections describe wired 3.5 mm headset connections,
Universal Serial Bus (USB) connections, and Bluetooth connections for streaming
music or other audio content.</p>
<h2 id="audio-over-35mm">Audio over 3.5 mm headset connector</h2>
<p>Many Android devices include a 3.5 mm (&#8220;mini&#8221;) headset connector.
In addition to traditional stereo output and mono input features, the
<a href="headset/specification.html">Wired audio headset specification</a>
defines standard impedances and functions that enable interoperability between
a range of Android devices and headsets.</p>
<h2 id="audio-over-usb">Audio over USB</h2>
<p>Android can use USB in several modes:</p>
<li><strong>Development</strong>. Does not support audio. </li>
<li><strong>Accessory</strong>. Provided by Android Open Accessory (AOA) 2.0
and provides limited audio capability, as described in
<a href="custom.html#audio-over-usb">Connecting custom audio over USB</a>.
<li><strong>Host</strong>. Enables the Android device to drive the USB bus
and operate with a wide range of USB-based peripherals, including audio
interfaces. Host mode audio is described in
<a href="{@docRoot}devices/audio/usb.html">USB Digital Audio</a>.</li>
<h2 id="audio-over-bluetooth">Audio over Bluetooth</h2>
<p>An accessory that connects with Android over Bluetooth can use an Advanced
Audio Distribution Profile (A2DP) connection stream music for playback. Playing
audio over a Bluetooth with A2DP is supported on Android 1.5 (API Level 3) and
higher. An Android user can connect to an accessory that supports this profile
using the system Settings &gt; Bluetooth and play music directly to the
accessory without a secondary application.</p>
<p>As of Android 3.0 (API Level 11), applications can operate an A2DP connection
using the
<a href="">
<code>BluetoothA2dp</code></a> class. To provide a custom application for
output to an audio accessory, you must use Android 3.0 or higher.
<h3 id="next-steps_1">Next steps</h3>
<p>To get started building an audio accessory that uses a Bluetooth connection:
<li>Select a hardware platform or build an hardware device that can support
Bluetooth communications and the A2DP connection profile.</li>
<li>Review the ADK 2012
<a href="">firmware
source code</a> (<code>&lt;adk-src&gt;/adk2012/board/library/ADK2/</code>),
which includes an example implementation of an audio playback accessory using
a Bluetooth connection.</li>
<p class="note"><strong>Note:</strong> The ADK 2012 source code includes an open
source Bluetooth stack built for the Texas Instruments CC2564 chip, but is
designed to work with any Bluetooth chip that implements a standard
Host/Controller Interface (HCI).</p>
<h2 id="midi-over-usb">MIDI over USB and Bluetooth LE</h2>
<p>Both USB and Bluetooth Low Energy can be used as transports for the
<a href="">MIDI</a> protocol. For details, see
<a href="{@docRoot}devices/audio/midi.html">MIDI</a>.</p>