[alsa-devel] wrong decibel data?

Raymond Yau superquad.vortex2 at gmail.com
Tue Jun 8 02:47:21 CEST 2010


2010/6/7 Colin Guthrie <gmane at colin.guthr.ie>

> >
> > 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).
>

Seem that my value is still wrong , every -6dB half the volume

so 1.5 is +6dB , 1.0 is 0dB, -6dB is 0.5 , -12 dB is 0.25, -18dB is 0.125,
-24dB is 0.0625

if shift 16 bit digital audio data to right by 1 bit is -6dB ,   -96dB is
0.000015



>
> 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#23151
>     *
>     * 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 forumla for the "Master" volume control of pulse device
? ctl.pulse

there are 65536 steps ,
where are  0dB  , -6dB  and -inf dB on this cubic mapping ?


More information about the Alsa-devel mailing list