snd_hda(4): getting line-in to work

Alexander Motin mav at
Fri Jan 9 00:29:41 PST 2009

Garrett Cooper wrote:
> On Thu, Jan 8, 2009 at 11:11 AM, Alexander Motin <mav at> wrote:
>> Garrett Cooper wrote:
>>>    Ok, I got stuck again. Can you possibly push me in the right
>>> direction (complete verbose dmesg attached)? The line-in and SPDIF
>>> (not so much of a concern) are the only issues that I'm aware of. I'll
>>> have to open up my case and wire up the front ports in order to test
>>> them for you.
>> Ok. Let's stop for a moment and start from the beginning, because now it is
>> already like a puzzle for me too. Let me explain once more what I see you
>> have and then you explain me where is your problem.
>> You have 3 PCM devices configured:
>> - pcm0: 7.1 playback via 4 rear jacks (Green, Black, Orange and Grey) +
>> record from mic (front Pink), line (rear Blue), monitor (second mic, rear
>> Pink), cd (internal Black) or mix (sum of all these).
>> - pcm1: stereo playback via front Green jack.
>> - pcm2: SPDIF output
>> As for me, this configuration is correct and good enough. You can record
>> from your line-in via pcm0 after selecting that source via `mixer =rec line`
>> command. You can playback via SPDIF by using pcm2 device.
>> So what's wrong? What are you doing and what is not working and how?
> Ok, just checking my sanity, I started swapping around the plugs in
> the back, checking my connections, etc. I tried my mic, worked (the
> gain was a bit small, sound was _really_ distorted), then switched

It is possible to control external mic phantom power via loader.conf. I
have never tried it myself, but it may be related.

> back to my line-in and sure enough, it now works :D.
> What changed since yesterday:
> - I hadn't set mixer_enable="YES" in rc.conf. This brought up a LOT
> more channels and options than I had originally.

Don't very understand what you mean by channels. mixer_enable just loads
mixer settings saved on shutdown.

> - Rebooted the machine with fixed device.hints (unchanged from the default :P).
> - I changed the volume for mix from 0:0 to 30:30.

mix now controls volume of mixed inputs recording (if you select this
record source. I would prefer direct line recording) and input
monitoring. Sure it is not very good, I am thinking to somehow separate

> My summary (experience) thus far:
> So far the driver functions as expected, but the frequency response
> seems a bit off for the output -- it's really focused around the vocal
> range (the lower 3 frequencies on the audacity, iTunes, xmms equalizer
> -- forget the frequencies).
> It's not so bad with PCM sound, but It's really off with Line-in /
> Mic. Any hints or hacking I can do to adjust the voltage levels sent
> to the ADC's in the hardware?

There is no standardized ADC controls in HDA specification. Some codecs
allows loading some unstandardized "processing coefficients" for some
widgets, but I don't see respective "PROC" capability in your verbose
output. All you can is to control amplifiers gains and Vref for mics.

If you have distorted sound on line-in, I would recommend you to check
gains of all amplifiers inside codec where signal passes. Most inputs of
your codec (including line) have +30dB mic pre-amplifiers. It is good
for mics, but not needed for line-in. Set mixer "line" level to the
lowest nonzero value to disable pre-amplification (without muting it)
and avoid signal clipping there. Control recording level by other
controls. If you are recording from mix, but not from the line, take
note that mix control also have +12dB upper amplifier control range, so
setting it to maximum values can also produce clipping. All this
information obtained from your dmesg.

>>>    Also, the knobs that show up in xfce4-mixer are completely useless
>>> for snd_hda(4) (every time I move the sliders it sets the volume back
>>> to 0). Is this a known issue?
>> You are the first.
> oss was complaining about a `unable to open mixer recording device:
> bad file descriptor' whenever I try and set the mixer levels by
> opening it up directly from the GUI. Interestingly enough when I
> opened up the mixer from an xterm, it worked 0-o.. However, I just
> toasted ~/.config/xfce4/mixer/* and now it works, so apparently it was
> bad cached preferences.

Fine. I am just using standard console `mixer` tool.

Alexander Motin

More information about the freebsd-current mailing list