Found the following information on Joeys blog:

If you’re like me and had to buy a usb sound card since the laptop’s onboard soundcard creates too much noise, and would like to have that card used by default when it’s plugged in, but otherwise have builtin card be used, create an /etc/udev/rules.d/00_local.rules containing:

# Default to using additional (USB) sound cards when they are available.
KERNEL=="pcmC[D0-9cp]*", ACTION=="add", PROGRAM="/bin/sh -c 'K=%k; K=$${K#pcmC}; K=$${K%%D*}; echo defaults.ctl.card $$K > /etc/asound.conf; echo defaults.pcm.card $$K >>/etc/asound.conf'"
KERNEL=="pcmC[D0-9cp]*", ACTION=="remove", PROGRAM="/bin/sh -c 'echo defaults.ctl.card 0 > /etc/asound.conf; echo defaults.pcm.card 0 >>/etc/asound.conf'"

Only programs started after the sound card is plugged in will use it of course, and this might not work if you have it plugged in while booting.

Link

 3/13/2007  Posted by Jord at 19:06 Free software, Stupid rat creatures   Add comments

  One Response to “Usb sound card, alsa and udev”

  1. [...] followed the instructions here to set the default automatically when plugging/unplugging: http://www.jordswart.org/archives/63 Works for me (using Debian [...]