Skip to main content

Topic: How does software volume control work ? (Read 5168 times) previous topic - next topic

0 Members and 1 Guest are viewing this topic.
  • goodsound
  • [*][*][*]
  • Banned
How does software volume control work ?
How exactly does software (windows mixer, players like foobar, etc..) volume control work ? Is it the equivalent of replay gain or normalizing ? or is it more "electronic" or "hardware" than that ?
Thanks.

  • Shade[ST]
  • [*][*][*][*][*]
How does software volume control work ?
Reply #1
It can be approximated by normalizing.  No analysis is performed on sound to determine percieved loudness;  It simply multiplies the played back samples by a constant number.

  • gasmann
  • [*][*][*]
How does software volume control work ?
Reply #2
It depends. Windows Mixer and most players use the sound drivers implementation for setting the volume.
Foobar2000 does it on it's own - it scales the output before sending it to the driver, and is thereby not using the sound drivers implementation. However, it depends on it too since the data sent to the driver by foobar will be output to speakers/headphones etc. at the sound drivers volume setting. So in this case it's like two mixers in a chain.

And no, it doesn't have anything to do with rg or normalizing in this case. Normalizing means scaling the waverform so that the peak is at or very near 100% (-0dB), and RG means making all tracks/albums have the same overall loudness.
  • Last Edit: 01 March, 2006, 12:39:56 PM by gasmann
flac 1.2.1 -8 (archive) | aoTuVb5.7 -q 4 (pc, s1mp3)

  • Shade[ST]
  • [*][*][*][*][*]
How does software volume control work ?
Reply #3
You don't have to normalize to a specified level.  Normalization only involves multiplying a statistic set by a constant number.

http://en.wikipedia.org/wiki/Audio_normalization

  • saratoga
  • [*][*][*][*][*]
How does software volume control work ?
Reply #4
In addition to scaling the samples, some software (Ipod OS for instance) controls the output power level on the audio hardware.

  • goodsound
  • [*][*][*]
  • Banned
How does software volume control work ?
Reply #5
but what exactly happens when "scaling" ? I am asking about the implementation details. For example, normalizing works by adding bits to the actual sample(right?). Likewise what does scaling do ?

  • Fandango
  • [*][*][*][*][*]
How does software volume control work ?
Reply #6
What bothers me all the time is that there is very rarely any values shown of how much the volume is changed. At most we get a slider, that's all. No percent scale is shown, you have to "guess" it with your eyes or count the marks, steps on the slider, which is either no guarentee that you will set the volume to a specific level or very cumbersome to hit the cursor keys 20-40 times every time you or worse an application has changed the driver volume settings. This is too old-way analog for me, using a slider. I want to be able to set the volume more precisely, or at best lock them, so that no program can change them on their own (Real Player/Plugin).

The only mixer control programs that I remember that let the user do this were made for Linux/BSD type systems. There were many of them because it was as easy as opening a file (/dev/mixer) to manipulate the drivers settings.

  • AndyH-ha
  • [*][*][*][*][*]
How does software volume control work ?
Reply #7
Quote
normalizing works by adding bits to the actual sample(right?)
No, no bits are ever added or subtracted. Each sample is a number, a signal level measurement, normally expressed in dB for convenience. That value is modified, increased or decreased, so the new value (the new signal level) is closer to, or further from, 0dB.

As you decrease the volume level, sample values decrease below the minimum supported (e.g. aprox -96dB for sixteen bit files) so you are effectively decreasing the bit depth.

  • goodsound
  • [*][*][*]
  • Banned
How does software volume control work ?
Reply #8
If I understand correctly, the software volume control acutally only 'reduces' the volume - from 0 to -96. It cannot 'increase' it.

So at max volume level the actual sample value is used, and at say 50% volume the actual sample value is divided by 2 before its passed on ?
Am I thinking this through correctly ? If this is correct then does this messing around with the actual/real sample value in any way affect the sound ?
I'd imagine not, but....

  • Shade[ST]
  • [*][*][*][*][*]
How does software volume control work ?
Reply #9
Quote
If I understand correctly, the software volume control acutally only 'reduces' the volume - from 0 to -96. It cannot 'increase' it.

So at max volume level the actual sample value is used, and at say 50% volume the actual sample value is divided by 2 before its passed on ?
Am I thinking this through correctly ? If this is correct then does this messing around with the actual/real sample value in any way affect the sound ?

That's approximately it.  However, some badly programmed drivers cannot treat sample values that go over a certain point, and that's why you can have clipping when above a certain volume setting in the windows mixer.

eg : say you have a sample value that goes from -32768 to 32767; the volume control will multiply the sample by a number between 0 and 1, and then truncates it.  Eg :

a sample at 345 with volume at 50 % (0.5) will be down to 172 after volume setting.

Now let's say that a sound driver can't play samples if they're above, say.. 30000.  Some music will clip (all values above 30000 will be brought to that number), and the playback will sound worse.

  • goodsound
  • [*][*][*]
  • Banned
How does software volume control work ?
Reply #10
Quote
.and then truncates it.

dang..I was afraid of that! Atleast theoritically all that rounding/truncating will skew the resulting waveform. It won't really be a half-size 'image' of the original. Not sure if this results into any perceivable distortion. Does it ?
  • Last Edit: 01 March, 2006, 05:18:37 PM by goodsound

  • Shade[ST]
  • [*][*][*][*][*]
How does software volume control work ?
Reply #11
If there is no clipping, the truncating and / or rounding should not be detectable to human ears.  It's less than 0.01 db volume amplitude change.