Nuforce μDAC on Linux

..and alsa

Nuforce sells a nice little usb soundcard called uDAC that works quite well on Linux.


Plug it in

Connect the uDAC to your computer, the syslog should show something like this: (note the 'Vendor strings...' part... *ouch*) $ dmesg | grep Vendor
generic-usb 0003:08BB:DA48.0006: input,hidraw4: USB HID v1.00 Device [Vendor strings are placed here. Nuforce µDAC ] on usb-0000:00:1d.7-4.3.1/input2

$ lsusb | grep da48
Bus 002 Device 011: ID 08bb:da48 Texas Instruments Japan

The device should also appear in /proc/asound/cards (if it doesn't: modprobe snd-usb-audio) $ cat /proc/asound/cards
0 [Intel ]: HDA-Intel - HDA Intel
     HDA Intel at 0xfe8f8000 irq 45
    HDA ATI HDMI at 0xfe9fc000 irq 46
2 [default ]: USB-Audio - Nuforce µDAC
    Vendor strings are placed here. Nuforce µDAC at usb-0000:00:1d.7-4.3.1, f

So in my case the μDAC will be card #2 (or hw=2.0 in alsa slang).
You can now use mplayer to thest the μDAC: $ mplayer -ao alsa:device=hw=2,0 foo.flac # note: mplayer uses ',', not '.'

Make it the default

snd-usb-audio is somewhat dumb: The driver does not do any mixing and the volume control doesn't work (this seems to be a hardware feature as this also fails to work on OSX).
But both problems can be solved with dmix and softvol. This is my ~/.asoundrc file: pcm.!default {
   type plug
   slave.pcm "softvol" #make use of softvol

pcm.softvol {
   type softvol
   slave {
      pcm "dmixer" #redirect the output to dmix (instead of "hw:0,0")
   control {
      name "PCM" #override the PCM slider to set the softvol volume level globally
      card 0

pcm.dmixer {
   type dmix
   ipc_key 1025
   slave {
      pcm "hw:2,0"
   bindings {
   0 0
   1 1

ctl.dmixer {
   type hw
   card 2
This configuration routes the default sound device to our virtual softvol device. The (software-)volume control will be handled by the PCM control of Card #0 and all sound goes to the virtual dmix device where the multiplexing is handled.