Just for fun I added an extra webcam to my desktop computer, thinking that it might be useful from time to time to add a different perspective to my video conferencing sessions etc.
However, I quickly discovered that the microphone on this new webcam was making me sound like Alvin of the Chipmunks. The simple solution was to switch to the microphone on the other webcam, but this became increasingly annoying. Also, I thought there must be a solution that would fix the problem once and for all.
Every problem creates an opportunity to dive deeper into the technology behind something. Get introduced to the world of webSDR and you end up learning about Autoplay policy in different browsers and exploring how to change the default policy programmatically. All because you had the idea to schedule recordings of shortwave broadcasts instead of juggling your calendar in order to be there at the proper time.
However, I digress.
Back to my squeaky microphone.
It turns out that you get to learn about sampling rates and other arcane tech trivia.
Once you hit the right results in your Google searches, the fix was relatively easy. All you need to do is change a setting in a Pulseaudio configuration file.(On a Linux machine, that is!)
In the process you learn about a new command line command, learn how to identify your sound devices (such as microphones) and modify the appropriate config file to fix the problem.
VoilĂ no more Alvin and lots more Peter.
Here are the details:
Apparently, Logitech webcams have a tendency to get configured with a sampling rate of 48000, which is three times too much. So you need to get a device name for the offending microphone and then change the configuration so that it is registered at the proper 16000 instead.
On my Linux machine I did the following, thanks to this helpful post:
https://evgenykuznetsov.org/en/posts/2020/webcam-sound/
What I learned:
A new command to list audio devices:
pacmd list-sources
Identifying the desired device from the output of the above command, and modifying the appropriate config file:
/etc/pulse/default.pa
to add a line to set the proper sampling rate:
load-module module-remap-source master=<device name from above> rate=16000