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.

Each time I want to use Skype, I have to go in the sound preferences. And there, turn the audio-in to "webcam" and uncheck the "mute" button. It's quite annoying. Is there a way to always keep the same configuration ?

share|improve this question
I have this problem as well with a logitech quickacam. After every reboot I have to go through the preferences and reset it as the default input in order for it to work. I think it has something to do with the fact that usb devices are loaded after sound preferences are set so pulse or alsa don't "see" the usb mic. Unfortunately because the "problem" isn't really a problem just an inconvenience it's not so important that I want to roll up the shirt sleeves and start digging and editing through config files. –  user13694 Apr 6 '11 at 5:16

3 Answers 3

up vote 6 down vote accepted

Changing default settings for PulseAudio

When running pulseaudio all settings can be defined by putting custom configuration files in the hidden .pulse directory in your HOME. If these file do not yet exist there you can use the standard files from /etc/pulse/ as a template. Most entries have verbous explanations in these files.

  • ~/.pulse/default.pa to load modules and define defaults
  • ~/.pulse/client.conf to configure a client for the sound server
  • ~/.pulse/daemon.conf to define sample rates and buffers

To make your webcam the default source we need to know this source's name and number by looking through the list produced by the following command in a terminal:

pacmd list-sources

We then edit the following line in ~/.pulse/default.pa:

set-default-source input

and replace input by the name or the source number for the desired source. We then need to make sure that the source is unmuted by adding this line:

set-source-mute <n> 0

Replace <n> by the number of your source. You can add a variety of other settings that are referenced in the PulseAudio Wiki.

It is recommended to first test all commands through the command line interface before changing the configuration files. This can be opened with pacmd in a terminal

share|improve this answer
There's no default.pa in my .pulse folder. Should I create a new file with one line: set-default-source x ? –  To Do Mar 16 '12 at 21:17
@ToDo the default settings are in /etc/pulse/default.pa. Use this file or copy it to ~/.pulse before editing. –  Takkat Mar 17 '12 at 17:49

try this, click on the speaker icon on your top panel, the click preferences. there you can select a default input option for you microphone and probably change some hardware config to make it work ok.

share|improve this answer
Thank you for your help, but that's what I'm doing right now. However, I don't see any ways to make this a default setting. Every now and then, I'll have to do it again because the setting would have changed. –  Gizmoatwork Mar 21 '11 at 2:29

I agree that the problem is that Pulseaudio does not set a USB device as default because it is not present when pulse starts.

Soo my solution to this is to hook into the system that does notice when a USB device is connected... UDEV!

BTW, these instructions are slightly funky, and I am assuming that you are comfortable doing stuff at the command line, and becoming the root user to update udev files, and making scripts executable.

First, find out stuff


First step is to plug in your webcam and find the magic vendor and product numbers by typing


I'm using a Microsoft Lifecam, and it show as

Bus 001 Device 013: ID 045e:072d Microsoft Corp.

the important part is 045e:072d

Pulseaudio device

Next, while the webcam is connected, find out the pulseaudio device name. Type

pacmd list-sources

Again, I'm looking for the line that starts name: then has something about a Microsoft Lifecam... here it is

name: <alsa_input.usb-Microsoft_Microsoft___LifeCam_VX-5500-02-VX5500.analog-mono>

so my pulseaudio device name will be alsa_input.usb-Microsoft_Microsoft___LifeCam_VX-5500-02-VX5500.analog-mono

UDEV rules

Then I made a new udev rule which is fired when a USB device with vendor=045e and product=072d is inserted. To make a rule, create a new file called /etc/udev/rules.d/SOMETHING.rules (I called my file /etc/udev/rules.d/95-webcam-mic.rules).

Put this line into the file

SUBSYSTEMS=="usb", ATTR{idVendor}=="045e", ATTR{idProduct}=="072d", ACTION=="add", GROUP="audio", RUN+="/usr/local/bin/webcam-mic"

Remember to replace the ATTR{idVendor} and ATTR{idProduct} with the values for your webcam.

What this rule does is run a script to set the usb device for input, that is the RUN+="/usr/local/bin/webcam-mic" part.

Finally, set the webcam for input

Quick overview time. Each time I connect my webcam I want to run the command

pacmd set-default-source alsa_input.usb-Microsoft_Microsoft___LifeCam_VX-5500-02-VX5500.analog-mono

But the command needs to run as me (the user running the desktop), but udev runs as the root user - so when udev runs my command I need it to change to my user then run the command.

So we have 2 options.

  1. Quick and dirty. Make the udev rule run su james -c pacmd set-default-source... this is sooo wrong I can't even finish typing the command. What if you change webcams? What if you install this for another user?

  2. Slightly cleaner. Run a script that reads a defaults file which has the pulseaudio device name, and your username in it. If you want the files they are on GitHub. First the script /usr/local/bin/webcam-mic. The defaults file /etc/default/webcam-mic just needs to define the 2 shell variables, as per the comment in the gist. Put the script into /usr/local/bin/ and make it executable. Then put the defaults file into /etc/defaults/ and edit it to use your username and the pulseaudio device from earlier.

Good luck!

share|improve this answer
Any chance you could upload those scripts again; they appear to have disappeared from pastebin? –  ej159 Oct 11 '14 at 8:56
I have put the script into a gist on GitHub, and updated the answer. –  James Mitchell Oct 17 '14 at 3:11

protected by Community Feb 1 at 18:04

Thank you for your interest in this question. Because it has attracted low-quality answers, posting an answer now requires 10 reputation on this site.

Would you like to answer one of these unanswered questions instead?

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