Effective number of bits---or why "you have to keep software at full volume" is nonsense

Jul 6, 2013 at 3:27 AM Thread Starter Post #1 of 46

ab initio

500+ Head-Fier
Joined
May 1, 2013
Posts
854
Likes
158
Okay, please excuse the title (but admit it, it did get your attention!). This thread is to discuss the digital audio mantra that "You should always always always leave software volume at 100%". Well suppose you have a powerful amp and sensitive cans, should you lose sleep over using a little bit of software control to attenuate your music? No! This is something I deal with, driving the fairly sensitive HD280pro from a Schiit Modi+Magni (Schiit, who specifically recommend using a tasteful amount of software volume control to get usability from the volume knob... the blasphemy!)
 
The question is, if I turn down the software volume, how much do I lose? And when I cause significant lose of sound quality by using the software volume control. The answer is to calculate the effective number of bits!
 
Here's the deal, most music is encoded 16bit/44kHz that offers ~96dB of dynamic range, and I am unaware of any ears that can demonstrate the ability to distinguish 16bit/44kHz from otherwise identical sound clips at higher bit depths e.g. 24bit/96kHz. So, just for the sake of this thread, lets assume that 16 bits represents a "complete" audio experience. Another thing to keep in mind is that (at least in Windoze kmixer) dither will be applied to the digital audio stream before getting spit out to the hardware, just like any mixer should. Dither will (intelligently) randomize the lowest bit to shape the noise spectrum; however this discussion is beyond the scope of this post. Further information on dither can be found here.
 
So what do I mean by "effective number of bits"? Well, the sound card (or DAC) will convert the digital audio it receives to an analog signal, usually at either 16bit  or 24bit depth. That means the hardware will spit out its maximum voltage output when it receives an 0x7FFF(FF) and its most negative voltage when it receives an 0x8000(00) i.e. we get full resolution output. However, if we use software control to set the volume to 1/8th full scale, then the largest change in output levels we can achieve will be 0x0FFF(FF) max and 0xF000(00) min. So we've lost 3 bits of resolution! (Note 1/8 = 1/2^3). We are left with either 13 or 21 bits of resolution, depending on whether we are using 16 or 24 bit hardware.
 
The general formula to calculate the effective number of bits is something like this: (you can try this in GNU/octave or MATLAB)
Code:
 ENB = @(Bits,dB) log2(10.^((20*log10(2.^Bits) + dB)/20))
Here, "ENB" is the effective number of bits and it depends on digital-to-analog converter bit depth, "Bits", and on the software volume level, which we specify in decibels, "dB".  The plot below shows the effective number of bits as a function of volume setting for the two most common hardware configurations: 16 and 24 bit DAC
 

 
A couple things I'd like to point out. First, 16bit represents about 96dB of dynamic range, while 24bit represents about 144dB of dynamic range. Second, if you set your soundcard/DAC for 24bit decoding, you can still play CD-quality music at full resolution (i.e. essentially bit-perfect with the exception of dither on the last bit) with software volume set as much as -48dB!!! As a point of reference, using window's volume control, so-called "10% volume" equals -35dB attenuation, which means 16 bit audio is still being sent to the soundcard/DAC at full resolution. On my laptop, the volume control buttons operate in 10% increments, so even at the lowest volume setting on my laptop I am still getting full resolution 16 bit audio from my DAC when it operating in 24bit mode.
 
So, am I saying that everyone should set their software volume one step up from mute? NO! Not all soundcards/DACs can operate in 24 bit mode. If you are using a device with a 16bit decoder, then it is probably preferable to keep the volume up. But if you have any have decent quality device with a 24 bit digital-to-analog section, there is no reason to fret using a software volume control. When I am up late at night (or early morning), and the office or apartment is very quite, and I am listening on my noise-isolating studio monitors plugged into my (very low noise) Modi/Magni combo, I won't be losing any sleep over using software volume control to get the volume down to a place where I can get some useable range on the volume knob of the Magni at a volume level that won't blow my eardrums into my skull.
 
There's more ro the story that what I discussed here (like the noise floor of the amplifier, etc..) but I suppose the other knowledgeable forum members can help fill in some of the points that I missed, or help me correct anything I might have messed up.
 
Cheers!
 
