snd_hda(4): getting line-in to work

Garrett Cooper yanefbsd at gmail.com
Mon Jan 12 22:49:04 PST 2009


On Fri, Jan 9, 2009 at 12:29 AM, Alexander Motin <mav at freebsd.org> wrote:
> Garrett Cooper wrote:
>> On Thu, Jan 8, 2009 at 11:11 AM, Alexander Motin <mav at freebsd.org> 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
> them.
>
>> 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.

    Good call -- perhaps this tip should be noted in the manpage (or
at the very least in the handbook under the sound section)? Here are
my current values (yes, line is set to 2% per channel ;)...):

[gcooper at orangebox /usr/home/gcooper]$ mixer
Mixer vol      is currently set to 100:100
Mixer pcm      is currently set to 100:100
Mixer speaker  is currently set to  75:75
Mixer line     is currently set to   2:2
Mixer mic      is currently set to   0:0
Mixer cd       is currently set to  75:75
Mixer mix      is currently set to  86:86
Mixer rec      is currently set to   0:0
Mixer monitor  is currently set to  75:75
Recording source: line

    This definitely makes playing DVD's from my PS2 bearable (no
clipping; it's on par with the volume from my pcm / vol channels)
while I wait for mplayer's libdvdcss support to be supported by my
BlueRay DVD drive.
    Let me know if you ever need someone to feature test something
with snd_hda(4) for you in the future ;).
    Thanks again for all of the help Alexander!
Cheers,
-Garrett


More information about the freebsd-current mailing list