35

I have to plugin my USB Audio adapter ( 4300054 Gigawire USB Audio Adapter) for audio input because has a combo-input-output port for voice. After I do this, I have go open Sound Settings and manually select the USB Audio adapter for Input and Output, if I do not, the system default remains selected.

Is there anyway, I can make Ubuntu to automatically select the USB Audio Adapter as the default as soon as I plug-in?

47

There is pulseaudio module-switch-on-connect that 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 can add the following line to our /etc/pulse/default.pa

load-module module-switch-on-connect

to always load this module on every login, resp. restart of the pulseaudio daemon.

| improve this answer | |
  • I just re-found this answer and wish I could upvote it again. This solves the issue on Ubuntu 14.04. – Lars Nyström Oct 8 '15 at 10:02
  • 1
    such a long time it is out there, and still not set to be loaded automatically in 16.04 :| – Ivan Temchenko Jul 16 '16 at 9:54
  • @LarsNyström I upvoted for you – Nabil Kadimi Jul 8 '17 at 0:57
  • just applied this to 17.04 - perfect solution and really should be default – fishears Aug 4 '17 at 7:06
  • 4
    What if Module load failed ? – Skippy le Grand Gourou Jul 21 '19 at 18:33
21

create ~/.config/pulse/default.pa if it doesn't exist and append

.include /etc/pulse/default.pa
load-module module-switch-on-connect

This is better than editing /etc/pulse/default.pa.

Afterwards you should run pulseaudio -k && pulseaudio --start to have the changes take effect. Thanks for pointing that out lreeder

| improve this answer | |
  • 4
    Works for me on 16.04 LTS. You also need to restart pulseaudio after creating this config. 'pulseaudio -k' from the command line will do it. – lreeder Jan 7 '17 at 16:16
  • 4
    Why is it "better than editing /etc/pulse/default.pa"? – Rodrigo Apr 1 '18 at 13:07
  • I used this to get my connected headphones set as default after a restart, just editing /etc/pulse/default.pa did not work. – Sebastian Blask Feb 1 '19 at 16:04
  • 2
    @Rodrigo because it is usually not a good idea to edit system-wide configuration files, which may be overwritten by an update and/or affect other users. See here: wiki.archlinux.org/index.php/PulseAudio#Configuration_files – han-tyumi Jul 1 '19 at 16:54
  • @han-tyumi Of course! Thank you! – Rodrigo Jul 1 '19 at 23:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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