Lenovo V110

The Lenovo V110 laptop runs Ubuntu. There is one problem after installation though and that is the build in microphone. This one doesn't work out of the box.

I found an article on the arch linux wiki website that explains how tot make the microphone work, allthough it is still a very buggy mess.

https://wiki.archlinux.org/title/PulseAudio/Troubleshooting#Static_noise_in_microphone_recording

Afther this method the mic works more or less, but the quality of the recordings is very low. Far worse than using it in MS windows.

For easy reference (of when the original page is removed), here is a copy:

Static noise in microphone recording

If we are getting static noise in Skype, gnome-sound-recorder, arecord, etc.'s recordings, then the sound card sample rate is incorrect. That is why there is static noise in Linux microphone recordings. To fix this, we need to set the sampling rate in /etc/pulse/daemon.conf for the sound hardware.

In addition to the guide below, since PulseAudio 11 it is possible to set avoid-resampling = yes in daemon.conf.

Determine sound cards in the system (1/5)

This requires alsa-utils and related packages to be installed:

$ arecord --list-devices

**** List of CAPTURE Hardware Devices ****

card 0: Intel [HDA Intel], device 0: ALC888 Analog [ALC888 Analog]

Subdevices: 1/1

Subdevice #0: subdevice #0

card 0: Intel [HDA Intel], device 2: ALC888 Analog [ALC888 Analog]

Subdevices: 1/1

Subdevice #0: subdevice #0


The sound card is hw:x,y where x is the card number and y is the device number. In the above example, it is hw:0,0.

Determine sampling rate of the sound card (2/5)

We aim to find the highest sample rate supported by the hw:0,0 sound card using a trial-and-error procedure starting from a low value. When the top value is reached, we got a warning message:

arecord -f dat -r 60000 -D hw:0,0 -d 5 test.wav

"Recording WAVE 'test.wav' : Signed 16 bit Little Endian, Rate 60000 Hz, Stereo

Warning: rate is not accurate (requested = 60000Hz, got = 44100Hz)

please, try the plug plugin

observe, the got = 44100Hz. This is the maximum sampling rate of our card.

Setting the sound card's sampling rate into PulseAudio configuration (3/5)

The default sampling rate in PulseAudio:

$ grep "default-sample-rate" /etc/pulse/daemon.conf

; default-sample-rate = 48000

48000 is disabled and needs to be changed to 44100:

# sed 's/; default-sample-rate = 48000/default-sample-rate = 44100/g' -i /etc/pulse/daemon.conf


Restart PulseAudio to apply the new settings (4/5)

$ pulseaudio -k

$ pulseaudio --start


Finally check by recording and playing it back (5/5)

Let us record some voice using a microphone for, say, 10 seconds. Make sure the microphone is not muted and all

$ arecord -f cd -d 10 test-mic.wav


After 10 seconds, let us play the recording...

$ aplay test-mic.wav


Now hopefully, there is no static noise in microphone recording anymore.

Another Possible Cause

Another possible cause is that your mic has two channels but only one channel can provide a valid sound signal. Some information can be found here. The solution is to remap the stereo input to a mono input:

1. Find your source name from the following command; mine is alsa_input.pci-0000_00_1f.3.analog-stereo

pacmd list-sources | grep 'name:.*input'


2. Edit /etc/pulse/default.pa and add the following lines, where INPUT_NAME is name of the input source from above step:

load-module module-remap-source source_name=record_mono master=INPUT_NAME master_channel_map=front-left channel_map=mono

set-default-source record_mono


3. Restart PulseAudio:

$ pulseaudio -k

$ pulseaudio --start


Now arecord hopefully works. You may still need to change the RecordStream from setting to Remapped Built-in Audio Analog Stereo of a specific application in the Recording tab of pavucontrol.


No microphone on Steam or Skype with enable-remixing = no

When you set enable-remixing = no on /etc/pulse/daemon.conf you may find that your microphone has stopped working on certain applications like Skype or Steam. This happens because these applications capture the microphone as mono only and because remixing is disabled, Pulseaudio will no longer remix your stereo microphone to mono.

To fix this you need to tell Pulseaudio to do this for you:

1. Find the name of the source

# pacmd list-sources


Example output edited for brevity, the name you need is in bold:

index: 2

