# Microphone not working(only under freebsd)



## BsDjUsTbSd (May 6, 2020)

Hello comrades, my microphone on freebsd(only doesn't) work. It's probably not freebsd's fault maybe i need to configure it. i tried through graphical and non graphical.
The device works and i am 1000% sure about it because it works on my macbook,linux and openbsd. The microphone is usb NOT analog. I DON'T have an external or internal EXTRA sound card.
It's just plugged into usb. If you know any fix help me.

Thanks for your attention comrades.


----------



## SirDice (May 6, 2020)

Handbook: 7.2. Setting Up the Sound Card


----------



## BsDjUsTbSd (May 6, 2020)

But i don't have a sound `I DON'T have an external or internal EXTRA sound card.`


----------



## SirDice (May 6, 2020)

BsDjUsTbSd said:


> But i don't have a sound `I DON'T have an external or internal EXTRA sound card.`


That's irrelevant, you don't need one.  



BsDjUsTbSd said:


> The microphone is usb NOT analog.


That means this microphone has its own sound card builtin.


----------



## BsDjUsTbSd (May 6, 2020)

why is it irrelevant?


----------



## SirDice (May 6, 2020)

Microphones are _always_ analog, that's how they work. Because yours is plugged in on USB that means there's an analog to digital converter in there too. And that's exactly what a sound card does. So you DO have an 'extra' soundcard, one that's built into the microphone itself.


----------



## unitrunker (May 6, 2020)

With on-board sound systems like AC97 and HDMI / Display Port, the term 'sound card' is a bit antiquated.


----------



## SirDice (May 6, 2020)

unitrunker said:


> With on-board sound systems like AC97 and HDMI / Display Port, the term 'sound card' is a bit antiquated.


True. But it's something that non-technical persons might understand.


----------



## BsDjUsTbSd (May 6, 2020)

Thanks comrade. i guess i will stay with no mic. It's ok. still like freebsd


----------



## stimi (May 15, 2020)

You misunderstand. You were 100% correct in the OP. its not FreeBSD, at all, it needs to be manually configured. SirDice is saying your microphone IS a sound card, or at least, is treated as one by FreeBSD. And you need to look for a driver to treat it as such. There are ways to narrow that down so   we can figure it out. For example: If you turn on your FreeBSD machine with the mic plugged into its USB port and login, what is the output of dmesg()? From there we should be able to help using the handbook SirDice provided.


----------



## Dave Lister (Jun 3, 2020)

I followed the handbook, chapter 7.2 Setting Up The Sound Card, to get a regular analogue jack microphone working, but no joy.


```
# kldload snd_hda
kldload: can't load snd_hda: module already loaded or in kernel
# kldload snd_driver
```
I added `snd_hda_load="YES"` to /boot/loader.conf
I tried

```
# device sound
su: device: command not found
```

The pertinent output line from 
	
	



```
# dmesg
```
 seems to be:-

```
dmesg | grep pcm
pcm0: <Realtek ALC882 (Rear Digital 10ch/2.0)> at nid 20,22,21,23,30 and 31 on hdaa0
pcm1: <Realtek ALC882 (Analog 2.0/5.1)> at nid 27 and 26,28,24 on hdaa0
# cat /dev/sndstat
Installed devices:
pcm0: <Realtek ALC882 (Rear Digital 10ch/2.0)> (play/rec) default
pcm1: <Realtek ALC882 (Analog 2.0/5.1)> (play/rec)
No devices installed from userspace.
```

Any suggestions as to what I might try next?

[full dmesg output attached]


----------



## unitrunker (Jun 3, 2020)

Hi Dave;
set mixer1 as your default. Make sure you can hear audio from your speaker or headphones.


----------



## Dave Lister (Jun 3, 2020)

unitrunker said:


> Hi Dave;
> set mixer1 as your default. Make sure you can hear audio from your speaker or headphones.


I tried the following:-

```
# sysctl hw.snd.default_unit=1
hw.snd.default_unit: 0 -> 1
```

Audacity now seems to be working - it tries to record and playback, and the monitor seems to be active - where before it didn't do anything, however, I've tried 2 different mics but no sound is being picked up.

Also tried...

```
# mixer -f /dev/mixer1
Mixer vol      is currently set to  78:78
Mixer pcm      is currently set to 100:100
Mixer line     is currently set to  71:71
Mixer mic      is currently set to  67:67
Mixer cd       is currently set to  50:50
Mixer rec      is currently set to  26:26
Mixer igain    is currently set to 100:100
Recording source: line, mic, cd
```

but still no sound being picked up. However, also, noted that now I at least have a line trace on xoscope where there was none before, but there is no waveform when I use the mic.


----------



## unitrunker (Jun 4, 2020)

Look for a jump in the xoscope line when you plug / unplug the microphone.


----------



## Dave Lister (Jun 4, 2020)

unitrunker said:


> Look for a jump in the xoscope line when you plug / unplug the microphone.


No trace jump when I plug the mic in/out of the socket. I tried 2 mics, both front and back of the desktop tower.

Also, after reboot I lost the xoscope trace, so, I confirm it was the sysctl command rather than the mixer command that activates it.  Any ideas where I might place that command so that it is activated on boot up?


----------



## unitrunker (Jun 4, 2020)

It's in the handbook page linked by sirdice.

/etc/sysctl.conf

Add one line:

hw.snd.default_unit=1


----------



## Dave Lister (Jun 4, 2020)

1 step forward 2 steps back. Somehow got the mic partially active - it now makes a noise through the speakers - my voice will come through but the quality isn't great. Neither audacity nor xoscope are picking anything up.  At least I have sound output back, I lost that for a while, sigh.


----------



## Alain De Vos (Jun 4, 2020)

I have had problems with audacity. Try to record with ffmpeg


----------



## Dave Lister (Jun 4, 2020)

1 step forward 2 steps back. Somehow got the mic partially active - it now makes a noise through the speakers - my voice will come through but the quality isn't great. Neither audacity nor xoscope are picking anything up.  At least I have sound output back, I lost that for a while, sigh.

Turns out, sound works on a browser, eg. youtube, but sample wav and mp3s don't don't pay through the speakers.  Narrowing things down, but I'm calling it a day for tonight.


----------



## hruodr (Jun 8, 2020)

With `pkg install sndio` you get OpenBSDs command `aucat`. Try with it.

For example `aucat -o file.wav` for recording and `aucat -i file.wav` for playing. I get good quality (and big files).

For mp3 you do `pkg install mpg123` for playing and compile audio/lame for recording.

You record with `aucat -o - | lame -r - file.mpg` and play with `mpg123 file.mpg`, but the quality is not the best.

That were my experiments.

With every VoIP softphone I have problems with audio.


----------

