Fixing Sound from a Logitech Webcam

Logitech makes very nice webcams. I own a C310, but other models are available (and sometimes have the same issue).

Trouble is, on Linux the sound coming from the camera’s microphone sometimes gets distorted. Some call it “chipmunk sound”, others just say “sped up”; in any case, you sound “funny” and the person you’re talking to can not really understand you. Not good.

The problem is, these cameras report the microphone’s sample rate as 48000 Hz, while in reality it’s only 16000 Hz. This makes pulseaudio think the sound coming from webcam’s mike is 3 times slower than it should be and make it 3 times faster, hence the distortion.

Googling reveals a solid fix for this issue: just add

alternate-sample-rate = 16000
avoid-resampling = yes

to your ~/.config/pulse/daemon.conf. This works, but it makes your whole pulseaudio stick to 16 kHz which is usually not really desirable, is it?

I have not found the proper solution in Google; I had to figure it out by getting pieces here and there. I have, it works, so here you go.

First, find out the name that pulseaudio identifies your webcam by. Do a

$ pacmd list-sources

and figure out which one it is. Mine showed up as

index: 1
        name: <alsa_input.usb-046d_081b_5EE269A0-02.analog-mono>

so alsa_input.usb-046d_081b_5EE269A0-02.analog-mono is what goes into /etc/pulse/ to fix the problem. Just add the last line:

load-module module-remap-source master=alsa_input.usb-046d_081b_5EE269A0-02.analog-mono rate=16000

Restart pulseaudio, et voilà!