Android Tablets Forum banner

USB audio cards support (drivers and libs)

53K views 32 replies 11 participants last post by  ciuffoly 
#1 · (Edited by Moderator)
As my idea was installing NOVO7 in the car instead of stereo, i need quality audio support.

So, there it is. I compiled drivers and libraries with mod, which supports not only HDMI, but also USB audio output.

Output mode controlled by property "media.audio.out.mode". values are: codec, hdmi, usb.

For enable USB sound card, copy files to device, and add this to init.sun4i.rc:

Code:
<br />
# USB Audio<br />
	insmod /drv/snd-hwdep.ko<br />
	insmod /drv/snd-rawmidi.ko<br />
	insmod /drv/snd-usbmidi-lib.ko<br />
	insmod /drv/snd-usb-audio.ko<br />
After installing drivers (note the order!) and connecting any USB audio card, you'll probably find new devices in /dev/snd.

So, now you can use it with NOVO7. Just set "media.audio.out.mode" to "usb" via init.sun4i.rc.

I do it automatically via Tasker app on AC power ON, and switch back to "codec" on AC power OFF.

Here is the archive with all files.

p.s. Only issue i found is poor performance with connected 3G Modem at the same time, but it's related to Allwinners USB host kernel implementation itself.

p.p.s. Fogot to mention libs are for 2.3.4 firmwares, based on released source, IE 2.0.3. Tested with Feiyu MOD from 25th January.
 
See less See more
#4 ·
Tasker can run any shell scripts via "Locale Execute Plugin" (and natively, but on Novo 7 it doesn't detect root mode yet). You can install it from Market, it's free (only plugin needed for Tasker). So, I use Plugin - > Execute with "@! setprop media.audio.out.mode codec" as configuration on AC off, and "@! setprop media.audio.out.mode usb" on AC on.
 
#7 ·
Hi, great work! Shame I dont have an Ainol Novo 7 Advanced, but I do have a Novo 8 Adv. Is it possible to modify libs in Ainol Novo 8 to get this working? libaudio.so dont have any prop called media.audio.out.mode like yours. I got working ALSA with aplay - l showing my USB DAC (Fiio E10) with proper modules but can´t route Android audio to the DAC, I tried to change card 0 to 1 in alsa.conf w/out success. I really appreciate your help, As far as I know you are the only dev who could make this work with 2 different devices, Wits and Ainol Novo 7 Adv. Thanks!
 
#8 · (Edited by Moderator)
Hi! As I know, kernel for NOVO8 is public, but android source is not. So, it's hard to change libs there (we need source to make changes). But, in NOVO8 exist FULL alsa support, so, you can route audio via /system/etc/asound.conf. Every line is meaningful, so, if you make mistake, whole file will be discarded by OS and some failsafe defaults will apply. I made working one on WITS only after some time and faults. Try to understand logcat on boot (alsa lines), and on playback start (which Playback stream is in use). try to set default in asound.conf

Code:
pcm.?default { type hw card 1 }
and playback stream

Code:
<br />
pcm.AndroidPlayback {<br />
   type hw<br />
   card 1<br />
   device 0<br />
}<br />
The last effort is to inspect libaudio.so in HEX redactor, finding there /dev/snd/pcmC0D0p and change it to /dev/snd/pcmC1D0p (or /dev/snd/pcmC2D0p) if you have HDMI and your DAC is 3rd card. One byte change is enough ;-) So, it will always try to stream audio to USB DAC, and you will have no sound if there is no USB card connected ;-) You don't need to change /dev/snd/pcmC0D0c - it's probably internal MIC, and /dev/snd/ctlC0D0p - it's mixer control of internal sound card.

I'm sure it will work 99.9%, but you need to make changes in overwrite mode, so result lib will have exact size as original one. Have fun ;-)
 
#9 ·
Hi Tsynik,

Could you please submit the missing USB audio code to Google (i.e. jbqueru)?

Thanks!

"
@jbqueru [Software Engineer working on Android Open-Source at Google]
Any plan to review the well-starred issue 24614 Enable USB Audio?
http://bit.ly/zH0t9R
USB DAC should be standard Android devices.

@DanielBa78 If someone submits code to implement that feature, it'll eventually get looked at."
https://twitter.com/#!/jbqueru
 
#10 · (Edited by Moderator)
Hi Tsynik,

