'Twas brillig, and Raymond Yau at 06/06/10 01:12 did gyre and gimble:
2010/5/28 Colin Guthrie gmane@colin.guthr.ie
'Twas brillig, and Colin Guthrie at 27/05/10 15:43 did gyre and gimble:
PA should play nice with the softvol plugin so I don't think this is the bit that is at fault.
I strongly suspect that the reason has already been correctly identified a while ago, which is that this card considers -48dB silent where as PA assumes this level is -200dB. I believe it was Raymond who pointed out the -48dB level in the HDA spec before on this list.
if floating point 0.0 is -inf dB , and 1.0 is 0dB ,
0.5 is -6dB , 0.25 is -12 dB , 0.125 is -24dB and 0.0625 is -48dB
This is just a pure mapping from dB->linear, but as this linear mapping is generally not "natural" there are several different approaches to presenting this to users. In PA, a cubic mapping is used on top of this basic conversion, to map to the percentage scale (0.0 to 1.0 if you like).
So I'm not sure what point you're making by providing these numbers. Can you explain?
how can PA master volume control at 10~15% equivalent to HDA 's -48dB ?
Not sure what you mean here, but I suspect it's the cubic mapping that is confusing you.
Here is the function in PA's pulse/volume.c:
pa_volume_t pa_sw_volume_from_linear(double v) {
if (v <= 0.0) return PA_VOLUME_MUTED;
/* * We use a cubic mapping here, as suggested and discussed here: * * http://www.robotplanet.dk/audio/audio_gui_design/ * http://lists.linuxaudio.org/pipermail/linux-audio-dev/2009-May/thread.html#2... * * We make sure that the conversion to linear and back yields the * same volume value! That's why we need the lround() below! */
return (pa_volume_t) lround(cbrt(v) * PA_VOLUME_NORM); }
Can you provide the pulseaudio log when you change the volume from 100% to 0% ?
I can provide the actual log output if you like but here is the output from the following command:
(for i in 100 95 90 85 80 75 70 65 60 55 50 45 40 35 30 25 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0; do echo "============================== $i% =============="; amixer set Master $i%>/dev/null; amixer -c0 get Master; amixer -c0 get PCM; echo "PulseAudio:"; pacmd list-sinks| grep "index: 11" -A 13; done) 2>&1
volume-test.txt
This basically sets the volume (via alsa->pulse plugin, but that's just for convenience!) all the way down to 0. I get more fine grained below 20 as that is the interesting zone.
The output shows the scaling from 100% where both Master and PCM are 0dB, up to the point at around 16% where the Master channel is maxed out at -46.5dB (0%) and PA starts instead manipulating the PCM control to get more of it's range (up until this point PCM was only used to gain more accuracy - i.e. when Master alone did not provide as fine grained a setting as was needed; in this scenario, PA will use the PCM control to get more accuracy and, if needed, it will also use software scaling on top of that: for more info about this works see: http://pulseaudio.org/wiki/PulseAudioStoleMyVolumes).
As you can see from the output, by the time we reach 2%, both Master and PCM are fully maxed out at -46.5dB and -51dB respectively. At this point PA wants a volume of -101.93dB, so that means that -101.93 - (-51+-46.5=-96.5) = -5.43 dB is performed in software.
By 1%, the software component of the reduction increases to -23.47dB to give a total of -119.97dB. By 0% we reach -inf dB
Obviously the fact that the chip basically cuts off any audio when the Master slider hits 0 (or perhaps when the combined volume reaches -48dB - it's hard to tell) doesn't really play nicely with the real value of -inf which we attempt to reach.
I'm not sure where this problem needs to be fixed. Oviously having a Master and PCM slider whose range is far greater than the value of -48dB is pointless. This configuration means that there are numerous "zero point" configurations of the two sliders beyond which any further change in value is useless. So disregarding PA completely, this setup is not ideal.
When PA is used, the value for -inf is actually configured by the system and we attempt to scale to -inf (albeit via a cubic mapping from percentage). If the volume literally cuts out at -48dB when dealing with the h/w mixers, then there is a problem, but by the same token if the -48dB level really is more like the silence we want to represent, then perhaps trying to scale to -inf is pointless in itself and really the range of the scale used in PA should be adjusted.
I don't know enough about this side of things to comment more accurately than this, so when LinuxTag is over, hopefully Lennart can comment a bit on this thread to add his opinions to the mix.
Col
Col