The dirty little secret of Windows volume

Here’s a dirty little secret about volume in Windows.

If you look at the documentation for waveOutSetVolume it very clearly says:

Volume settings are interpreted logarithmically. This means the perceived increase in volume is the same when increasing the volume level from 0x5000 to 0x6000 as it is from 0x4000 to 0x5000.

The implication of this is that you can implement a linear slider for volume control and use the position of the slider to represent the volume.  This is pretty cool.

But if you’ve ever written an application that uses the waveform volume (say an app that plays content with a volume slider attached to it), you’ll notice that your volume control is far more responsive when it’s on the low end of the slider and less responsive on the high end of the slider.

Logarithmic curve

That’s weird.  The volume settings are supposed to be logarithmic, but a slider that’s more responsive at the low end of the scale than the high end of the scale is an indicator that the slider’s controlling LINEAR volume.

And that’s the dirty little secret.  Even though the wave volume is supposed to be logarithmic, the wave volume is actually linear.

What’s worse is that we didn’t notice this until we shipped Media Center Edition.  The PM for my group was playing with his MCE machine and noticed that the volume was linear.   To confirm it, he whipped out his sound pressure meter (he’s a recording  artist so he has stuff like that in his house).  And yup, the volume control was linear.

When he came back to work the next day, panic ensued.  I can’t explain WHY nobody had noticed this, but they hadn’t.

In response, we added support (for XP SP2) for customized volume tapers for the audio APIs.  The results of that are discussed in this article.


Interestingly enough, it appears that this problem is well known.  The article from which I stole this image discusses the problem of linear vs. logarithmic tapers and discusses how to find the optimal volume taper.


Edit: Cleared up some ambiguities in the language.

Comments (8)

  1. Anonymous says:

    Ah, HUGE pet peeve of mine.

    Not enough granularity at the lower end of the scale. It’s either inaudible, or loud enough to wake up the kids. No middle ground.

    Especially annoying with laptops that have an "up volume" and "down volume" hotkey–these tend to exagerate the problem.

  2. Anonymous says:

    Winamp has a logarithmic volume setting, but it seems the curve is too steep and it comes out with the opposite problem: Half the slider is too soft to hear, and then it gets very loud very fast. Linear is the lesser of two evils.

    Is this the same waveout volume control from the dark ages of 3.x? And was logarithmic volume an original design goal from way back then, or was it an XP upgrade that someone forgot to check for?

  3. foxishadis, yes, the waveform APIs came in with Win3.1.

    I’m not sure what the volume taper story is for waveform back that far ago..

  4. Anonymous says:

    I think a lot of radios have linear volume controls. On a scale from 0 to 10 I’m rather accustomed to tweaking a knob between say somewhere around 0.7 to 0.8 and back without even thinking of going past 1. So the Windows volume control was no surprise.

    But if it’s DOCUMENTED as being logarithmic, then, well, that’s no surprise either. It is Microsoft documentation after all. I do admit that in my experience more than 50% of Microsoft documentation has been accurate, but the rest of it still, well, no surprise.

  5. Anonymous says:

    Oh, now I know what’s wrong with my parents TV…

  6. Anonymous says:

    Well known industry problem. Soundcraft[1] have their own law logarithmic faders but typically most folks either use mu or A law.

    I strongly suspect my cable box has got a linear rule in it.

    I suspect windows suffers from zipper noise too, or is that a device driver problem with my hardware?

    BTW your article on volume should be using dBm at some points?

    [1] I used to work there and had the same sorts of fun with trying to program pan pots for stereo at one point.

  7. Peter, the zipper noise shouldn’t happen with Windows because the volume that’s being manipulated is an analog volume control (it’s after the DAC). On the other hand, if your audio adapter doesn’t have a hardware volume, then kmixer will create a software volume for it, it’s possible that has a zipper problem.

    For Longhorn, it won’t 🙂 I know.

  8. Anonymous says:

    You can still get zipper noise even with an analog control depending on the design (although you’d hope that wasn’t the case)

    I must have a play with the multimedia stuff again, I haven’t looked at Windows in that area since NT4 so my knowledge is exceedingly out of date. (although probably less than I would expect) Time for some experimenting with sine waves perhaps…

Skip to main content