Built-in microphone is not systematically recognized

Forum rules
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Tobari
Level 2
Level 2
Posts: 73
Joined: Tue Jun 02, 2020 5:24 am

Built-in microphone is not systematically recognized

Post by Tobari »

Hello guys,

I thought my microphone problem was solved here,[Solved] Built-in microphone doesn't work after the system goes to sleep.

Unfortunately, it's not solved.

I thought PulseAudio switches from the internal mic to "microphone unplugged" after the computer "woke up" from being suspended. In fact, it's not the case. At times it does it, at times it doesn't. It does it once a day, but I couldn't reproduce the bug if I wanted to.

Even after I switch back (manually) to "internal microphone", Telegram, Skype, etc. do not always take it into account, and I must reboot if I want to take a call.
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 1 time in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
User avatar
MrEen
Level 23
Level 23
Posts: 18343
Joined: Mon Jun 12, 2017 8:39 pm

Re: Built-in microphone is not systematically recognized

Post by MrEen »

Hi Tobari,

When that happens, close Telegram, Skype, etc., then run pulseaudio -k. Wait 5 seconds, then open the apps and see if they work properly.

We've already added the proper port to /etc/pulse/default.pa, so restarting the sound daemon with the above command "should" work.
Tobari
Level 2
Level 2
Posts: 73
Joined: Tue Jun 02, 2020 5:24 am

Re: Built-in microphone is not systematically recognized

Post by Tobari »

Thanks,

Do you think re-installing (say, Mint 20) would solve the problem for good?
User avatar
MrEen
Level 23
Level 23
Posts: 18343
Joined: Mon Jun 12, 2017 8:39 pm

Re: Built-in microphone is not systematically recognized

Post by MrEen »

It's hard to say for sure. Some people are having new sound issues on 20 that they weren't experiencing on 19.3. I've discovered PulseAudio is the cause, but no solution in sight yet. I may work fine for you, but certainly test the Live version first before installing.
Tobari
Level 2
Level 2
Posts: 73
Joined: Tue Jun 02, 2020 5:24 am

Re: Built-in microphone is not systematically recognized

Post by Tobari »

Thanks for you answer.

Is there really no way to fix the problem permanently?

It's not much fun to check PulseAudio everytime I wake up the laptop...
User avatar
MrEen
Level 23
Level 23
Posts: 18343
Joined: Mon Jun 12, 2017 8:39 pm

Re: Built-in microphone is not systematically recognized

Post by MrEen »

There are possible solutions. It's a question of how much time you want to put in to try to find the magical solution for your setup.

One possible solution is adding a resume script to run pulseaudio -k similar to this idea. You would change the post command to something like sudo --user=YourUserName pulseaudio -k

There is more than one way to accomplish the same thing. I don't use suspend, so can only go by what I find in web searches.
User avatar
MrEen
Level 23
Level 23
Posts: 18343
Joined: Mon Jun 12, 2017 8:39 pm

Re: Built-in microphone is not systematically recognized

Post by MrEen »

In this post I share a way that mostly worked for one user. You'll need to change the coomand from gksudo xed /etc/systemd/system/resume-fix-pulseaudio@.service to xed admin:///etc/systemd/system/resume-fix-pulseaudio@.service.

And this is predicated on the fact pulseaudio -k actually works for you.
Tobari
Level 2
Level 2
Posts: 73
Joined: Tue Jun 02, 2020 5:24 am

Re: Built-in microphone is not systematically recognized

Post by Tobari »

Thank you for taking the time to look into it, btw.

In fact, pulseaudio -k doesn't work.

On the one hand, it does set PulseAudio on the internal mic. That's why I thought it worked.

But it doesn't get Telegram and Skype to work. Telegram even displays
There seems to be a problem with your sound card. Please make sure that your computer's speakers and microphone are working and try again.
What does your laptop do when you close it, if you don't have it suspended?
User avatar
MrEen
Level 23
Level 23
Posts: 18343
Joined: Mon Jun 12, 2017 8:39 pm

Re: Built-in microphone is not systematically recognized

Post by MrEen »

Tobari wrote: Sun Aug 02, 2020 10:05 am What does your laptop do when you close it, if you don't have it suspended?
I've only ever used desktops.

When this happens, post the output of pacmd list-sources. I'm hoping we'll see the asterisk next to the .monitor source index number, which is an easy fix.
Tobari
Level 2
Level 2
Posts: 73
Joined: Tue Jun 02, 2020 5:24 am

Re: Built-in microphone is not systematically recognized

Post by Tobari »

The output is long. I hope it'll help :)

Code: Select all

