[pulseaudio-discuss] Mic Boost on AC97 audio causes bad behavior of mic volume control

Wilck, Martin martin.wilck at ts.fujitsu.com
Thu Apr 23 03:02:59 PDT 2015


Hello Raymond,

On Do, 2015-04-23 at 10:53 +0800, Raymond Yau wrote:

> It strange that you just have two instead of three if you have dock
> mic

There are three ports, "mic", "dock mic", and "internal mic",
corresponding to the laptops built-in mic, the mic jack of the docking
station, and the mic jack on the laptop itself. Each mic has a separate
"Mic Boost" control in ALSA which doesn't affect the other mics. I am
attaching /proc/alsa/card1/codec#0 for your reference.

I'm not sure why you find this strange. If pulseaudio did configure and
merge in two separate "Mic Boost" volumes, the erratic behavior would be
even worse. Fortunately it doesn't.

> If the internal mic has no boost control, the dB range is suddenly
> increased when you plug Mic or Dock Mic  ?

The internal mic does have a boost control, like the other mics, see
above. If I use different path conf settings for the difference mics
(e.g. "volume=merge" for Internal Mic and "volume=1" for Dock Mic), the
dynamic range indicated by PA indeed changes when the input is switched
(aka the dock mic is plugged). 

> Since alc282 has a separate dmic  , this mean the driver need to use
> dynamic ADC switching if your laptop internal Mic use dmic instead of
> switching input sources with the audio mixer as selector

I don't quite understand what you are saying here. I can tell that the
input source is switched automatically when the Mic is plugged,
pulseaudio notices, and the dynamic range changes back and forth:

D: [pulseaudio] module-alsa-card.c: Jack 'Dock Mic Jack' is now plugged
in
D: [pulseaudio] device-port.c: Setting port analog-input-internal-mic to
status no
D: [pulseaudio] device-port.c: Setting port analog-input-dock-mic to
status yes

D: [alsa-source-ALC282 Analog] alsa-mixer.c: Activating path
analog-input-dock-mic
D: [alsa-source-ALC282 Analog] alsa-mixer.c: Path analog-input-dock-mic
(Dock Microphone), direction=2, priority=78, probed=yes, supported=yes,
has_mute=yes, has_volume=yes, has_dB=yes, min_volume=0, max_volume=63,
min_dB=-17,25, max_dB=30
D: [alsa-source-ALC282 Analog] alsa-mixer.c: Element Dock Mic Boost,
direction=2, switch=0, volume=4, volume_limit=-1, enumeration=0,
required=0, required_any=4, required_absent=0, mask=0x3600000000f66,
n_channels=2, override_map=yes
D: [alsa-source-ALC282 Analog] alsa-mixer.c: Element Mic Boost,
direction=2, switch=0, volume=2, volume_limit=-1, enumeration=0,
required=0, required_any=0, required_absent=0, mask=0x6, n_channels=2,
override_map=no
D: [alsa-source-ALC282 Analog] alsa-mixer.c: Element Internal Mic Boost,
direction=2, switch=0, volume=2, volume_limit=-1, enumeration=0,
required=0, required_any=0, required_absent=0, mask=0x6, n_channels=2,
override_map=no
D: [alsa-source-ALC282 Analog] alsa-mixer.c: Element Capture,
direction=2, switch=1, volume=1, volume_limit=-1, enumeration=0,
required=0, required_any=0, required_absent=0, mask=0x3600000000f66,
n_channels=2, override_map=yes
[...]
I: [alsa-source-ALC282 Analog] alsa-source.c: Hardware volume ranges
from -17,25 dB to 30,00 dB.
I: [alsa-source-ALC282 Analog] alsa-source.c: Fixing base volume to
-30,00 dB

[...]

D: [pulseaudio] module-alsa-card.c: Jack 'Dock Mic Jack' is now
unplugged
D: [pulseaudio] device-port.c: Setting port analog-input-internal-mic to
status unknown
D: [pulseaudio] device-port.c: Setting port analog-input-dock-mic to
status no

D: [alsa-source-ALC282 Analog] alsa-mixer.c: Activating path
analog-input-internal-mic
D: [alsa-source-ALC282 Analog] alsa-mixer.c: Path
analog-input-internal-mic (Internal Microphone), direction=2,
priority=89, probed=yes, supported=yes, has_mute=yes, has_volume=yes,
has_dB=yes, min_volume=0, max_volume=3, min_dB=-17,25, max_dB=66
D: [alsa-source-ALC282 Analog] alsa-mixer.c: Element Internal Mic Boost,
direction=2, switch=0, volume=1, volume_limit=-1, enumeration=0,
required=0, required_any=4, required_absent=0, mask=0x3600000000f66,
n_channels=2, override_map=yes
D: [alsa-source-ALC282 Analog] alsa-mixer.c: Element Mic Boost,
direction=2, switch=0, volume=2, volume_limit=-1, enumeration=0,
required=0, required_any=0, required_absent=0, mask=0x6, n_channels=2,
override_map=no
D: [alsa-source-ALC282 Analog] alsa-mixer.c: Element Dock Mic Boost,
direction=2, switch=0, volume=2, volume_limit=-1, enumeration=0,
required=0, required_any=0, required_absent=0, mask=0x6, n_channels=2,
override_map=no
D: [alsa-source-ALC282 Analog] alsa-mixer.c: Element Capture,
direction=2, switch=1, volume=1, volume_limit=-1, enumeration=0,
required=0, required_any=0, required_absent=0, mask=0x3600000000f66,
n_channels=2, override_map=yes
[...]
I: [alsa-source-ALC282 Analog] alsa-source.c: Hardware volume ranges
from -17,25 dB to 66,00 dB.
I: [alsa-source-ALC282 Analog] alsa-source.c: Fixing base volume to
-66,00 dB

