[alsa-devel] wrong decibel data?

Raymond Yau superquad.vortex2 at gmail.com
Sat Jun 12 04:02:30 CEST 2010


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

> 'Twas brillig, and Raymond Yau at 10/06/10 04:16 did gyre and gimble:
> > Can you explain how PA handle the volume controls of ac97 codec ?
> >
> > PCM -34.5dB to +*12* dB
> > Master -46.5dB to 0dB
> >
> > The total dB range (PCM + MASTER) is -81dB to +*12*dB
> >
> >
> > Most user concern about recording without distrotion. (i.e. best result
> when
> > Capture Volume at 0dB , PCM and Master Volume at 0dB ) and they need
> where
> > are 0dB points
>
> I'm not 100% sure how this is handled, but I know it's not ignored.
> You'll have to ask Lennart directly or dig in the code to see for sure.
>
> Col
>





- 顯示引用文字 -
since the master volume control of ac97 is 1.5 dB per step

using the following code to test snd_mixer_selem_set_playback_dB()  with
0.5dB

- 顯示引用文字 -
           for (v= db_min-100; v<=db_max+100; v+=50 ) {
              for (c=0; c<1; c++ ) {
                  value=v;
                  if (snd_mixer_selem_set_playback_
- 顯示引用文字 -
dB(elem, c, value, +1) == 0) {
                      if ( snd_mixer_selem_get_playback_dB(elem, c, &value)
== 0 )
                            printf("set %3.2f dB  get %3.2f
dB\n",v/100.0,value/100.0);
                   }
                   else
                       printf("fail to set %3.2f dB\n",v/100.0);
             };
        };


Master playback min=0 max=31
playback dB min -46.50 dB  db max 0.00 dB

set -47.50 dB  get -46.50 dB
set -47.00 dB  get -46.50 dB
set -46.50 dB  get -46.50 dB
set -46.00 dB  get -46.50 dB
set -45.50 dB  get -46.50 dB
set -45.00 dB  get -45.00 dB
set -44.50 dB  get -45.00 dB
set -44.00 dB  get -45.00 dB
set -43.50 dB  get -43.50 dB
set -43.00 dB  get -43.50 dB
set -42.50 dB  get -43.50 dB
set -42.00 dB  get -42.00 dB
set -41.50 dB  get -42.00 dB
set -41.00 dB  get -42.00 dB
set -40.50 dB  get -40.50 dB
set -40.00 dB  get -40.50 dB
set -39.50 dB  get -40.50 dB
set -39.00 dB  get -39.00 dB
set -38.50 dB  get -39.00 dB
set -38.00 dB  get -39.00 dB
set -37.50 dB  get -37.50 dB
set -37.00 dB  get -37.50 dB
set -36.50 dB  get -37.50 dB
set -36.00 dB  get -36.00 dB
set -35.50 dB  get -36.00 dB
set -35.00 dB  get -36.00 dB
set -34.50 dB  get -34.50 dB
set -34.00 dB  get -34.50 dB
set -33.50 dB  get -34.50 dB
set -33.00 dB  get -33.00 dB
set -32.50 dB  get -33.00 dB
set -32.00 dB  get -33.00 dB
set -31.50 dB  get -31.50 dB
set -31.00 dB  get -31.50 dB
set -30.50 dB  get -31.50 dB
set -30.00 dB  get -30.00 dB
set -29.50 dB  get -30.00 dB
set -29.00 dB  get -30.00 dB
set -28.50 dB  get -28.50 dB
set -28.00 dB  get -28.50 dB
set -27.50 dB  get -28.50 dB
set -27.00 dB  get -27.00 dB
set -26.50 dB  get -27.00 dB
set -26.00 dB  get -27.00 dB
set -25.50 dB  get -25.50 dB
set -25.00 dB  get -25.50 dB
set -24.50 dB  get -25.50 dB
set -24.00 dB  get -24.00 dB
set -23.50 dB  get -24.00 dB
set -23.00 dB  get -24.00 dB
set -22.50 dB  get -22.50 dB
set -22.00 dB  get -22.50 dB
set -21.50 dB  get -22.50 dB
set -21.00 dB  get -21.00 dB
set -20.50 dB  get -21.00 dB
set -20.00 dB  get -21.00 dB
set -19.50 dB  get -19.50 dB
set -19.00 dB  get -19.50 dB
set -18.50 dB  get -19.50 dB
set -18.00 dB  get -18.00 dB
set -17.50 dB  get -18.00 dB
set -17.00 dB  get -18.00 dB
set -16.50 dB  get -16.50 dB
set -16.00 dB  get -16.50 dB
set -15.50 dB  get -16.50 dB
set -15.00 dB  get -15.00 dB
set -14.50 dB  get -15.00 dB
set -14.00 dB  get -15.00 dB
set -13.50 dB  get -13.50 dB
set -13.00 dB  get -13.50 dB
set -12.50 dB  get -13.50 dB
set -12.00 dB  get -12.00 dB
set -11.50 dB  get -12.00 dB
set -11.00 dB  get -12.00 dB
set -10.50 dB  get -10.50 dB
set -10.00 dB  get -10.50 dB
set -9.50 dB  get -10.50 dB
set -9.00 dB  get -9.00 dB
set -8.50 dB  get -9.00 dB
set -8.00 dB  get -9.00 dB
set -7.50 dB  get -7.50 dB
set -7.00 dB  get -7.50 dB
set -6.50 dB  get -7.50 dB
set -6.00 dB  get -6.00 dB
set -5.50 dB  get -6.00 dB
set -5.00 dB  get -6.00 dB
set -4.50 dB  get -4.50 dB
set -4.00 dB  get -4.50 dB
set -3.50 dB  get -4.50 dB
set -3.00 dB  get -3.00 dB
set -2.50 dB  get -3.00 dB
set -2.00 dB  get -3.00 dB
set -1.50 dB  get -1.50 dB
set -1.00 dB  get -1.50 dB
set -0.50 dB  get -1.50 dB
set 0.00 dB  get 0.00 dB
set 0.50 dB  get 0.00 dB
set 1.00 dB  get 0.00 dB


Compared with the result by voltest.c of pulseaudio-0.9.13

 ./voltest
Volume:   0; percent: 0%; decibel -inf; linear = 0.00; volume(decibel):   0;
volume(linear):   0
Volume: 256; percent: 0%; decibel -59.77; linear = 0.00; volume(decibel):
256; volume(linear): 256
Volume: 512; percent: 0%; decibel -59.53; linear = 0.00; volume(decibel):
512; volume(linear): 512
Volume: 768; percent: 1%; decibel -59.30; linear = 0.00; volume(decibel):
768; volume(linear): 768
Volume: 1024; percent: 1%; decibel -59.06; linear = 0.00; volume(decibel):
1024; volume(linear): 1024
Volume: 1280; percent: 1%; decibel -58.83; linear = 0.00; volume(decibel):
1280; volume(linear): 1280
...

Volume: 6656; percent: 10%; decibel -53.91; linear = 0.00; volume(decibel):
6656; volume(linear): 6656
Volume: 6912; percent: 10%; decibel -53.67; linear = 0.00; volume(decibel):
6912; volume(linear): 6912
Volume: 7168; percent: 10%; decibel -53.44; linear = 0.00; volume(decibel):
7168; volume(linear): 7168

...

Volume: 9216; percent: 14%; decibel -51.56; linear = 0.00; volume(decibel):
9216; volume(linear): 9216
Volume: 9472; percent: 14%; decibel -51.33; linear = 0.00; volume(decibel):
9472; volume(linear): 9472
Volume: 9728; percent: 14%; decibel -51.09; linear = 0.00; volume(decibel):
9728; volume(linear): 9728
Volume: 9984; percent: 15%; decibel -50.86; linear = 0.00; volume(decibel):
9984; volume(linear): 9984
Volume: 10240; percent: 15%; decibel -50.62; linear = 0.00; volume(decibel):
10240; volume(linear): 10240
Volume: 10496; percent: 16%; decibel -50.39; linear = 0.00; volume(decibel):
10496; volume(linear): 10496
Volume: 10752; percent: 16%; decibel -50.16; linear = 0.00; volume(decibel):
10752; volume(linear): 10752
Volume: 11008; percent: 16%; decibel -49.92; linear = 0.00; volume(decibel):
11008; volume(linear): 11008

...

Volume: 15872; percent: 24%; decibel -45.47; linear = 0.01; volume(decibel):
15872; volume(linear): 15872
Volume: 16128; percent: 24%; decibel -45.23; linear = 0.01; volume(decibel):
16128; volume(linear): 16128
Volume: 16384; percent: 25%; decibel -45.00; linear = 0.01; volume(decibel):
16384; volume(linear): 16384
Volume: 16640; percent: 25%; decibel -44.77; linear = 0.01; volume(decibel):
16640; volume(linear): 16640
Volume: 16896; percent: 25%; decibel -44.53; linear = 0.01; volume(decibel):
16896; volume(linear): 16896

...

Volume: 32000; percent: 48%; decibel -30.70; linear = 0.03; volume(decibel):
32000; volume(linear): 32000
Volume: 32256; percent: 49%; decibel -30.47; linear = 0.03; volume(decibel):
32256; volume(linear): 32256
Volume: 32512; percent: 49%; decibel -30.23; linear = 0.03; volume(decibel):
32512; volume(linear): 32512
Volume: 32768; percent: 50%; decibel -30.00; linear = 0.03; volume(decibel):
32768; volume(linear): 32768
Volume: 33024; percent: 50%; decibel -29.77; linear = 0.03; volume(decibel):
33024; volume(linear): 33024
Volume: 33280; percent: 50%; decibel -29.53; linear = 0.03; volume(decibel):
33280; volume(linear): 33280
...

Volume: 64512; percent: 98%; decibel -0.94; linear = 0.90; volume(decibel):
64512; volume(linear): 64512
Volume: 64768; percent: 98%; decibel -0.70; linear = 0.92; volume(decibel):
64768; volume(linear): 64768
Volume: 65024; percent: 99%; decibel -0.47; linear = 0.95; volume(decibel):
65024; volume(linear): 65024
Volume: 65280; percent: 99%; decibel -0.23; linear = 0.97; volume(decibel):
65280; volume(linear): 65280
Volume: 65536; percent: 100%; decibel 0.00; linear = 1.00; volume(decibel):
65536; volume(linear): 65536
Volume: 65792; percent: 100%; decibel 0.23; linear = 1.03; volume(decibel):
65792; volume(linear): 65792
Volume: 66048; percent: 100%; decibel 0.47; linear = 1.06; volume(decibel):
66048; volume(linear): 66048

..

Volume: 98048; percent: 149%; decibel 29.77; linear = 30.78;
volume(decibel): 98048; volume(linear): 98048
Volume: 98304; percent: 150%; decibel 30.00; linear = 31.62;
volume(decibel): 98304; volume(linear): 98304
Volume: 98560; percent: 150%; decibel 30.23; linear = 32.49;
volume(decibel): 98560; volume(linear): 98560
Volume: 98816; percent: 150%; decibel 30.47; linear = 33.38;
volume(decibel): 98816; volume(linear): 98816

...

volume(linear): 130560
Volume: 130816; percent: 199%; decibel 59.77; linear = 973.38;
volume(decibel): 130816; volume(linear): 130816
Volume: 131072; percent: 200%; decibel 60.00; linear = 1000.00;
volume(decibel): 131072; volume(linear): 131072

can you explain why PA voltest can set dB better than hardware can support (
ac97 only 1.5dB per step ) ?


More information about the Alsa-devel mailing list