# [Simple] Internal Microphone on FreeBSD 13R



## quakerdoomer (Jun 6, 2021)

Have a simple issue here:


The internal soundcard plays audio, how do I get the mic working?

```
# cat /dev/sndstat

Installed devices:
pcm0: <Realtek ALC257 (Analog)> (play/rec) default
pcm1: <Realtek ALC257 (Right Analog Headphones)> (play)
pcm2: <Intel Kaby Lake (HDMI/DP 8ch)> (play)
No devices installed from userspace.
```
Any pointers as to what should be the next step?

P.S. mixer command shows speaker and mic levels, rec command is present. How do I enable mic?


----------



## quakerdoomer (Jun 6, 2021)

I also kept these under /boot/loader.conf [ Not sure if they're deprecated now ]

```
snd_driver_load="YES"
snd_hda_load="YES"
```


----------



## Alain De Vos (Jun 6, 2021)

Not an immediate answer to your question but it is advisable to load sound in rc.conf and not in loader.conf.
via:

```
kld_list="snd_driver"
```
What is the output when you do

```
/usr/sbin/mixer
```


----------



## quakerdoomer (Jun 6, 2021)

Thanks for the response. I made the changes in  rc.conf as suggested.

Here's the output from :

`#  /usr/sbin/mixer`


```
Mixer vol      is currently set to  85:85
Mixer pcm      is currently set to 100:100
Mixer speaker  is currently set to 100:100
Mixer mic      is currently set to  98:98
Mixer rec      is currently set to  37:37
Mixer ogain    is currently set to 100:100
Recording source: mic
```


----------



## SirDice (Jun 6, 2021)

quakerdoomer said:


> Not sure if they're deprecated now


They're not deprecated but they're not needed either. They're already loaded in the GENERIC kernel.


----------



## quakerdoomer (Jun 6, 2021)

Thanks SirDice. I read this later in a separate post made by you elsewhere. Any advise what I should do next?


SirDice said:


> They're not deprecated but they're not needed either. They're already loaded in the GENERIC kernel.


----------



## Alain De Vos (Jun 6, 2021)

You can install package "sox" and issue "rec -d test.wav"


----------



## quakerdoomer (Jun 7, 2021)

Okay so I had tried that earlier but regardless, I tried again and the file is totally silent. Volume controls are fine and other wave files play just perfect. The one I recorded didn't. So, what can I try next?


----------



## bsduck (Jun 7, 2021)

By default `mixer` opens /dev/mixer0 but there are often other mixers available.
Try `mixer -f /dev/mixer1` and so on with all the /dev/mixer* you have to see what's in there.


----------



## quakerdoomer (Jun 8, 2021)

```
# mixer -f /dev/mixer0
Mixer vol      is currently set to  85:85
Mixer pcm      is currently set to 100:100
Mixer speaker  is currently set to 100:100
Mixer mic      is currently set to  98:98
Mixer rec      is currently set to  37:37
Mixer ogain    is currently set to 100:100
Recording source: mic


# mixer -f /dev/mixer1
Mixer vol      is currently set to  85:85
Mixer pcm      is currently set to 100:100
Mixer ogain    is currently set to 100:100


# mixer -f /dev/mixer2
Mixer vol      is currently set to 100:100
Mixer pcm      is currently set to 100:100
```

???? I need to know what to do if I wish to use the inbuilt microphone!


----------



## Alain De Vos (Jun 8, 2021)

sox allows you to specify the device on the commandline


----------



## bsduck (Jun 8, 2021)

The only recording device available is on the default mixer, so the problem is elsewhere.

If you connect an external microphone, does it work?

What's the output of `sysctl dev.hdaa`?


----------



## quakerdoomer (Jun 9, 2021)

Thanks to everyone involved for your time. Really appreciate it.

The laptop has a single headphone jack (no separate inlet fora mic). I hooked an external microphone (although it's not reliable) into that headphone port and tried rec and did receive some disturbance recorded. I am not sure if that's a win.

sysctl's output can be temporarily found here :





						sysctl dev.hdaa.txt - File.re temporary file sharing
					






					file.re
				




Do let me know your analysis.


----------



## bsduck (Jun 9, 2021)

The automatic configuration seems to be wrong.

Your internal microphone is not listed as such, and I'm wondering which one of all the dev.hdaa.0.nid** it can be.

The fact there is a mixer for a microphone input jack together with a beep speaker looks like nonsense to me:

```
dev.hdaa.0.nid35: audio mixer
     Widget cap: 0x0020010b STEREO
    Association: 2 (0x0001)
            OSS: speaker, mic
      Input amp: 0x80000000 mute=1 step=0 size=0 offset=0 (0/0dB)
    Connections: 6
          + [DISABLED] <- nid=24 [pin: Speaker (None)] [DISABLED]
          + <- nid=25 [pin: Mic (Black Jack)]
          + [DISABLED] <- nid=26 [pin: Speaker (None)] [DISABLED]
          + [DISABLED] <- nid=27 [pin: Speaker (None)] [DISABLED]
          + <- nid=29 [beep widget]
          + [DISABLED] <- nid=18 [pin: Speaker (None)] [DISABLED]
```
Maybe the internal microphone is nid29, mislabeled as a beep speaker?
Do you get speaker listed as a rec device with `mixer -h`?
If yes then you can enable it with `mixer =rec speaker`.


----------



## quakerdoomer (Jun 10, 2021)

Yes" mixer -f" shows the following

devices: vol, pcm, speaker, mic, rec, ogain
rec devices: speaker, mic

I issued, as advised: "mixer =rec speaker"
Then tried rec -d test.wav
No sound recorded.

Reverted back to 
 "mixer =rec mic"
again tested recording. No luck 


What can we try next?

P.S.
Would it help testing rec and if we find success then maybe 'dmesg' or a relevant command from any Linux OS or  Net/OpenBSD ?


----------



## astyle (Jun 10, 2021)

I have a hard time buying the idea that a headphone jack can also be used as a microphone jack...  those are supposed to be two separate things. You can probably plug in a USB mic and use that. Then the FreeBSD utilities should work fine to configure that. Just plug it in, do `# dmesg | grep tail -f`, and start there.


----------



## quakerdoomer (Jun 11, 2021)

I do not wish to use an external (USB) mic. I am trying to solve the issue of using the internal mic since it's working fine as tested on other OSes.


----------

