It is my understanding that samples should be 2x the highest frequency sampled, but I'm confused as to why samples are taken beyond a 40kHz range if the human ear can't tell the difference either way.
The reason people use higher frequencies than the Nyquist Theorom suggests (which states the lowest sampling frequency for a given bandwidth that won't cause aliasing) is that during the editing process, the higher sample rate allows for more accurate editing and a better representation of any effects processing applied, even after sample rate conversion. In this case, the closer to an analogue wave, the better.
If you were to record a soundtrack for a DVD, and you were sure you were only going to apply some amplitude effects (compression, etc), then it's best to record at the output SR; in this case 48kHz. If, on the other hand you were to fully process the sound; editing, adding filters and modulation effects, reverb etc, then it is best to record at a higher sample rate then finally downsample using a good sample rate converter.
Another reason is "future-proofing" anything you record.
They are the main reasons. Some people think this isn't a big deal, and the benefits are marginal. But I've always done it for serious projects. With cheap processing power and HDD space, I don't see why not. Note that it is generally agreed that increasing the sample rate above 48kHz is not as important as utilizing the highest bit depth possible.
A digitally sampled signal always is a representation of an analog signal. The proper process of going from analog to digital without oversampling involves applying a perfect lowpass filter cutting off at the Nyquist frequency before sampling. Conversely, reproduction involves outputting sampled pulses (rather than stairsteps) and then applying a perfect lowpass filter for reconstruction. Good analog filters introduce too much noise, so instead one uses "oversampling" which allows to use comparatively lenient analog filtering and then do the "perfect" analog filtering in the digital domain.
If you oversample with 192kHz, for example, the analog filtering has all of 24kHz to 168kHz until it really has to reach full attenuation in order to avoid aliasing effects from sampling. The digital filtering can then cater for the rest before downsampling to 48kHz.
Audio A/D converters actually integrate that kind of circuitry nowadays so with good high-end stuff, you don't lose anything by working with 48kHz signals.
However, this representation is fine for reproduction. But if you apply effects on it, the effects work differently than on the analog signal because there is always the "reconstruction filtering" (which is a linear operation) applied afterwards.
Any non-linear or any time-changing operation, like squaring, dynamic compression, distortion, modulation, flangers and others, that you would do in the analog domain usually will not transfer equivalently to the digital domain because of this kind of reconstruction filtering representation. So-called IIR filter design, modelled after analog filter design, will experience frequency warping where the filters have a progressively larger cutoff attenuation at higher frequencies than their analog equivalents. So graphic equalizers implemented with the comparatively efficient IIR filters (and in good analogy to analog filters) will get spaced badly in the higher bands when using the same design techniques as with analog filters.
Now if you work with higher sampling frequencies, manipulating the single digital samples like you'd manipulate the continuous analog signal becomes more similar to the real thing in the audible range. Filters don't show significant frequency warping within the audible range. Bleedover artifacts from a hard digital filter at Nyquist frequency range are not to be expected.
In principle, you can still store material properly reduced to 48kHz by oversampling etc, and blow it up again to 192kHz samples by digital reconstruction filtering before processing. That still buys you processing that is "almost like working continuously". Instead using actual real samples from outside the audible range requires less "decision-making" with what may or may not be good, and when some processing actually causes higher frequency original content to affect lower frequency content in the result, actually working with the original signal rather than its low-pass filtered reconstruction might conceivably avoid some artifacts "folding back" from beyond the Nyquist frequency.
I like to use frequencies higher than 48kHz for two reasons:
- It provides more scope for slowing a sample down and retaining some degree of 'interest' (previously inaudible elements become audible)
- There's the complication of the 'phase' aspect of waves, particularly when analysing spectra or passing through analogue electronics, which potentially is more accurately handled by using higher frequencies.
This seems a good tutorial that includes mention of phase in audio signals.
(this was meant aas a comment to Marc W's answer, but ended up being to long for a comment...)
To further elaborate on the first paragraph of Marc W's answer, capturing frequencies up to 98 KHz can be relevant in some extreme situations where effects processing can create new partials within the human sensitivity threshold.
However the most important factor is that more samples per time interval allows to apply transformations without rounding errors harming the audible spectrum.
The most obvious example is simple time stretching, where each new sample is going to be an interpolation of two original samples. The closer the samples are to each other in time, the smaller the interpolation error. It's easy to understand that if we have barelly enough samples to keep the quality close to the human sensisity, any interpolation process is going to affect heavily the audible signal quality.
The same applies to any spectral based transformation (as are many of filters and effects in use today in dedicated DSP devices or sw plugins), as the transformation will be applied to "chunks" of time based samples. The more samples we have, the more precise will be the resulting spectrum and the end result of the transformation.
We can make a simples analogy with working with pictures in Photshop, it's good to work at the highest possible image resolution when we are resizing and combining images, applying filters, etc. When we have our final product we can resample down to the image size that fits our purpose.
I think the answers above whilst informative are over complicated for the OP question. Simple answer. One word: Interpolation. In post production we will record in the highest sample rates possible so we can slow down (time warp, time stretch) whatever you want to call it and retain sample quality without the need for the adc to have to recreate sample points. Musically though whilst you can't hear above 20kHz theoretically, recording in higher sample rates improves the overall quality of audio in frequencies you CAN hear. The reason the Red book standard is 44.1kHz and not 40kHz is because brick wall filters don't exist in practice on the reconstruction filter of a DAC/ADC so the the 4.1kHz is headroom to catch stray ultrasonic frequencies.