How can I automatically switch to USB headset when plugged in?

This is actually a bug in Pulseaudio.

Here is a recent bug report on the situation, but it might be a dupe of this older (but reportedly fixed) one.

Here's a workaround that you could possibly use. Create a text file and paste this in:

#! /bin/bash

amixer cset iface=MIXER,name='Input Source' 1
amixer cset iface=MIXER,name='Output Source' 1
exit

If it is fact your third one then you should replace the end numbers on the commands with the number '2'. If fourth, then '3'. And so on.

You can then make a launcher on the panel and click on it every time you plug in the headset. It's an ugly workaround for now but until it is fixed (i.e. Pulseaudio remembers preferred devices) I don't see much else you can do.

You could do some extreme crazy workaround involving writing udev rules.... but is it worth it? ;)


I found the answer here: http://crunchbang.org/forums/viewtopic.php?pid=114968

You can do either one of two things (or both):

open alsamixer using the command line:

alsamixer

and then press F6 and select the default device for alsa. Once you've done that, save the alsa settings:

sudo alsactl store

It may also be necessary to edit the alsa configuration file: (/etc/modprobe.d/alsabase.conf). You then place a '0' next to the device you want as your default, so if it's a usb sound device, you'll have a line like this:

options snd-usb-audio index=0

Then reboot system.