2 source(s) available.
  * index: 0
	name: <alsa_output.pci-0000_00_1f.3.analog-stereo.monitor>
	driver: <module-alsa-card.c>
	flags: DECIBEL_VOLUME LATENCY DYNAMIC_LATENCY
	state: SUSPENDED
	suspend cause: IDLE 
	priority: 1030
	volume: front-left: 65536 / 100% / 0,00 dB,   front-right: 65536 / 100% / 0,00 dB
	        balance 0,00
	base volume: 65536 / 100% / 0,00 dB
	volume steps: 65537
	muted: no
	current latency: 0,00 ms
	max rewind: 0 KiB
	sample spec: s16le 2ch 48000Hz
	channel map: front-left,front-right
	             Stereo
	used by: 0
	linked by: 0
	configured latency: 0,00 ms; range is 0,50 .. 341,33 ms
	monitor_of: 0
	card: 0 <alsa_card.pci-0000_00_1f.3>
	module: 5
	properties:
		device.description = "Monitor of Built-in Audio Analog Stereo"
		device.class = "monitor"
		alsa.card = "0"
		alsa.card_name = "HDA Intel PCH"
		alsa.long_card_name = "HDA Intel PCH at 0xe1244000 irq 129"
		alsa.driver_name = "snd_hda_intel"
		device.bus_path = "pci-0000:00:1f.3"
		sysfs.path = "/devices/pci0000:00/0000:00:1f.3/sound/card0"
		device.bus = "pci"
		device.vendor.id = "8086"
		device.vendor.name = "Intel Corporation"
		device.product.id = "9d70"
		device.product.name = "Sunrise Point-LP HD Audio"
		device.form_factor = "internal"
		device.string = "0"
		module-udev-detect.discovered = "1"
		device.icon_name = "audio-card-pci"
    index: 1
	name: <alsa_input.pci-0000_00_1f.3.analog-stereo>
	driver: <module-alsa-card.c>
	flags: HARDWARE HW_MUTE_CTRL HW_VOLUME_CTRL DECIBEL_VOLUME LATENCY DYNAMIC_LATENCY
	state: SUSPENDED
	suspend cause: IDLE 
	priority: 9039
	volume: front-left: 44462 /  68% / -10,11 dB,   front-right: 44462 /  68% / -10,11 dB
	        balance 0,00
	base volume: 13076 /  20% / -42,00 dB
	volume steps: 65537
	muted: no
	current latency: 0,00 ms
	max rewind: 0 KiB
	sample spec: s16le 2ch 48000Hz
	channel map: front-left,front-right
	             Stereo
	used by: 0
	linked by: 0
	configured latency: 0,00 ms; range is 0,50 .. 341,33 ms
	card: 0 <alsa_card.pci-0000_00_1f.3>
	module: 5
	properties:
		alsa.resolution_bits = "16"
		device.api = "alsa"
		device.class = "sound"
		alsa.class = "generic"
		alsa.subclass = "generic-mix"
		alsa.name = "CX20724 Analog"
		alsa.id = "CX20724 Analog"
		alsa.subdevice = "0"
		alsa.subdevice_name = "subdevice #0"
		alsa.device = "0"
		alsa.card = "0"
		alsa.card_name = "HDA Intel PCH"
		alsa.long_card_name = "HDA Intel PCH at 0xe1244000 irq 129"
		alsa.driver_name = "snd_hda_intel"
		device.bus_path = "pci-0000:00:1f.3"
		sysfs.path = "/devices/pci0000:00/0000:00:1f.3/sound/card0"
		device.bus = "pci"
		device.vendor.id = "8086"
		device.vendor.name = "Intel Corporation"
		device.product.id = "9d70"
		device.product.name = "Sunrise Point-LP HD Audio"
		device.form_factor = "internal"
		device.string = "front:0"
		device.buffering.buffer_size = "65536"
		device.buffering.fragment_size = "32768"
		device.access_mode = "mmap+timer"
		device.profile.name = "analog-stereo"
		device.profile.description = "Analog Stereo"
		device.description = "Built-in Audio Analog Stereo"
		alsa.mixer_name = "Conexant CX20724"
		alsa.components = "HDA:14f150f4,103c8079,00100109 HDA:80862809,80860101,00100000"
		module-udev-detect.discovered = "1"
		device.icon_name = "audio-card-pci"
	ports:
		analog-input-internal-mic: Internal Microphone (priority 8900, latency offset 0 usec, available: no)
			properties:
				device.icon_name = "audio-input-microphone"
		analog-input-mic: Microphone (priority 8700, latency offset 0 usec, available: yes)
			properties:
				device.icon_name = "audio-input-microphone"
		analog-input-linein: Line In (priority 8100, latency offset 0 usec, available: no)
			properties:
				
	active port: <analog-input-internal-mic>
User avatar
MrEen
Level 23
Level 23
Posts: 18343
Joined: Mon Jun 12, 2017 8:39 pm

Re: Built-in microphone is not systematically recognized

Post by MrEen »

And I was correct. See the asterisk next to index 0? See that the name of index 0 is alsa_output.pci-0000_00_1f.3.analog-stereo.monitor?