Jul 6, 2013 at 3:37 AM Post #2 of 46
A 24-bit DAC will not have an actual effective number of bits of 24. So, if it has a 110 dB dynamic range, for example (a decent, but not very "high end" value, so it should be available at a reasonably low cost), then a software attenuation of 10-15 dB is OK. In practice, it can even be more, especially if the purpose is to actually reduce the loudness, because even if music played at 80 dB peak SPL has a dynamic range of only 80 dB (not much better than 13 bits), the noise floor will not be audible anyway.
 
It might not be a real audible issue, but 100% digital volume can cause clipping in the digital reconstruction filters of some DAC chips, because the peaks in the analog signal can exceed 0 dBFS by 1-2 dB with "loud" music.
 
Jul 6, 2013 at 5:10 AM Post #3 of 46
What playback software are you using, and how does it implement the volume control? 
 
Often good playback software will implement the volume control in a less deleterious manner than reducing overall volume on the sound card itself.  Some for instance use 32 bit processing for volume.  Any residuals effects from volume reduction will be very low in level.  Keep hardware volume max and do the reduction in software.
 
Jul 6, 2013 at 10:02 AM Post #4 of 46
Sorry, I have to disagree.
 
All the posts I've seen on this issue are hedged with 'if's and 'but's.
 
In my view, and particularly when considering naiive users, on balance of probabilities, there's less chance of getting a degraded sound if you do your volume control externally in the analog domain.
 
Obviously, if you know what you're doing, software volume control can be acceptable, even the best option, but if your level of expertise is such that you're asking for advice on this issue, then using software volume control opens you up to the possibility of sound quality degradation in a way that analog post-adjustment simply just does not.
 
I don't have any problem understanding the issues, but I always, always, always, leave the software volume control at 100%, because I'm lazy and I just want the equipment to work.
 
w
 
Jul 6, 2013 at 3:55 PM Post #5 of 46
http://www.ultraaudio.com/index.php/features-menu/general-interest-interviews-menu/311-what-s-wrong-with-digital-volume-controls
 
Not exactly the article I would have written, but a reasonable look into the issues of analog vs digital volume controls.
 
http://www.thewelltemperedcomputer.com/Intro/SQ/VolumeControl.htm
 
Another reasonably short explanation of what happens including the fact when you change volume digitally you create quantization noise.  But if that is 32 bit digital volume done with dither the residual noise is very low in level (-190 db).  Much lower than even very good analog volume controls could manage.
 
http://blog.szynalski.com/2009/11/17/an-audiophiles-look-at-the-audio-stack-in-windows-vista-and-7/
 
This explains how Windows Vista and 7 convert all internal processing to 32 bit float which would include volume controls.   Current Foobar, and iTunes use internal 32 bit processing for volume changes.   So digitally controlling volume in Win Vista or newer on plenty of  widely available playback software should cause no audible problems.
 
Even switched resistor volume controls will have larger channel imbalances and likely cause more added thermal noise than 32 digital volume processing.
 
Jul 6, 2013 at 11:48 PM Post #6 of 46
Quote:
http://www.ultraaudio.com/index.php/features-menu/general-interest-interviews-menu/311-what-s-wrong-with-digital-volume-controls
 
Not exactly the article I would have written, but a reasonable look into the issues of analog vs digital volume controls.
 
http://www.thewelltemperedcomputer.com/Intro/SQ/VolumeControl.htm
 
Another reasonably short explanation of what happens including the fact when you change volume digitally you create quantization noise.  But if that is 32 bit digital volume done with dither the residual noise is very low in level (-190 db).  Much lower than even very good analog volume controls could manage.
 
http://blog.szynalski.com/2009/11/17/an-audiophiles-look-at-the-audio-stack-in-windows-vista-and-7/
 
This explains how Windows Vista and 7 convert all internal processing to 32 bit float which would include volume controls.   Current Foobar, and iTunes use internal 32 bit processing for volume changes.   So digitally controlling volume in Win Vista or newer on plenty of  widely available playback software should cause no audible problems.
 
Even switched resistor volume controls will have larger channel imbalances and likely cause more added thermal noise than 32 digital volume processing.

 
I agree that the internal software processing uses sufficient precision to handle audio stream  processing without any practical loss of information; however, once the audio stream is piped to the D-to-A hardware to be turned into an analog signal for headphones/etc... the precision of the arithmetic used to process the audio becomes irrelevant. At that point, the software has to convert the audio signal to the bit depth of the D-to-A hardware. If you've attenuated the signal in software, then you've reduced the range of the 16 or 24 bit signal being converted to analog, and therefore you lose precision. The effective bit depth analysis as above holds.
 
