# How to get microphone feedback ?



## buganini (Aug 16, 2010)

I have Conexant CX20561 (Hermosa), I can record with audacity,
but sometimes I want mic input go to output directly.

IIRC, on my broken old laptop I can get this by something like `mixer mic 70`
but on this laptop it only affect recording volume.

Or if that is hardware feature, does any program and do this?
I tried to cat /dev/dspX.Y to a file, but I got a 0B file.


----------



## mav@ (Aug 16, 2010)

Analog input-to-output loopback implemented inside of many codecs, though not all. When it is implemented, snd_hda driver tries to find it and provide it's control as igain mixer control.

I don't have datasheet for Connexant codecs to tell if it is implemented there or not. Probably the only way is to study snd_hda driver's verbose boot messages. These messages include most of information required to understand codec's internals. I may look on it if you need, if you post it somewhere.


----------



## buganini (Aug 16, 2010)

verbose log
http://pastebin.com/9caitQF9

my device.hints

```
hint.hdac.0.cad0.nid3.config="as=0"
hint.hdac.0.cad2.nid22.config="as=1 seq=15"
hint.hdac.0.cad2.nid24.config="as=2"
hint.hdac.0.cad2.nid26.config="as=1"
hint.hdac.0.cad2.nid29.config="as=3"
```

BTW
I can't set nid24(mic) and nid26(monitor) to the same as,
i got trace fail, undo trace, then they became disabled.


----------



## buganini (Aug 16, 2010)

without configure device.hints it was

```
nid3 (Intel G45 HDMI) on pcm0
nid22, nid24 on pcm1
nid26, nid29 on pcm2
```


now I'm using [cmd=]cat /dev/dsp > /dev/dsp[/cmd] and it's working, while I didn't see /dev/dsp exists.
(but the latency is too long for me)


----------



## nano_tauluna (Aug 17, 2010)

have you try using mixer in command line ?


```
freebsd-2770# mixer
Mixer vol      is currently set to  75:75
Mixer bass     is currently set to  50:50
Mixer treble   is currently set to  50:50
Mixer pcm      is currently set to  75:75
Mixer line     is currently set to  75:75
Mixer mic      is currently set to   0:0
Mixer cd       is currently set to  75:75
Mixer rec      is currently set to  75:75
Mixer igain    is currently set to   0:0
Mixer line1    is currently set to  75:75
Mixer phin     is currently set to   0:0
Mixer video    is currently set to  75:75
Recording source: mic
```

When I want to hear microphone feed back I just adjust mic up

```
freebsd-2770# mixer mic 50:50
Setting the mixer mic from 0:0 to 50:50.
```

To change recording level

```
freebsd-2770# mixer rec 50:50
Setting the mixer rec from 75:75 to 50:50.
```


----------



## mav@ (Aug 17, 2010)

buganini said:
			
		

> verbose log
> http://pastebin.com/9caitQF9



As I can see, this CODEC has no analog loopback. So the only loopback you may obtain is digital, which by definition give you some delay. You may try to minimize this delay using sysctl's defined by sound(4), though it won't be zero.


----------



## buganini (Aug 17, 2010)

Is there a way to do digital loopback by pcm or snd_hda ?
something like when hardware muting is not available, snd_hda disable output by itself.


----------



## buganini (Aug 17, 2010)

besides tuning hw.snd.latency,
[cmd=]sysctl dev.pcm.0.bitperfect=1[/cmd]
also helps a lot.


----------