To correct that, you can run this:

Code: Select all

pacmd set-default-source alsa_input.pci-0000_00_1f.3.analog-stereo
You might need to restart your recording apps after that, but then they should pick up the change to the built-in card instead of the .monitor, which would record the sound your computer is playing.

After running the above command, pacmd list-sources should then show the asterisk next to index 1, and the apps should be able to record what's coming from the mic.

You can also set the via GUI by installing and running PulseAudio Volume Control. The Input Devices tab should have the check mark highlighted next to the mic Port.
Tobari
Level 2
Level 2
Posts: 73
Joined: Tue Jun 02, 2020 5:24 am

Re: Built-in microphone is not systematically recognized

Post by Tobari »

Now it says index: 0 (not Index 1) and the asterisk is indeed gone, at least for now.

As you say, the Input Devices tab on PulseAudio have the check mark highlighted next to the mic Port. I hope the bug is gone, but I must wait because I was never able to reproduce the problem at will.
Tobari
Level 2
Level 2
Posts: 73
Joined: Tue Jun 02, 2020 5:24 am

Re: Built-in microphone is not systematically recognized

Post by Tobari »

So, the asterisk is back, the check mark is not highlighted anymore, and the bug is back.
User avatar
MrEen
Level 23
Level 23
Posts: 18343
Joined: Mon Jun 12, 2017 8:39 pm

Re: Built-in microphone is not systematically recognized

Post by MrEen »

Okay, so it's looks like it's a settings not sticking issue. Is this always after returning from suspend, or does it happen other times. There are people that have always had issues like this when using suspend.

Let me see the output of tail /etc/pulse/default.pa and maybe we can add another line to get this working properly.
Tobari
Level 2
Level 2
Posts: 73
Joined: Tue Jun 02, 2020 5:24 am

Re: Built-in microphone is not systematically recognized

Post by Tobari »

I have the impression it's not systematic.

Today, the there is no asterisk in front of index 0, the check mark is highlighted, but the Input Devices tab went back to "microphone" instead of "internal microphone."

Yes, it only happens after returning from suspend. But it doesn't always happen after the first time it returns from suspend. Also, it happens only once between start and shut down, even if I suspend many times.

The output is:

Code: Select all

#.fail
#.endif

load-module module-switch-on-port-available

### Make some devices default
#set-default-sink output
#set-default-source input

set-source-port 1 analog-input-internal-mic
User avatar
MrEen
Level 23
Level 23
Posts: 18343
Joined: Mon Jun 12, 2017 8:39 pm

Re: Built-in microphone is not systematically recognized

Post by MrEen »

Okay, hopefully this will stop it from happening any more.

In the terminal run xed admin:///etc/pulse/default.pa and when the file opens change the bottom of the file so it looks like this:

Code: Select all

load-module module-switch-on-port-available

### Make some devices default
#set-default-sink output
#set-default-source input
set-default-source alsa_input.pci-0000_00_1f.3.analog-stereo
set-source-port alsa_input.pci-0000_00_1f.3.analog-stereo analog-input-internal-mic
Save the file and reboot to make the change active and let me know if that has solved this.

Do notice that I also changed the last line from what it was.
Tobari
Level 2
Level 2
Posts: 73
Joined: Tue Jun 02, 2020 5:24 am

Re: Built-in microphone is not systematically recognized

Post by Tobari »

Thank you for your help.

Unfortunately, it still happens.
User avatar
MrEen
Level 23
Level 23
Posts: 18343
Joined: Mon Jun 12, 2017 8:39 pm

Re: Built-in microphone is not systematically recognized

Post by MrEen »

Okay, run xed admin:///etc/pulse/default.pa again and find this section:

Code: Select all

### Should be after module-*-restore but before module-*-detect
load-module module-switch-on-port-available
Change it to this:

Code: Select all

### Should be after module-*-restore but before module-*-detect
# load-module module-switch-on-port-available
Do the same for the line that has something like this:

Code: Select all

load-module module-switch-on-connect
So it looks like this:

Code: Select all

# load-module module-switch-on-connect
Save and test.
Tobari
Level 2
Level 2
Posts: 73
Joined: Tue Jun 02, 2020 5:24 am

Re: Built-in microphone is not systematically recognized

Post by Tobari »

I've tested long enough to be confident it's working at last. Thank you so much, MrEen!
User avatar
MrEen
Level 23
Level 23
Posts: 18343
Joined: Mon Jun 12, 2017 8:39 pm

Re: Built-in microphone is not systematically recognized

Post by MrEen »

Okay, great!

On the downside, this means there's something wrong with your port (or Linux) as far as jack detection goes. It keeps sensing connected-unconnected-connected.

Could be as simple as a dirty port, or something more complicated.

Regardless, this workaround should be sufficient, at least for now.

Glad we figured out what was wrong. :D
Locked

Return to “Sound”