# Internal Microphone not working on HP Envy 13



## TheodoreEhrenborg (Oct 14, 2022)

Two weeks ago I installed FreeBSD on an HP Envy 13. I haven't been able to get the internal microphone working yet.

The HP website describes the microphone as "HP Wide Vision HD Camera with integrated dual array digital microphone".

`cat /dev/sndstat` tells me this:

```
/usr/home/theo $ cat /dev/sndstat
Installed devices:
pcm0: <Realtek ALC285 (Left Analog)> (play/rec)
pcm1: <Realtek ALC285 (Internal Analog Speaker)> (play) default
pcm2: <Intel Kaby Lake (HDMI/DP 8ch)> (play)
No devices installed from userspace.
```
The internal speaker, which works fine, appears to be pcm1. If I set the default speaker to something else (using for example `sysctl hw.snd.default_unit=0`) there is no sound.

But the internal microphone does not work if I set the default to pcm0, pcm1, or pcm2.

I read the snd_hda() manual, especially the section on setting device.hints.

I did a verbose boot to look at the pins:

```
Oct 12 19:33:15 ribeye kernel: hdaa0: Patched pins configuration:
Oct 12 19:33:15 ribeye kernel: hdaa0: nid   0x    as seq device       conn  jack    loc        color   misc
Oct 12 19:33:15 ribeye kernel: hdaa0: 18 411111f0 15 0  Speaker       None  1/8     Rear       Black   1 DISA
Oct 12 19:33:15 ribeye kernel: hdaa0: 19 40000000 0  0  Line-out      None  Unknown 0x00       Unknown 0 DISA
Oct 12 19:33:15 ribeye kernel: hdaa0: 20 411111f0 15 0  Speaker       None  1/8     Rear       Black   1 DISA
Oct 12 19:33:15 ribeye kernel: hdaa0: 22 411111f0 15 0  Speaker       None  1/8     Rear       Black   1 DISA
Oct 12 19:33:15 ribeye kernel: hdaa0: 23 90170180 8  0  Speaker       Fixed Analog  Internal   Unknown 1
Oct 12 19:33:15 ribeye kernel: hdaa0: 24 411111f0 15 0  Speaker       None  1/8     Rear       Black   1 DISA
Oct 12 19:33:15 ribeye kernel: hdaa0: 25 03a11040 4  0  Mic           Jack  1/8     Left       Black   0
Oct 12 19:33:15 ribeye kernel: hdaa0: 26 411111f0 15 0  Speaker       None  1/8     Rear       Black   1 DISA
Oct 12 19:33:15 ribeye kernel: hdaa0: 27 411111f0 15 0  Speaker       None  1/8     Rear       Black   1 DISA
Oct 12 19:33:15 ribeye kernel: hdaa0: 30 411111f0 15 0  Speaker       None  1/8     Rear       Black   1 DISA
Oct 12 19:33:15 ribeye kernel: hdaa0: 33 03211020 2  0  Headphones    Jack  1/8     Left       Black   0
Oct 12 19:33:15 ribeye kernel: hdaa0: 3 associations found:
Oct 12 19:33:15 ribeye kernel: hdaa0: Association 0 (2) out:
Oct 12 19:33:15 ribeye kernel: hdaa0:  Pin nid=33 seq=0
Oct 12 19:33:15 ribeye kernel: hdaa0: Association 1 (4) in:
Oct 12 19:33:15 ribeye kernel: hdaa0:  Pin nid=25 seq=0
Oct 12 19:33:15 ribeye kernel: hdaa0: Association 2 (8) out:
Oct 12 19:33:15 ribeye kernel: hdaa0:  Pin nid=23 seq=0
```


```
Oct 12 19:33:15 ribeye kernel: pcm0: <Realtek ALC285 (Left Analog)> at nid 33 and 25 on hdaa0
```


```
Oct 12 19:33:15 ribeye kernel: pcm1: <Realtek ALC285 (Internal Analog Speaker)> at nid 23 on hdaa
```


