I was surprised by the best answer as it seems to me to be more or less wrong.
Let's ignore the discussion about dynamic range and bit depth etc., and assume that the volume control on your operating system controls the DAC rather than doing the stupid thing of digital volume reduction. The fundamental issue is signal to noise ratio on the analog line. If you turn the volume too far down on the computer and turn the volume up on your speakers, the sound on the analog line is too low with regard to the electrical noise and will be hissy. If you turn the volume up too much on the computer and turn the volume down on your speakers, then the signal will be so loud as to produce distortion either in the DAC or on the line itself. You're looking for a middle ground: as loud an output from the computer that you can produce without causing distortion in your loudest music parts. Once you've got that set, change the volume on the speakers to compensate.
Little late to the party here but you're wrong. Unless something is being done to the signal (eq, other processing, etc) then you want the digital side to remain at max volume (i.e., no reduction in bit depth). The audio will have been mastered close to 0 db with little or no clipping (exceeding the maximum amplitude possible) and should not be "too loud" for your amplifier. If it is there is something wrong with the gain configuration of your setup.
As discussed, lowering the volume in software (which is what you likely mean by "controlling the DAC") is accomplished by reducing bit depth. By definition you're reducing the amount of signal present which makes your S/N worse. If by "controlling the DAC" you mean reducing the signal at the DAC's analog stage then there's nothing theoretically wrong with that (except that it's rarely if ever the case in computer sound cards or hi-fi DACs) as it is the equivalent to adjusting the volume on your (integrated) amp.
Probably the most common exception to the above is people using a digital EQ to attempt to improve the sound of a mediocre computer audio setup. Most digital EQs allow for both "boost" and "cut" -- increasing or decreasing the amplitude of individual frequency bands. If you EQ the music the proper way you should only cut frequency bands in order to emphasize the other bands to suit your listening tastes. For example if you want to try to increase the amount of bass you should cut the mids and the highs and turn up the volume (on your amp) to compensate. EQing this way ensures that you're not forcing the signal into clipping by boosting too much.
You still won't get great results because if you're lacking bass or highs then it's most likely because you're not running full range speakers. If the sound does change when you EQ it's most likely due to increased distortion, not because you're appreciably increasing the amount of bass present. That's not true for full range speakers but if you have full range speakers you probably wouldn't need to EQ in the first place. (Full range speaker are usually 20 - 50hz to 20khz.)
If it's still not clear than think of it this way: Standalone CD players don't have volume controls. Their output will be "max volume" of what's on the CD. You can think of your computer and sound card like a (crappy) CD player. Make sure it's at max volume and adjust the level on your external amp or amplified speakers.
'As discussed, lowering the volume in software ... is accomplished by reducing bit depth.'
No, reducing the amplitude of a digital signal does not change its bit depth. If the amplitude of the digital signal is reduced, then a couple of bits on the MSB side will be constant. However, reducing the bit depth would make bits on the LSB side constant.
To state it differently, a lower bit depth increases the quantization levels and results in lower quality audio. Reducing the amplitude retains the same quantization level, and therefore has no reduction in audio quality (At least, not due to bit depth, it does change the SNR as you suggested)
You're correct that lowering amplitude ~= reducing bit depth. I'm not sure that lowering amplitude digitally keeps S/N constant but I'm a bit out of my depth (excuse the pun) at this point.
To further muddy the waters, in most cases using software volume control won't noticeably reduce audio quality. The main point I was trying to make is that on most computer setups 100% volume should be the least noisy, most accurate signal that it's capable of.
> assume that the volume control on your operating system controls the DAC rather than doing the stupid thing of digital volume reduction
Is this a safe assumption though? As much as I consider myself knowledgeable in this area, this is way off my radar.
Even if this assumption does hold, the answer does make a good point when it comes to per-application volume controls, which are certainly performed digitally.
Your point on SNR is a very good one, particularly on the low-end, but I would question whether any computer at max volume would produce a signal strong enough to cause distortion. I generally run my computer at around 90% volume but that's merely a habit carried over from having an analog hifi stack.
Guy with some sound knowledge here. It doesn't matter if the attenutation is done digitally (as described by the top SE comment) or in analog fashion. The answer is always the same. In the music biz the general rule is: you want to put as much gain as early in the chain as possible. In other words, start at the source of the sound, and working your way towards the speakers, turn it up as loud as you can without distorting it.
Take the example of a guitarist. He turns his guitar up as high as he can, then the amp gain as high without distorting it. Then at the sound console. etc
The reason for this the later in the chain you are, the more electronics and cable is involved which adds noise to your signal. Highest signal-to-noise is achieved by ensuring you have as much signal as you can running thru from the get-go.
In the case of a computer, again it doesn't matter how volume changes are done- crank up your software as high as you need (but not beyond the point of distortion), then adjust it further at the speakers.
> start at the source of the sound, and working your way towards the speakers, turn it up as loud as you can without distorting it
In practice that will often be right. In theory it is not.
With an analog signal what you actually want to do is avoid gain, whenever possible. You don't want to add as much gain at every step and then attenuate later. Gain adds noise and removes dynamic headroom.
So, assuming a guitar with passive electronics, you want to turn it all the way up (which adds no gain, passive electronics only attenuate a signal) and put everything else at unity gain (i.e. no attenuation and no additional gain). That will be labeled "0" on mixer faders and is about 80% of the way up on the fader.
We'll ignore guitar amplifiers for the moment, where the distortion that happens when you run out of headroom (clipping, i.e. "fuzz") and the sonic properties of vacuum tubes when they're near the top of their dynamic range (i.e. "tube warmth") are desired effects.
Now, so assuming you have a signal that you want clean all the way to the output, you've got things at unity all the way across the board, and it's not loud enough, then you start looking at where to add gain.
This is where we get to the part about you being in practice correct for many cases.
What we're looking to avoid is adding noise. Cabling exposes signals to RF interference and attenuate the signal since they're not perfect carriers. The more cables and interconnects down the road from the source we are, the more noise will have been introduced. Since we don't want to amplify the noise, it's usually best to amplify the signal at the point closest to the source since less noise will have leaked in. If you amplify a signal 4 connects down your signal path, there will be a lot of noise that you're amplifying along with your source's signal.
However, not all (pre-)amplifiers are created equal. Some, in fact, are pretty noisy themselves. There are certainly points where with a noisy pre-amp, you'll degrade the signal more by amplifying it in an earlier-in-your-signal-path pre-amp than you would boosting it at a very clean pre-amplifier one step down the chain. One of the big differences between cheapo mixers and high-end mixers is the quality of their first-in-the-signal-path pre-amps. A gain-adding stomp box is almost certainly going to be noisier than a Mackie pre-amp.
Now, since this started off talking about the sound coming out of consumer grade computer components (rather than a nice break-out box), it's worth noting that their analog amplifiers are pretty universally terrible. If you have a reasonably short and well-shielded cable, you'll generally be better off leaving it at "unity" (i.e. not boosting the pure signal that's coming out of the digital-to-analog converter), but adding it at the next step in your chain -- the mixer, receiver or powered monitors.
Now, to finish up, I'll circle back around to my first point -- since boosting the signal itself adds noise, if you're having to attenuate it later on, you're adding unnecessary noise. Your strategy of turning things up all the way until they clip is not a good one if you're having to then attenuate the signal later on for it to be at the correct levels for the mix. Ideally what you want is to have all of your faders at unity (again, labeled 0) and then to add gain at the quietest pre-amp (usually early in the chain) available until you hit the loudest volume that the channel will need to be in the mix. Fortunately, the folks designing mixers know that sometimes the situation on the ground is different in a live sound context and you'll actually need to go beyond unity, which is why mixers don't peak-out at there, but allow you to boost the signal there on an as-needed basis.
Edit: Minor addendum -- this assumes that you're not sending weak signals down long, unbalanced cables. If you are, that changes the calculus a little since they'll pick up a lot of RF on the way and you hack that around that by boosting before the cable and attenuating afterwards. But don't do that. That's what DI units are for.
It's not that simple. I've found in my rig, minimum noise is achieved with the guitar volume at 7 or so and preamp gain at minimum. If I turn up the volume on the guitar I can switch on the pad on the preamp, but this adds noise. I then add tons of distortion and gain in the software realm, so every dB of noise floor counts. Even clean guitar sounds are usually distorted.
The sound console is different. You want everything in the console to be trimmed to around 0 dB on the console's meters, and NOT as loud as possible without distorting. Trimming it to 0 dB gives you consistency between channels making it easier to work with the faders, and gives you however much headroom the console is designed to work with. "Loud as possible" will mean somewhere like +24 dB on some consoles, which is too hot to work with. Yes, they have that much headroom -- nominal line level is +4 dBu, around 1.2 V, and consoles have internal voltages in the 15-24V range.
The same goes for recording, you typically want things to peak at something like -18 dBFS. Making things peak "loud as you can without distorting" is the job of the mastering engineer, and it happens right before you stamp out CDs or MP3s or whatever.
> Take the example of a guitarist. He turns his guitar up as high as he can, then the amp gain as high without distorting it. Then at the sound console. etc
Without distorting it? Are you sure you have some sound knowledge? That doesn't sound like you know many guitarists... ;)
I've worked in Austin as a live sound mixer (FOH engineer, as we say) for a while now, and it's evenly split-some will say build your gain structure using the exact method; up until you clip, and back off from there.
How do you determine the highest possible volume that doesn't introduce distortion? My sense in trying to find the right volume ratio for listening to an iPhone in my car is that it's best to not turn the iPhone volume all the way up, usually I use 75% or so. Is turning it up until you start to hear something funny the only way to do this or is there a more reliable way?
In pro audio there's usually a meter you can watch, or at least a clip LED that turns red during clipping. Otherwise you use your ears, or if you're really serious, you can use an oscilloscope with test tones and watch for the shape of the waveform to change, or beyond that, you can use dedicated test gear (or software) that measures THD directly.
It would be easy enough to test -- download Right Mark Audio (free, but Windows only), connect your audio input to output with a patch cable, and test at different volume levels.
I think you're absolutely right and it's not the first time and I'm sure it will not be the last time that a very verbose post (read well structured with references and mentioning technical terms) gets much more credit than it deserves.
It would be nice to have some statistics about the number of lines of a reply on SO or HN and the amount of 'upvotes'. I think a lot of people would be surprised...
> assume that the volume control on your operating system controls the DAC rather than doing the stupid thing of digital volume reduction.
What would be the difference? I've never seen a DAC with an analog volume control. Any DAC I've ever seen with volume control does so digitally, usually with toggable steps (+6DB, +12DB, etc) or rarely with a programmable gain. Either way the DAC is adjusting the incoming digital signal prior to conversion. It would be really strange to try to make an analog adjustment to the output before the reconstruction filter.
I've seen a lot of comments that seem to confuse digital and analog audio.
Digital audio levels are fixed -- i.e. 0 dBFS (dB relative to digital "full scale"), thus you want the audio as close to full scale (0dBFS) as possible. This is the reasoning behind what you've probably heard described as the "loudness war". 0dBFS is the reference point beyond which no signal can exceed.
Contrast that with analog audio, be it the DAC (digital-to-analog converter) on your soundcard that splits to a "line out" (likely 3.5mm a/k/a/ 1/8" TRS connector outputting audio at -10 dBV, the "consumer" level) and "headphone jack" (i.e. line level signal -> headphone amplifier). Once the audio signal becomes analog, you must then be concerned about gain staging. If you have a crappy sound card, you shouldn't reduce the analog output, because, in order to achieve the same loudness, you will have to increase the gain on your 'speakers' (a/k/a/ "pre-amplifier"; often integrated into cheap 'all in one' computer audio playback systems). Remember that the noise floor remains the same regardless of gain settings, so by reducing the "line out" level, you are only increasing the noise floor (i.e. level of noise).
For all of you geeks out there... If you are looking to cut through the bullst and get a quality playback system, look into a setup that has a quality DAC and/with monitor controller, a separate preamp, and quality monitors. Benchmark has a great USB DAC, and or Lavry Engineering is what the professional mastering studios use (their DAC costs well over $20k, and not because of crap like 'voodoo diamond dust covered gold-plated platinum wires', but, in part, because it has an internal oven and temperature monitoring circuitry to keep the internals at precise temperatures). You can get a great monitor controller from Dangerous Audio or Coleman. Bryston preamp's are very popular in the professional setting, as are PMC and Bowers & Wilkins monitors.
Is it really possible to turn the volume up that high on a computer you're likely to encounter? I've yet to encounter a computer-like device that produces any noticeable distortion on the output when turned up all the way, if the other end has a volume control to make the final output happen at a reasonable level.
Lots of computers I've used allow audio gain to be set above unity, with noticeable distortion as a result. Next time you're in alsamixer on Linux, look at the fourth line down on the top which says "dB gain". It's not uncommon for it to go all the way up to +6 dB or +12 dB, which will almost certainly distort with common source material.
This happens both on my desktop Linux system and my Linux laptop.
Most consumer-hardware I know will have positive gain on the computer output (all built-in audio for my devices, the PCI cards with Ensoniq 1370 or 1371 I used earlier). On the other hand, a lot of the professional audio equipment I know have mixer-applications that has either 0dB as a maximum setting, or clearly labeled 0dB marks/buttons on the mixer application).
You can verify it easily by playing either a 0dB sine-wave mp3 (first google hit: http://www.dr-lex.be/software/testsounds.html) or trying to get a sine-wave test-tone generator. You'll hear the point where distortion kicks in pretty drastic as soon as you reach the clipping level. With a spectrum-analyzer (e.g. FrequenSee on Android) even slight clipping will be very visible (peaks at 3x, 5x, 7x, ... the base frequency will suddenly appear).
A DAC is unlikely to generate additional distortion on its own only because its volume is too high, as it is (usually) designed to obtain a unit gain corresponding to the maximum level of digital signal at its input. If a 16-bit DAC maxes out its analog output when the input signal is - say - 2^14, then it means that it is effectively operating on a dynamic range of 14-bit, and should be advertised as such. Of course things are not so straightforward, as even the best DACs are not perfectly linear, but they definitely should not clip the output signal.
Let's ignore the discussion about dynamic range and bit depth etc., and assume that the volume control on your operating system controls the DAC rather than doing the stupid thing of digital volume reduction. The fundamental issue is signal to noise ratio on the analog line. If you turn the volume too far down on the computer and turn the volume up on your speakers, the sound on the analog line is too low with regard to the electrical noise and will be hissy. If you turn the volume up too much on the computer and turn the volume down on your speakers, then the signal will be so loud as to produce distortion either in the DAC or on the line itself. You're looking for a middle ground: as loud an output from the computer that you can produce without causing distortion in your loudest music parts. Once you've got that set, change the volume on the speakers to compensate.