[pulseaudio-discuss] How to save mixer settings?

Colin Guthrie gmane at colin.guthr.ie
Wed Sep 22 03:30:44 PDT 2010


'Twas brillig, and Frode Severin Hatlevik at 22/09/10 10:06 did gyre and
gimble:
> 2010/9/21 Colin Guthrie <gmane at colin.guthr.ie>:
>>> Now I have a separate problem with kmix, seemingly.
>>> If I use 'alsamixer -c0' in a terminal to monitor what kmix is
>>> actually doing to my soundcard when raising and lowering the volume, I
>>> notice that the 'Master' control slider sets PCM to 100 or 98 when I
>>> raise the volume. If I lower the volume to 0, the PCM volume is also
>>> set to 0. Sometimes when I rise it again, the 'Front' channel is also
>>> set to 100.
>>>
>>> Is there a way for me to link the kmix 'master' volume to only
>>> manipulate the master volume of my hda_intel soundcard?
>>
>> This page explains it all.
>>
>> http://pulseaudio.org/wiki/PulseAudioStoleMyVolumes
>>
> 
> Thanks. So kmix is not misbehaving here, it is a feature of
> PulseAudio. But seemingly it does not work properly with my card.
> 
> My card is a HDA Intel with a Realtek ALC883 chip. Possibly pretty
> standard for a laptop?

It depends, HDA is more of a spec than a "device". HDA from different
vendors varies wildly, so not really considered "common" in that sense
(due to there being a lot of different variations that may behave
differently).

> Anyway, if I set all the volumes in alsamixer
> to 0 dB, then 'Master', 'PCM' and 'Front' are all set at their
> maximum, level 100 (and yes I know it's not a percentage...). This
> means the soundcard will be roaring at its maximum, and sound is
> outrageously loud.

This is actually an OK setup in this case. Many cards actually offer
>0dB volumes and in that case things get really messed up (IMO the PA
implementation here is not very nice, but that is another story).

> I suppose dB 0 for 'PCM' and 'Front' at level 100 is OK; it would mean
> something like "no amplification". It looks sort of strange though,
> and might be wrong (see below). But a 0 dB for master at level 100 is
> rather silly, is it not? The graphical bars in 'alsamixer' turns red
> at -6 dB (level 87), -7.6 dB (level 85-and-something), and 6 dB (level
> 87) for 'Master', 'PCM' and 'Front', respectivelly.

No, I think the 0dB = 100% is actually pretty sensible. 100% means no
attenuation, which is a sensible reresentation. Where things really get
messed up is when ALSA controls put e.g. +7dB = 100%. PA does deal with
this nicely, but IMO, not as nicely as it could.

> Do theese levels make sense to you? I thought maybe the 0 dB level
> should be at the breakpoint between the white and red parts of the
> graphs in alsamixer. This is the case for the 'Line', 'Mic' and 'Beep'
> controls. Does this situation qualify for a bug against the Alsa
> driver for my card/chip combination? Or perhaps I have the wrong
> module loaded?

Not really, see also this page:
http://pulseaudio.org/wiki/WritingVolumeControlUIs

particularly this bit:
http://pulseaudio.org/wiki/WritingVolumeControlUIs#Colouredvolumesliders

I suspect the colors in the alsamixer you are seeing are purely based on
% rather than dB, which will be pretty bad in the case of the kind of
sound cards I describe above.

Really all this problem stems from the fact that alsa mixers actually
stop at 0dB in your case. What we want to do is present a consistent
experience ot the user. If the hardware can't do something we should do
it in software and present users with the same UI regardless of the
underlying capabilities.

To do this we need to agree on an amount past 0dB to offer "software
amplification" e.g. >100%. In GNOME the tools allow up to "150%" which
equates to ~+11dB via our cubic mapping.

We have plans to roll this general principle out to all mixer
applications (including kmix), so that consistency can be established
(and that's really the major problem overall: different hardware being
inconsistent in it's mixer representation, thus users tend to just
"fiddle about" with sliders until they get "something that works",
rather than having a single, sensible and well presented single slider
that they just need to adjust to taste).

Plus when we fix the rate at +11dB, we will finally have Volumes that go
up to 11! http://en.wikipedia.org/wiki/Up_to_eleven  That's one louder!!

> Please find attached two files containing the output of 'amixer -c0',
> explaining the details of the situation.

These look pretty standard, nothing really wrong here.

> I like the system, but it seems I experience clipping from time to
> time. And I want to avoid that.

The real question is do you get clipping when you set the PA volume for
the sink to something less than 0dB/full? e.g if you set it to 80% or
similar is all well?

Problems *can* come in at the alsa level here. As master is controlled
first, then PCM etc. in a pipeline, PCM is quite often at it's 100%/0dB
value. This *should* mean that it doesn't affect the audio at all, but
if it's actually doing something like +2dB even tho' it says it's 0dB
then clipping can occur. If this happens then the alsa driver should be
fixed. 0dB should not clip any audio (it may be too loud for your
tastes, but it should not clip).

If bad dB data is present in your card, then you can see:
http://www.pulseaudio.org/wiki/BadDecibel


Col

-- 

Colin Guthrie
gmane(at)colin.guthr.ie
http://colin.guthr.ie/

Day Job:
  Tribalogic Limited [http://www.tribalogic.net/]
Open Source:
  Mageia Contributor [http://www.mageia.org/]
  PulseAudio Hacker [http://www.pulseaudio.org/]
  Trac Hacker [http://trac.edgewall.org/]




More information about the pulseaudio-discuss mailing list