Larry Osterman's WebLog

Confessions of an Old Fogey
Blog - Title

Why doesn’t Windows support amplification of audio samples?

Why doesn’t Windows support amplification of audio samples?

  • Comments 15

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.

  • PingBack from http://hoursfunnywallpaper.cn/?p=613

  • 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

  • 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.

  • 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.

  • I think a 0-100 scale is more friendly for the end user than decibels would be. As for amplification, Larry makes it sound like it should be possible to create a component of the audio pipeline that *does* amplify.

  • > 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.

  • Ben, Your quiet CD probably still has lots of samples near the max which will clip if amplified digitally. That can and usually does happen even if the overall sound is not loud.

    This is why things like ReplayGain will only make things quieter, not louder. (e.g. They'll make your modern albums as quiet as your 1980s albums rather than making your 1980s albums louder.)

    ---

    A more general point: This problem is why almost all sound "equalisers" on computers and portable digital audio equipment are terrible. :-( Any EQ which boosts frequencies quickly leads to clipping and massive distortion. A good sound player will use EQ presets which only reduce frequencies (i.e. to boost one, reduce all the others instead), or will reduce the overall volume by the max EQ amplification -- before the EQ is applied -- so there is "room" to do it. Sadly, very few of them do this.

    None of the major DAP manufacturers has a decent EQ AFAIK. (The Rio Karma's was great but that's gone now. Sony used to have good ones when using ATRAC but they didn't work at all with MP3. I'm not sure what Sony's EQ quality is like on their newer MP3-only players. The iPod's EQ is a disgusting distortion generator, and presets-only to boot, and I've heard the Zune is similar, though it's not sold in the UK so I've never actually used one.) For good portable sound you have to buy big and/or expensive headphones and turn off the EQ. :-(

  • 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

  • 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.

  • 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.

  • 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??

  • 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 :).

  • 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 :)

  • +1 to the dynamic range compression idea

    At the very least, they should add the ability to put a digital filter version of a compressor in media player (but even better in the system wide settings) so that i can crank things up without clipping (and yes this is a real issue on recordings that are simply to quite). Obviously analog amplification is better, but sometimes I just have headphones and the environment is too noisy.

    I have used the poor man's equivalent - turn on the equalizer in media player and drag everything up - but this definitely causes clipping. I think the "Quiet Mode" is actually using a compressor, but I'd like a bit more control over it.

    Seems like a decent extension to what's already the much improved Mixer in Vista (actually one of the coolest and most useful features added to windows in a while)

  • 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.

Page 1 of 1 (15 items)