Freigeben über


Why doesn’t Windows support amplification of audio samples?

Nils Arthur asked in another post:

While we are talking volume controls. Could you explain why it's only possible to lower the volume in Windows (i.e. setting a volume between 0% and 100%) and not raise it (i.e setting it higher than 100%)?

Before I get into the the answer, let me define some terms:  Attenuation means reducing the amplitude of a signal from a baseline - so if the signal is a full range sine wave going from 1.0 to -1.0, if you attenuate it to 50%, you get a sine wave from 0.5 to -0.5.  I wrote about it (with pictures :)) in this post.

The answer to Nils' question is both simple and complicated.

The simple part of the answer: Because most PC audio hardware only supports attenuation and not amplification.

Now for the complicated parts of the answer: We only support what the hardware allows for master volume.  And most hardware only supports attenuation.  There are a lot of reasons for that, but the primary one is that it's dramatically cheaper (and uses less power) to attenuate signals than it is to amplify them.

The other issue w.r.t. amplification/attenuation is signal quality. As I mentioned in the post on volume above, you can attenuate a sample in the digital domain without loss of fidelity.  However when you attempt to amplify a signal in the digital domain, it clips.   That means that amplification MUST be done in the analog domain.  Again, this goes to hardware costs - because amplification needs to be done in the analog domain, it means that the audio hardware needs to have an amplifier that can be digitally controlled, which is (again) more expensive.  The audio hardware doesn't even have to support hardware volume - if Windows doesn't find a hardware volume control, it simply inserts a master volume into the audio pipeline.

Some audio hardware DOES support amplification, but the audio volume controls map the volume control from low to high into a range from 0..100 because it's dramatically simpler to represent that to the user.

That means that if an audio solution presents a hardware volume from -96.0dB to +3dB (there are a number of them that do that), we'll map that 99dB range into a 0.0 to 1.0 range that maps nicely into a slider.  We've thought about differentiating between attenuation and amplification in the volume UI, but the reality is that the net effect is the same whether we represent amplification or not.

You can see if your audio hardware supports amplification by going to the multimedia control panel.  Select the audio endpoint you want to check, go to the "Properties" dialog.  On that dialog, check the "Levels" tab, the hardware master volume control is present there.  You can right click on the text box and change the units from linear to dB, you can then move the slider around to see the dB range.  Or you could write some code and call the IAudioEndpointVolume::GetVolumeRange API, which will return the information directly.

Comments

  • Anonymous
    August 11, 2008
    PingBack from http://hoursfunnywallpaper.cn/?p=613

  • Anonymous
    August 11, 2008
    It's unfortunate that the display in decibels did not make it to the Volume control display (the one accessible directly from the System Tray). BTW, only a developer could think of implementing this feature this way. Great info, Pascal

  • Anonymous
    August 11, 2008
    If I'm playing a quiet CD, can't I digitally amplify the samples without risk of clipping?   It seems like there are legitimate reasons I'd want to amplify something, even with the risk of lossiness.

  • Anonymous
    August 11, 2008
    Ben, that might be true, but then it introduces distortion to the signal - you're taking a signal whose samples range from -10..10 and turnng them into samples that range from -32768..32767, there's going to be significant amounts of distortion introduced. In general, amplification in the digital realm is a bad idea.

  • Anonymous
    August 11, 2008
    The comment has been removed

  • Anonymous
    August 11, 2008
    > taking a signal whose samples range from -10..10 and turnng them into samples that range from -32768..32767, there's going to be significant amounts of distortion introduced. In general, amplification in the digital realm is a bad idea. As far as I can tell, amplifying that signal in the analog realm is not any better. Digital amplification does have drawbacks, but sometimes it's quite useful.  For example, VLC has digital amplification, and I find myself using it all the time.

  • Anonymous
    August 11, 2008
    The comment has been removed

  • Anonymous
    August 11, 2008
    Using units is generally more sensible and more correct. The slider already provides an easy way to configure the levels for everybody. I was just remarking that the 'decibels unit' configuration available deep down the Windows UI is not reflected to the main UI. In this very example, using decibels would have better informed the user when the system provides amplification vs. attenuation. As for using the percent range, I only use it to calibrate the output to '50'. I generally listen to the speakers to configure the output. Cheers, Pascal

  • Anonymous
    August 11, 2008
    There's one thing that could be done that would give the effect of amplification without clipping - dynamic range compression. It would be useful in situations where there's background noise which is preventing you hearing the quiet bits of whatever you're listening to.

  • Anonymous
    August 12, 2008
    Pascal, you're right - decibels are more correct.  But for 99% of our users, decibels are useless.  In addition, the master volume control applies a taper because decibels are non linear w.r.t. volume (decibels measure SPL not volume - the two are only roughly corrolated). That's why the IAudioEndpointVolume API allows you to manipulate the volume using both dB and a percentage from 0.0 to 1.0.

  • Anonymous
    August 14, 2008
    Looks like in few years we will have Hardware, which will handle End-To-End digital audio. Even some of them removed DAC at the end, and treat speakers as a DAC, converting analog sound waves from digital signals. www.puredigitalaudio.org/digitalamplifiers has some solutions with a purely digital audio signal path When these hardware reach motherboards, windows might be able to support much more ways to control the Volume. May be Windows 7 Beta??

  • Anonymous
    August 14, 2008
    mvadu: Not likely, unless they can get the price of their solution down to where it's competitive with Intel's HDAudio solution. Oh, and it has to use essentially no power :).

  • Anonymous
    August 14, 2008
    Infact that is what they are claiming now a days.. They reached to two chip solutions now, compared Realtek or Intel's single chip HD audio. So I will hope for Windows 8. Who knows.. If I am able to join my dream company, I might be testing that version of Windows :)

  • Anonymous
    August 15, 2008
    The comment has been removed

  • Anonymous
    September 01, 2008
    Larry, I couldn't post a comment in the media center volume post from a while back, so hope its not rude to post this Q here. If one runs media center as a "custom user interface" (to give family members access to media, but not the whole machine for instance), it works relatively well, except one can't change the volume from within the media center UI.  Whatever it was when it started is what it remains at. any idea why?  I'm wondering if there's something else that has to be run to give the session access to the master control volume.