Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I have an XBMCBuntu installation (based on Ubuntu 11.10), meaning that I don't have a graphical desktop environment installed.

I've connected a set of USB speakers, and for about a minute or two, running pacmd list-sinks yields only one sink: my laptop's onboard sound card.

After about 3 minutes, running the same command yields both the original sound card and the USB speakers, at which point I can run pacmd set-default-sink alsa_output.usb-1130_USB_AUDIO-00-AUDIO.analog-stereo and play sound out of the peripheral speakers.

Unfortunately, the changes brought forth by the pacmd set-default-sink command aren't persistent across reboots. I suspect that this is because pulseaudio falls back on the onboard sound card when it can't detect the USB speakers for those first three minutes. Of course, I'm not really sure that this is the case, but it begs the following questions:

  1. Why does it take so long to detect the speakers; Is there anything I can do to speed things up?
  2. Is there a way of making these changes persistent other than scheduling a cronjob to run pacmd set-default-sink alsa_output.usb-1130_USB_AUDIO-00-AUDIO.analog-stereo after a few minutes of uptime?

Thanks!

share|improve this question

closed as off topic by Mateo_, Eric Carvalho, Luis Alvarado May 2 '13 at 0:48

Questions on Ask Ubuntu are expected to relate to Ubuntu within the scope defined by the community. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about reopening questions here.If this question can be reworded to fit the rules in the help center, please edit the question.

1 Answer 1

up vote 3 down vote accepted

We have no solution for the long timeout your system needs to recognize an external USB sound device but there is a way to connect the Pulse Audio output sink with this device as soon as it was available (as loading a default sink in your default.pa is not possible when the device is not ready by the time the sound server is started).

Pulseaudio module-switch-on-connect enables automatic switching of an audio device on connection. To test if this works we may issue the following commmand in a terminal:

pacmd load-module module-switch-on-connect

On success we may add the following line to our /etc/pulse/default.pa

load-module module-switch-on-connect

to always load this module per default.

Now the Pulseaudio output sink should be switched to any newly connected sink, in your case this would be your USB audio device.

share|improve this answer
    
This is certainly an acceptable solution! Just a quick question, however. Running the pacmd load-module module-switch-on-connect command yields an output of Welcome to PulseAudio! use "help" for usage information. I got this same output when running the set-default-sink command, but it did work. May I assume that this command worked as well? –  blz Oct 13 '12 at 20:34
    
See with pacmd list-modules if it's there. It should be, otherwise you would have seen an error. –  Takkat Oct 13 '12 at 20:37
    
Great! Seems to work! Thank you so much! –  blz Oct 13 '12 at 20:40

Not the answer you're looking for? Browse other questions tagged or ask your own question.