```
Oct 12 19:33:15 ribeye kernel: pcm2: <Intel Kaby Lake (HDMI/DP 8ch)> at nid 3 on hdaa1
```
It seems that pcm0 is the headphone jack and headphone mic, pcm1 is the internal speaker, and pcm2 is an HDMI port. (The laptop doesn't have one---perhaps it means the USB-C port?)

In Thread how-to-unmute.34362 the poster had an internal mic which looked like this:

```
hdac0:  nid 25 0x90a00110 as  1 seq  0           Mic Fixed jack  0 loc 16 color Unknown misc 1
```

(I tried the thread's advice of setting each nid to a different association (not 0 or 15), but I still picked up nothing from my mike afterwards.)

I don't seem to have any fixed microphone. The laptop does have a microphone; it's just not detecting it. Perhaps I am missing a driver? I have `snd_driver_load="YES"` in my /boot/loader.conf, which loads many drivers (according to the handbook).

I have used a wired USB headset with this computer. The headset's microphone and speaker worked fine, except they were staticky. But the static only happened rarely, so I attribute it to me not having the headset plugged in properly.

I have been using Audacity to check if the microphone is working.

Rarely Audacity will record very very quiet static. If I amplify the static, I don't hear any recognizable noises, so I think perhaps Audacity is trying to listen to a headset when the headset is not plugged in. But usually Audacity records silence.

I have seen some people complain about pulseaudio. I have pulseaudio installed as a dependency of kde5. If I try to uninstall pulseaudio, pkg tries to uninstall kde5. Hence I have left it alone.

I have used `mixer -s vol 100` and similar commands to set various volumes to 100, with no effect.

```
Fri Oct 14 21:54:21 /usr/home/theo $ mixer
Mixer vol      is currently set to 100:100
Mixer pcm      is currently set to 100:100
Mixer speaker  is currently set to 100:100
Mixer mic      is currently set to 100:100
Mixer rec      is currently set to 100:100
Recording source: mic
```

Any advice would be appreciated. I'm curious about what angle of attack to try next: Am I missing a driver? Is pulseaudio at fault? Is my microphone not supported (in which case I'd get an external one)? Something else?


----------



## hazy (Oct 18, 2022)

My first thought is to try multimedia/webcamd to see if it can be detected that way.


----------



## Alain De Vos (Oct 18, 2022)

pcm0 should be capable of recording normally.
To record maybe "ffmpg -i /dev/dsp0"


----------



## TheodoreEhrenborg (Oct 18, 2022)

> My first thought is to try multimedia/webcamd to see if it can be detected that way.



I wasn't sure how to do this, so I started following this tutorial Thread how-to-webcam-and-microphone-inside-of-gui-jail.78507/ on setting up webcamd. `kldload cuse` tells me:


```
kldload: can't load cuse: module already loaded or in kernel
```

I installed webcamd. The result of `usbconfig` is


```
ugen0.1: <Intel XHCI root HUB> at usbus0, cfg=0 md=HOST spd=SUPER (5.0Gbps) pwr=SAVE (0mA)
ugen0.2: <DHQYLA19ICO9Y9 HP Wide Vision HD Camera> at usbus0, cfg=0 md=HOST spd=HIGH (480Mbps) pwr=ON (500mA)
ugen0.3: <vendor 0x06cb product 0x00c9> at usbus0, cfg=0 md=HOST spd=FULL (12Mbps) pwr=ON (100mA)
ugen0.4: <vendor 0x8087 product 0x0aaa> at usbus0, cfg=0 md=HOST spd=FULL (12Mbps) pwr=ON (100mA)
```

So the webcam is `ugen0.2`.

But that tutorial assumes that you can already see the mic in the output of `cat /dev/sndstat`. This command prints:


```
FreeBSD Audio Driver (64bit 2009061500/amd64)
Installed devices:
pcm0: <Realtek ALC285 (Left Analog)> on hdaa0  (1p:4v/1r:1v)
pcm1: <Realtek ALC285 (Internal Analog Speaker)> on hdaa0  (1p:1v/0r:0v) default
pcm2: <Intel Kaby Lake (HDMI/DP 8ch)> on hdaa1  (1p:1v/0r:0v)
No devices installed from userspace.
```

But none of these three pcms is a working internal microphone.




> To record maybe "ffmpg -i /dev/dsp0"



I wasn't able to get ffmpeg to record, but when I set the default pcm to 0 with `sysctl hw.snd.default_unit=0`, then `rec foo.wav` successfully records from the headphone jack. (I plugged in a tablet there and played a podcast on the tablet, sending the audio to the headphone jack.) The resulting recording is more static than actual signal, but the signal is there.

From the table of nids in my previous post, it did seem that pcm0 was the headphone jack, so I'm glad to have confirmed it. But my main focus is getting the internal microphone working.

I scanned my hardware and put the results at https://bsd-hardware.info/?probe=bc229efed9 using `sudo hw-probe -all -upload`. I am not sure how to interpret all of the results, but I don't see anything obviously bad---`hw-probe` claims my sound card is supported.


----------



## TheodoreEhrenborg (Oct 18, 2022)

Also, the video feed from my webcam was working fine before I installed webcamd() today, and it's still working. So no problems there.


----------



## quakerdoomer (Nov 19, 2022)

Hi, I have the same (almost exact) problem since more than a year and I ended up using virtual_oss with external earphones which have a mic. If you want a quick fix then that is one way to go but I am myself fed up of this setting and am ready to try all pins to get my internal mic working.
Your webcam will keep jumping from ugen0.2 and ugen0.3 depending upon your reboot (mine does at least).
If you figure out a solution for your internal mic, please share it here.


----------

