[pulseaudio-discuss] Software volume: linear vs. logarithmic

"Günter Merz" lotan_rm at gmx.de
Wed Aug 22 06:14:45 PDT 2012


Hi

I'm a bit confused as to why so many pulseaudio implementations (xine, gstreamer to name two) seem to use linear software volumes rather than logarithmic ones.

Using linear volumes seems really counter intuitive to me as it leaves very little control (numerically) in the low volume area and very much flexibility in the high volume area, where it's not needed.  A quick search shows that other users seem to agree with me:

   http://askubuntu.com/questions/19593/how-do-i-make-my-volume-indicator-operate-in-decibels-instead-of-percentage
   https://bugs.launchpad.net/ubuntu/+source/alsa-lib/+bug/204898
   https://bugzilla.redhat.com/show_bug.cgi?id=501972

Can anyone explain the reasoning behind this?

I wonder if it has something to do with the second paragraph (Calculations) in

   http://freedesktop.org/software/pulseaudio/doxygen/volume.html

which advises:

   The volumes in PulseAudio are logarithmic in nature and applications shouldn't perform calculations with them directly. Instead, they should be converted to and from either dB or a linear scale

For xine I tried to resolve my problem by submitting the following patch, which does volume calculations (and which, sadly for me, wasn't accepted upstream):

   http://old.nabble.com/attachment/29656611/0/logarithmic_volume.patch

The patch leaves me with a far more naturally feeling logarithmic volume scale.

I would like to do something similar to what I did in xine to pulsesink.c in the gstreamer-good package in order to change the rhythmbox and rygel (and others) volume handling but the fact that Lennart Poettering (once the lead developer) originally wrote the GStreamer pulseaudio plugin and will surely have had his reasons for doing it the way he did makes me ask here first.


More information about the pulseaudio-discuss mailing list