2013-03-10

Attaching a USB sound card to the Raspberry Pi

Since my Raspberry Pi runs headless, and the analog audio output is not that great, I decided to add a USB sound card to my little machine. I took a Roland UA-1G, which I was using before on an OpenWRT machine. The device was immediately recognized:
Bus 001 Device 007: ID 0582:00ea Roland Corp.
However, ALSA will prohibit the card from becoming sound device #0, thus being the default. For that you have to comment out the following line in /etc/modprobe.d/alsa-base.conf:
# Keep snd-usb-audio from beeing loaded as first soundcard
#options snd-usb-audio index=-2
After rebooting or restarting ALSA, the Roland will become the default sound device:
$ aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: UA1G [UA-1G], device 0: USB Audio [USB Audio]
  Subdevices: 0/1
  Subdevice #0: subdevice #0
card 1: ALSA [bcm2835 ALSA], device 0: bcm2835 ALSA [bcm2835 ALSA]
  Subdevices: 7/8
  Subdevice #0: subdevice #0
  Subdevice #1: subdevice #1
  Subdevice #2: subdevice #2
  Subdevice #3: subdevice #3
  Subdevice #4: subdevice #4
  Subdevice #5: subdevice #5
  Subdevice #6: subdevice #6
  Subdevice #7: subdevice #7

2 comments:

  1. Can you share the rest of your alsa-base.conf file.

    I am looking to do something similar.
    I want the plugged in USB audio to be the default when plugged in but revert back to the Broadcom when not plugged in.

    ReplyDelete
  2. It's Debian's (or Raspbian for that matter) default alsa-base.conf. If you lost yours, you can have a look at the deb package over at the Raspbian repository: http://archive.raspbian.org/raspbian/pool/main/a/alsa-base/

    As to how to achieve your dynamic sound card order goal -- I don't know. Best to ask over at http://raspberrypi.stackexchange.com, or the official Raspberry forums.

    ReplyDelete