Maybe this log also tells you why PA only configures a single "Boost"
for every port.

> > => There is no "smooth" volume control above 25%.
> > The graphical volume controls don't reflect this;
> 
> alsamixer -c0 cannot reflect the change on pulseaudio software
> volume ?

If the described effect occurs, I can see with alsamixer that the real
volume is jumping up and down. The volume displayed by "pactl list
sources" (and likewise by the sliders e.g. in the GNOME volume control
widget) is not the real but the user-set value.

Here is how PA, Capture, and Boost volume, in dB, correlate in the error
case (i.e. if "Capture" is listed before the relevant "Mic Boost" in the
path conf file, the current PA default). PA volumes are obtained using
"pactl list sources", Capture/Boost values using "amixer -c1 get
<scontrol>":

PA(%)	PA(dB)	Captu	Boost	Capture+Boost-66dB
121%	5.00	30.00	36.00	0.000000
100%	0.00	30.00	24.00	-12.000000
83%	-5.00	30.00	24.00	-12.000000
68%	-10.00	30.00	24.00	-12.000000
56%	-15.00	30.00	12.00	-24.000000
46%	-20.00	30.00	12.00	-24.000000
38%	-25.00	30.00	0.00	-36.000000
32%	-30.00	30.00	0.00	-36.000000
26%	-35.00	30.00	0.00	-36.000000
22%	-40.00	25.50	0.00	-40.500000
18%	-45.00	20.25	0.00	-45.750000
15%	-50.00	15.75	0.00	-50.250000
12%	-55.00	10.50	0.00	-55.500000
10%	-60.00	6.00	0.00	-60.000000
8%	-65.00	0.75	0.00	-65.250000
7%	-70.00	-4.50	0.00	-70.500000
6%	-75.00	-9.00	0.00	-75.000000
5%	-80.00	-14.25	0.00	-80.250000
4%	-85.00	-17.25	0.00	-83.250000

You can see that "Capture" is constant at 30dB above 22%. By comparing
the 2nd and last column you can see how inaccurately this control
behaves. 10dB deviation between desired and actual volume is common.

In contrast, if I list "Mic Boost" before "Capture" in the path conf
file, it looks like this:
PA(%)	PA(dB)	Captu	Boost	Capture+Boost-dB
121%	5.00	30.00	36.00	0.000000
100%	0.00	29.25	36.00	-0.750000
83%	-5.00	24.75	36.00	-5.250000
68%	-10.00	19.50	36.00	-10.500000
56%	-15.00	14.25	36.00	-15.750000
46%	-20.00	9.75	36.00	-20.250000
38%	-25.00	4.50	36.00	-25.500000
32%	-30.00	-0.75	36.00	-30.750000
26%	-35.00	-5.25	36.00	-35.250000
22%	-40.00	1.50	24.00	-40.500000
18%	-45.00	-3.75	24.00	-45.750000
15%	-50.00	3.75	12.00	-50.250000
12%	-55.00	-1.50	12.00	-55.500000
10%	-60.00	6.00	0.00	-60.000000
8%	-65.00	0.75	0.00	-65.250000
7%	-70.00	-4.50	0.00	-70.500000
6%	-75.00	-9.00	0.00	-75.000000
5%	-80.00	-14.25	0.00	-80.250000
4%	-85.00	-17.25	0.00	-83.250000

The accuracy is much better now, < 1dB almost everywhere. The boost
steps in at 12%/-55dB already.

> Do this occur only in dock Mic?

No, it occurs with all 3 Mics if I use the default PA settings in the
path configuration files.

> You need to check whether the driver set the amp in of the correct
> audio input correctly when using dock mic 

Yes it does. I see no indication of the opposite. I am positive that
this problem is caused by PA, not by the driver.

> Do pactl list source  indicate the dock Mic is active port ?

Yes. The active port switches behave correctly. See log output above.

Martin

> thus user control
> > input volume is almost impossible at higher levels than 25%. Volume
> will
> > appear to change non-predictably to users.
> >
> > By changing the ordering of "Capture" and "Mic Boost" in the path
> conf
> >
> file /usr/share/pulseaudio/alsa-mixer/paths/analog-input-dock-mic.conf,
> > I can get smooth changes over the whole dynamic range again.
> Therefore I
> > reckon that commit e6051cdf should be reverted because the effect
> > described here is general, while the noise level seems to be
> different
> > between models: On my system, there is no perceivable difference in
> > noise level if the overall volume is the same (thus, 30dB "Capture"
> +
> > 0dB "Boost" has the same noise level as 18 dB "Capture" and 12 dB
> > "Boost" or -6dB "Capure" and 36dB "Boost").
> >
> > 
> 

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: codec#0.txt
URL: <http://lists.freedesktop.org/archives/pulseaudio-discuss/attachments/20150423/860aa6b2/attachment-0001.txt>


More information about the pulseaudio-discuss mailing list