Could you please submit the missing USB audio code to Google (i.e. jbqueru)?

Thanks!
Hm, there are no special code for support USB sound devices in Android itself. It's all in Hardware Abstraction Layer, so it's always device specific.
We just need 3 base things: 1st: USB Host support in Android kernel. 2nd. USB audio driver, in kernel, or compiled as a module. 3rd. Some logic to switch to USB audio card, or back to internal one. So, it can be checkbox in Android preferences, or automatic switching via init.rc and it's on-device-added events. Last thing is your choise, you can set it in many ways (as it's controlled by property change, or, on other devices, by asound.conf rules), but it's not universal yet.
 
#14 ·
Hi,

Reading your posts with regard to USB, I was wondering whether you have any ideas on the following:

Does the Novo 7 Paladin support USB host mode?

If so does it need to be enabled in the kernel and how can this be done?

I ask because I would like to be able to send and receive serial data (AT commands) to a serial cable plugged into the mini usb port.

Any advice would be gratefully appreciated.

Thanks

Ian James
 
#15 ·
If you can use 3G dongles or USB sticks on Paladin, then it have USB host mode. For AT commands on USB port you need CDC ACM support in kernel, which depends on USB HOST but different. Or some kind of serial converter and it's driver like pl2303. That's all i can say. And this thread is about USB audio, make new one in Paladin forum if you want some hints )
 
#16 · (Edited by Moderator)
@tsynik

How about the Sound Quality of your USB audio rig?

Is it at the same level than the USB audio SQ from a (average) PC?

I am quite surprised about the occasional crackles and glitches from the USB audio-capable Archos G9:
http://forum.archosfans.com/viewtopic.php?f=85&p=393834

"(1) USB audio playback shows some glitches (for example, during network access, harddisk access, high CPU load). I even observed some pitching under CPU load. But it generally works, best performance is with local file access. As expected, audio quality via external DAC is a lot better than the internal headphone connector (which - to my ears - sounds remarkably bad, even my old Nokia phone sounds significantly better)."

"(1) USB PCM2902 based DIY design (this is a standard USB chip used in many products):
This is a self powered device, and works immediately. Quality issues are as mentioned in my previous post (crackles and glitches). These occur very frequently, so this is not really what you want when you'd like to enjoy your audiophile HD FLAC files."

"(3) Creative X-Fi USB:
This is USB bus powered, and does not work when directly connected to the tablet. You need to connected via self-powered USB hub, then the USB link is established, and playback changes to the external DAC. Volume control is not active, so you need to use the tablet's volume control. Playback is occasionally interrupted by some nasty noise, USB link is lost (LED on X-Fi goes off), then it gets re-connected, and playback can be resumed. When it's stable then I still get crackles and glitches occasionally, like with the PCM2902."

By the way, what are the other components of your rig?

Thanks
 
#18 ·
@tsynik

How about the Sound Quality of your USB audio rig?

Is it at the same level than the USB audio SQ from a (average) PC?

I am quite surprised about the occasional crackles and glitches from the USB audio-capable Archos G9:
http://forum.archosfans.com/viewtopic.php?f=85&p=393834

[skip]

By the way, what are the other components of your rig?

Thanks
Hi, I don't have any glitches with my DAC setup. I used Creative SB Live 24 USB before, but switched to Burr-Brown PCM2704 USB DAC (Chinese MUSE). It have USB 2.0 interface (Creative have 1.1), and there is no pump sound to external amplifier in my car on power on with it.

Craclies often related to USB hub / host / driver implementation. For example, current allwinner USB Host driver in Android 2.3 doesn't work fine with USB DAC and 3G modem, working in the same USB Hub. There are errors of USB transmission in dmesg and sound goes choppy when 3G connection works. Also, I have some crackles, when my 3D screensawer switched on and off, or on load Navigation software, probably it's related to interrupts or screen rendering. And i has no sound issues at all on Android 2.2 with omap4 tab and same DAC before.
 
#20 · (Edited by Moderator)
Hi

This looks interesting.

Would it be possible to use these files to get A USB headset (with microphone) working with the novo7a ?

The headset presently shows up when plugged into the tablet, however it doesn't do anything except allow the tablet volume to be adjusted.

I'm just wondering if it's possible to get both reasonable sound and the microphone working for use with skype etc.

thanks
saanichtonian
 
