As most of you know, a lot of Android devices have a poor track record of USB DAC support. Two solutions to this problem currently exist:
- Phones with native USB audio support in the kernel. In theory, this is great. However, USB audio is not part of the Android CTS (compatibility test suite) so many (even most) manufacturers do not implement it. USB audio support often requires the use of kernel hacks and doesn't work at all with many devices. Additionally, DAC compatibility isn't great, either. Android devices aren't even required to have USB host!
- Using an app like USB Audio Recorder PRO. This is an okay solution and DAC compatibility seems to be good. The major issue is that playback only works on one app - USB Audio Recorder Pro. And it also requires USB host support on the kernel side.
Since Android 4.1, most Android devices have supported the Android Accessory Development Kit (ADK) revision 2. The ADK version 2 contains a PCM output mode (16-bit 44.1 KHz), which allows devices to act as a standard USB audio mixer that allows recording from the device. Since Android devices are required to support the ADK, this would mean that, theoretically, most Android 4.1 devices should work this way. In Linux, once put into "audio" mode, the Android phone or tablet starts to act like a standard USB sound card and you can grab the raw PCM stream from it just like any sound card. This method is also very well integrated into Android - the ADK makes the Android device act as a USB slave, not host, volume control is relegated to the host device, phone output on phones is still through the phone speakers while media output is done through the ADK protocol, and so on.
So an idea hit me: desktop Linux has great USB audio support, Android has poor USB audio support. Android can output a PCM signal to desktop Linux fairly reliably. Why not build a device that acts like a "gateway" between the Android phone and the DAC?
Since desktop Linux has very well-established USB audio drivers for playback and recording from the Android device, I chose it as a platform. Running my LibUSB code, I am able to turn most Android 4.1+ devices into a USB sound card capable of recording when connected to a standard PC running Ubuntu. How am I going to make this "portable" while still requiring something running desktop Linux? I'm going to use small, inexpensive single-board computers that run full Linux distributions (the most famous of which is the Raspberry Pi).
It's important that I have a working prototype that successfully converts the Android 44.1 KHz 16-bit PCM and outputs it to a sound card, but it requires a PC. I've yet to find a portable ARM board that works, but I've only tested a few devices. Here is a diagram of what it will look like:
My current working rig has a computer in place of the Raspberry Pi. Of course this is not "portable."
Current hardware candidates:
- x86-64 PC. Works great, but it's not portable enough.
- Raspberry Pi Model B (~$40) (kind of works, but unlistenable - awful bad USB issues for now prevent recording from the Android device. Tried the RaspyFi distribution on the latest firmware update)
- Testing the Cubieboard next (~$65) - have one on order and it should come in next week.
Hardware constraints: Small, relatively inexpensive, solid USB controller with at least two ports, supports modern desktop Linux. Unfortunately, Raspberry Pi, while my first choice, meets every one of these requirements except for solid USB controller, making it unsuitable for this project.
Let me know what you think.
Edited by tninety - 11/30/13 at 2:55am