name: <alsa_input.pci-0000_00_14.2.analog-stereo>

driver: <module-alsa-card.c>

flags: HARDWARE HW_MUTE_CTRL HW_VOLUME_CTRL DECIBEL_VOLUME LATENCY DYNAMIC_LATENCY


2. Add a remap rule to /etc/pulse/default.pa, use the name you found with the previous command, here we will use alsa_input.pci-0000_00_14.2.analog-stereo as an example:

/etc/pulse/default.pa

### Remap microphone to mono

load-module module-remap-source master=alsa_input.pci-0000_00_14.2.analog-stereo master_channel_map=front-left,front-right channels=2 channel_map=mono,mono

3. Restart Pulseaudio

# pulseaudio -k


Note: Pulseaudio may fail to start if you do not exit a program that was using the microphone (e.g. if you tested on Steam before modifying the file), in which case you should exit the application and manually start Pulseaudio

# pulseaudio --start


Microphone distorted due to automatic adjustment

If your microphone volume creeps up automatically and causes the sound to be distorted, you can fix it by disabling mic boost:

In all files /usr/share/alsa-card-profile/mixer/paths/analog-input*.conf,

  • Under [Element Capture] set volume to zero

  • Under [Element Internal Mic Boost] set volume to zero.

  • Under [Element Int Mic Boost] set volume to zero.

  • Under [Element Mic Boost] set volume to zero.

including all variations such as [Element Headphone Mic Boost] and [Element Mic Boost (+20dB)]

Then restart PulseAudio:

# pulseaudio -k


Microphone crackling with Realtek ALC892

Sometimes ALC892 chips have crackling sound while recording using a microphone. Some Pulseaudio config changes may help:

/etc/pulse/daemon.conf

resample-method = src-sinc-best-quality

default-sample-format = s16le

default-sample-rate = 48000

and add the use_ucm option to

/etc/pulse/default.pa

load-module module-udev-detect use_ucm=0 tsched=0

then restart pulseaudio.

Microphone crackling with Azalia chipsets

Some Azalia based chips have popping/crackling noise and distortion while recording using a microphone with PulseAudio. This can be fixed by loading the snd-hda-intel module with position_fix set to an appropriate value. This tells the module to use various DMA pointer fixes. Use trial and error to determine which value works for you. (source)

Create a new modprobe.d config:

/etc/modprobe.d/azalia-microphone.conf

options snd-hda-intel position_fix=1

Valid values for position_fix are:

  • 0 = Auto

  • 1 = None

  • 2 = POSBUF

  • 3 = FIFO size

then reload your modules.

Echo test

If you are unsure about your microphone setup, you can hear the input from the microphone in real-time by enabling the loopback module (source):

$ pactl load-module module-loopback


The module will show up in the Recording tab of the pavucontrol program, where the source and volume can be configured. While latency should be low, it should be sufficient to get a feeling of the sound quality as you will hear yourself speak in the microphone. To make the change permanent, add the following pulseaudio configuration:

/etc/pulse/default.pa

load-module module-loopback

Watch out for feedback! Be ready to lower all volumes in case the microphone picks up the output from the loudspeakers. Naturally, it is better to run such a test with headphones.

Audio quality

Glitches, skips or crackling

The newer implementation of the PulseAudio sound server uses timer-based audio scheduling instead of the traditional, interrupt-driven approach.

Timer-based scheduling may expose issues in some ALSA drivers. On the other hand, other drivers might be glitchy without it on, so check to see what works on your system.

To turn timer-based scheduling off add tsched=0 in /etc/pulse/default.pa:

/etc/pulse/default.pa

load-module module-udev-detect tsched=0

Then restart the PulseAudio server:

$ pulseaudio -k

$ pulseaudio --start


Do the reverse to enable timer-based scheduling, if not already enabled by default.

If you are using Intel's IOMMU and experience glitches and/or skips, add intel_iommu=igfx_off to your kernel command line.

Some Intel audio cards using the snd-hda-intel module need the otions vid=8086 pid=8ca0 snoop=0. In order to set them permanently, create/modify the following file including the line below.

/etc/modprobe.d/sound.conf

options snd-hda-intel vid=8086 pid=8ca0 snoop=0

Please report any such cards to PulseAudio Broken Sound Driver page