#21 ·
Hi Tsynik,

"Francisco Franco - News are not so great at the moment. I've been trying to find out why this doesn't work with the correct SND USB Audio activated in the kernel, the device doesn't even recognize this device...doesn't even appear as a card via the ALSA driver..."
https://plus.google.com/u/0/106873500108976028532/posts/3fb1yDEawb2

Francisco Franco is trying to enable USB audio on his kernel-modded Android 4.0 ICS powered Galaxy Nexus.
His Galaxy Nexus doesn't recognize a battery-powered USB DAC/amp FiiO E7.
What could be the problem?
Thanks!
 
#22 · (Edited by Moderator)
"Francisco Franco - News are not so great at the moment. I've been trying to find out why this doesn't work with the correct SND USB Audio activated in the kernel, the device doesn't even recognize this device...doesn't even appear as a card via the ALSA driver..."
https://plus.google.com/u/0/106873500108976028532/posts/3fb1yDEawb2

Francisco Franco is trying to enable USB audio on his kernel-modded Android 4.0 ICS powered Galaxy Nexus.
His Galaxy Nexus doesn't recognize a battery-powered USB DAC/amp FiiO E7.
What could be the problem?
Thanks!
Hm, if there is no device nodes in /dev/snd/ then it's 100% kernel configuraion problem. Something is missing in it's options. Also, order of modules loading does matter. He need to check dmesg output on loading modules, and try to load them by hand from shell. After it have correct devices in /dev/snd/, he can go furhter to android part (alsa HAL).
 
#29 · (Edited by Moderator)
Hi Цыник!
I plan to do the same as you'd mention use Novo 7/8 AdvanceII to stream loos-less audio .flacs to external DAC for HiEnd Audio in the CAR.
I am looking for cheepest tablet but good asynchronous DAC to do the job.

1) Can you mention what tablet models you tried it and it works? what was the model of OMAP4 you mentioned?
2) What was Max streaming resolution 24bit/96khz?
3) Do you know Was that mode USB Audio asynchronous(when DAC controls the timing and rates) - less chances of jitters
or
synchronous when player device(tablet) just streams data to DAC according to internal not perfect USB timing - more jitters as'd reported introdced due to some other tablet activities?
4)What DACs you'd tried besides PCM2704, FiiO E7(someone else reported working) and Creative ?
5)Do you know new ICS on Novo Advanced II or other tablets have the same (need of manual tweeking) or better out of the box support of USB Audio?

Заранее спасибо!
Igor'
 
#30 · (Edited by Moderator)
I was playing with DACs integration to Android from Android 2.2 era, when it was almost not possible at all, and it was all about a hack. My goal was to have lossless player in my car, and Wits A81G (omap4 platform) was the first tablet, which do the job. I'm quite happy with my PCM2704 DAC in the car, it overplay Creative devices, and suite my needs (I have no flacs at 24bit resolution). 500GB HDD and 16bit 44100 flacs on it (driven by PowerAMP) is enough for me. I don't go further. You can look into DrDac NANO, as it have strong output (2-4V), suited for external AMP, and supports 24bit/96 also. But, it's also a question of OS. Android, even in ICS, not goes to USB audio path, so its still hard to find any products with external USB audio support. I added it by myself, changing alsa libs for Allwinner A10 platform (2.3, ICS). So, for now, any A10 device (as it's opensource arch now) can support USB audio with some mods. But, it now limited to 16bit/44100/48000 PCM (can be extended to any more, but who nedd this? ;-) Feel free to ask your questionsin Russian on PCCAR forum ;-)

Hyundai A7HD have Cm9 usb-audio supported firmware. And many others.

p.s. probably almost any synchronous USB DAC will work, as it uses standart usb-audio driver for linux. Don't know, how about others. If it have driver for linux 3.0 kernel, probably it will be possible to make it work also.
 
#33 ·
I have a GT90H tablet

I use these command to add modules:

cd /sdcard/Download

mount -o rw,remount -t yaffs2 /system

cp snd-hwdep.ko /system/vendor/modules/snd-hwdep.ko

chmod 0644 /system/vendor/modules/snd-hwdep.ko

insmod /system/vendor/modules/snd-hwdep.ko

but the insmod does not run and I received the error "exec format error"
 
This is an older thread, you may not receive a response, and could be reviving an old thread. Please consider creating a new thread.
Top