Discussion:
Player volume a linear or logaritcmic value?
(too old to reply)
Sonnich Jensen
2015-12-22 19:37:00 UTC
Permalink
Hi all

I have been wondering - how the volume is regulated in computers. E.g. Windows offers a player, where the volume can be set by a byte, hence 0-255.
The human ear and volume knobs are logaritmic

This seems to be a linear scale, but sound is logarithmic?

So if I want to set this, should I think in providing this logarithmically, or does the component does it by itself?
What about smaller MP3 players or other sound devices? When using a DAC to set the volume?

WBR
Sonnich
Marcel Mueller
2015-12-22 21:20:25 UTC
Permalink
Post by Sonnich Jensen
I have been wondering - how the volume is regulated in computers. E.g. Windows offers a player, where the volume can be set by a byte, hence 0-255.
The human ear and volume knobs are logaritmic
This seems to be a linear scale, but sound is logarithmic?
So if I want to set this, should I think in providing this logarithmically, or does the component does it by itself?
It depends on Hardware and the driver. Sometimes the same API provides
linear scale with one device and logarithmic scale with another one.

Linear controls do not make any sense at all. But they are quite common
anyway.
If you need to program against a linear API a simple transformation
makes things much better:
x' = 1 / (1 + sqrt(10) * (1 - x)) x in [0..1]
While this is just a rationale function it provides approximately
logarithmic behavior while keeping the zero point at -Inf dB, i.e. silence.
Post by Sonnich Jensen
What about smaller MP3 players or other sound devices? When using a DAC to set the volume?
Most cheap devices do not have hardware volume controls at all. They
simply multiply all samples by a number less than one before they are
passed to the DAC. If this is combined with a 16 bit DAC then the result
is rather poor at low output levels, especially because most 16 bit DACs
effectively do not have more than 14 bits due to noise and DNL.

Better devices use a PGA and/or a good 24 bit DAC.


Marcel

Loading...