The analysis I gave in the first post assumes that the math in the software does not introduce any errors, which is somewhat valid assumption considering that 32 bit floats (i.e. single) have 24 bits of precision and 8 bits for the exponent. Double precision math (i.e. 64 bit floats) will have lots of headroom with 53 bits dedicated to the significand.
 
stv014 brings up a good point that I neglected in my original post. 24-bit d-to-a hardware typically only achieves about 20 bit resolution, with the last few bits lost to noise. It would be nice if there were a link for this, so you guys don't have to take my word for it.
 
Cheers
 
Jul 7, 2013 at 3:32 AM Post #7 of 46
ab initio,
 
I am not sure I get your point with the last comment.  If the volume is done with 32 bit precision, with 48 db reduction or less it will output the 24 bit signal to the DAC and have all the resolution the DAC can handle.  And the 20 bits of resolution due to noise is analog noise.  Which actually means you probably could reduce it to near -72 db without any difference in noise making it through the system.  Then even on top of that most listening areas are filled with noise at a 30-35 db level.  So you might even sneak in some additional attenuation with the resulting signal difference lost in that noise.  So I fail to see how 32 bit floating point that gets put in a 24 bit container going to a 24 bit DAC causes any problems.  Until near -72 db of attenuation you haven't changed anything at a level that will be above the thermal noise floor of a reproduction system at the final output.  This before even considering ambient noise levels. 
 
Jul 7, 2013 at 3:45 AM Post #8 of 46
Quote:
 
I agree that the internal software processing uses sufficient precision to handle audio stream  processing without any practical loss of information; however, once the audio stream is piped to the D-to-A hardware to be turned into an analog signal for headphones/etc... the precision of the arithmetic used to process the audio becomes irrelevant. At that point, the software has to convert the audio signal to the bit depth of the D-to-A hardware. If you've attenuated the signal in software, then you've reduced the range of the 16 or 24 bit signal being converted to analog, and therefore you lose precision. The effective bit depth analysis as above holds.

 
With 24-bit output format (which is widely supported now, even by onboard codecs), the loss of numeric precision is normally not a real issue even without dithering. The quantization noise will be swamped by the analog noise floor of the DAC.
 
Quote:
Originally Posted by ab initio /img/forum/go_quote.gif
 
The analysis I gave in the first post assumes that the math in the software does not introduce any errors, which is somewhat valid assumption considering that 32 bit floats (i.e. single) have 24 bits of precision and 8 bits for the exponent. Double precision math (i.e. 64 bit floats) will have lots of headroom with 53 bits dedicated to the significand.

 
32 bit floats actually have a resolution equal to or better than that of 25 bit signed integers. They can represent all integers in the range -16777216 to 16777216 without loss of information. But floats also have (for audio purposes) practically unlimited dynamic range (however, "denormalized" numbers with extremely low absolute value - typically resulting from IIR filters or reverbs with long silent input - tend to cause severe slowdown on modern CPUs; also, an "infinite" or NaN (not a number) value resulting from a buggy algorithm can get "stuck" and produce a constant large DC output when converted to an integer format. These issues can be avoided/worked around in well written programs).
 
Quote:
Originally Posted by ab initio /img/forum/go_quote.gif
 
stv014 brings up a good point that I neglected in my original post. 24-bit d-to-a hardware typically only achieves about 20 bit resolution, with the last few bits lost to noise. It would be nice if there were a link for this, so you guys don't have to take my word for it.

 
Well, there are many DAC reviews and measurements available, for example at Stereophile or a certain blog that cannot be named here. Anyone can check these to get an idea what the signal to noise ratio of a typical real world 24-bit DAC is. Also, the manufacturers of the DAC chips list the SNR in the specifications in their datasheets, but these are optimistic values in that they assume a "perfect" implementation.
 
