Wednesday, July 21, 2010

» Getting USB speakers working in Gnome +

So I just got a set of Insignia USB speakers (NS-2908). Wanted to use them as my default speakers, but still have the option of using the internal sound card. Got it working and thought someone else might find it useful. This assumes you're using a new-ish version of gnome.

You'll want to set the Internal Audio profile to "Off" in the pulseaudio volume control application, under the Configuration tab.

You'll want to edit the preferences of the volume control applet to point to the correct default device and channel.

Next part is the tricky part.

You'll want to run:

cat /proc/asound/cards

Find the number of your USB speakers. In my case, it's card 2:

 2 [default        ]: USB-Audio - USB Audio DAC   
Burr-Brown from TI USB Audio DAC at usb-0000:00:04.0-6 [...]

Now you'll need to edit the gconf keys gnome uses to set the mixer device for youe multimedia keys (yes, when you have fancy volume buttons on your speakers that trigger the mm keys, you want it to work!). So in my case I want to default submixer of the second alsa device:

gconftool-2 --set -t string /desktop/gnome/sound/default_mixer_device 'alsamixer:hw:2'

And I want only the PCM channel to be controlled (you may want Master, or Front, or multiple channels):

gconftool-2 --set -t list --list-type=string /desktop/gnome/sound/default_mixer_tracks '[PCM]'

The cool thing about this, is that it falls back to the default device. So when the USB speakers are unplugged and I'm using the internal sound card, it still Just Works with the mm keys on my keyboard. Nice.

And for good measure, I threw this in my ~/.asoundrc:

pcm.!default front:default

You'll need to look at the output of aplay -L to get the right values for your speakers. Or, if you have pulseaudio set up as your default device, you can just skip this step.


Labels: , ,


Anonymous djib said...

THANK YOU! I had no idea how to change what channel multimedia keys were controlling and it has really driven me crazy recently. Thanks.
August 29, 2010 at 5:18 AM


Post a Comment

<< Home