Jul 7, 2013 at 3:50 AM Post #9 of 46
Quote:
If the volume is done with 32 bit precision, with 48 db reduction or less it will output the 24 bit signal to the DAC and have all the resolution the DAC can handle.  And the 20 bits of resolution due to noise is analog noise.  Which actually means you probably could reduce it to near -72 db without any difference in noise making it through the system.

 
If you reduce the level by 72 dB, and the DAC has a dynamic range of 120 dB (~20 bits), then you will get 48 dB (= ~8 bits) dynamic range. However, that might not be a problem anyway, because the 72 dB attenuation most likely means that the audio output is very quiet, and the noise floor will not be audible. It makes no sense to attenuate the digital signal by a huge amount, and then apply equally large analog gain to get a loud and noisy sound.
Ideally, with a fully digital volume control, 100% volume should correspond to the maximum usable loudness. If it is 110 dB SPL, for example, and the DAC has an A-weighted SNR of 110 dB, then the noise floor from the DAC will always be 0 dB SPL (A-weighted), assuming no significant noise modulation or other issues. So, it will not be a real problem at any digital volume setting, because the hiss is inaudible. As the volume is reduced, the dynamic range of the DAC will decrease, of course, but so will that of human hearing.
 
Jul 7, 2013 at 5:09 AM Post #10 of 46
If you reduce the level by 72 dB, and the DAC has a dynamic range of 120 dB (~20 bits), then you will get 48 dB (= ~8 bits) dynamic range.
That's not how it works. If the DAC is processing with 24-bits internally, you have 144dB of digital dynamic range, and 120dB analog dynamic range.

So you still have 144dB of dynamic range in the digital domain, and if you are attenuating that by 72dB, that gives you 72dB left over. (12-bit)
This is still under the 20-bit analog limit of the device, so you are not losing anything further - but 12-bit is really bad. I can hear a -72dB noise floor with relative ease.

If you were only attenuating by 18dB though, as an example, you would have 126dB of digital dynamic range, but the analog stage would cost you another 6dB, reducing it to 120dB.
 
Jul 7, 2013 at 6:03 AM Post #11 of 46
Quote:
 
 
Ideally, with a fully digital volume control, 100% volume should correspond to the maximum usable loudness. If it is 110 dB SPL, for example, and the DAC has an A-weighted SNR of 110 dB, then the noise floor from the DAC will always be 0 dB SPL (A-weighted), assuming no significant noise modulation or other issues. So, it will not be a real problem at any digital volume setting, because the hiss is inaudible. As the volume is reduced, the dynamic range of the DAC will decrease, of course, but so will that of human hearing.


Yes, this is the main thing.  How far down from the system's max loudness are you.  Match all the gain, and speaker efficiencies well, and it simply won't be a problem. 
 
Jul 7, 2013 at 8:03 AM Post #12 of 46
How is an insufficient bit depth heard, aside from a noise floor? Or is that all that is heard?
 
HiBy Stay updated on HiBy at their facebook, website or email (icons below). Stay updated on HiBy at their sponsor profile on Head-Fi.
 
https://www.facebook.com/hibycom https://store.hiby.com/ service@hiby.com
Jul 7, 2013 at 10:23 AM Post #14 of 46
Quote:
That's not how it works. If the DAC is processing with 24-bits internally, you have 144dB of digital dynamic range, and 120dB analog dynamic range.

So you still have 144dB of dynamic range in the digital domain, and if you are attenuating that by 72dB, that gives you 72dB left over. (12-bit)
This is still under the 20-bit analog limit of the device, so you are not losing anything further - but 12-bit is really bad. I can hear a -72dB noise floor with relative ease.

If you were only attenuating by 18dB though, as an example, you would have 126dB of digital dynamic range, but the analog stage would cost you another 6dB, reducing it to 120dB.

 
Attenuating the digital signal will not magically reduce the absolute level of the analog noise floor (unless the DAC has noise modulation issues). If a DAC has 2 Vrms maximum output and 20 uV A-weighted analog noise level, then attenuating the digital signal from full scale by 20 dB will reduce the A-weighted SNR from 100 to 80 dB, because the maximum level is now only 200 mVrms, but the 20 uV noise is still there.
 
Jul 7, 2013 at 12:53 PM Post #15 of 46
Quote:
As the volume is reduced, the dynamic range of the DAC will decrease, of course, but so will that of human hearing.

 
Yes, but there is nothing to prevent a naiive user turning down the digital volume and then turning up the volume at an external analog post-processing stage.
 
It's not that anything in the 10 posts since my last one is strictly inaccurate, but you guys are letting your desire to show off your knowledge of the subject obscure the understanding of the issues when reduced to the most simplistic terms.
 
Try to pitch your replies at a level unlikely to mislead anyone with a poorer understanding of the subject.
 
w
 

Users who are viewing this thread

Back
Top