Always dither before you quantize

Quantization adds noise.  Taking a nice continuous signal and expressing it as distinct integers will introduce a round-off error, which means you've added random fluctuations to the signal, which is the definiton of noise.  Remember that noise is inevitable, so we just have to manage it (such as using enough bits per sample).  The problem is that round-off errors aren't random - just ask any banker.  Whether you round up or down can be strongly correlated with the signal - down at the peak of the continuous wave and up at the trough, for example.  We have a word for signal-correlated noise, and that's distortion.  Distortion is much more difficult for the ear to separate from signal, which makes it much worse, from an audio perspective.  Fortunately, there's a solution.  Ironically, it's to add more noise.

Dithering is the technique of adding white noise to a continuous signal before quantizing it.  This noise effectively cancels the distortion introduced by rounding because the noise is no longer correlated to the signal.  The noise floor of the quantized signal is higher (reducing dynamic range), but it is white noise which is much easier on the ear than the distortion it's covering up.

One common type of dithering is Triangular Probability Dithering(TPD).  With TPD, you generate two random numbers x and y in the range [0, 1] (uniform distribution) for each sample.  Add (x-y)/2 to the sample, and then round to the nearest integer.  This is gives the quantized signal a white noise floor 3dB over the undithered sample, but clears any distortion artifacts due to rounding.

Quantization noise is usually not considered a big problem in signals, because the solution is as simple as adding more bits to your samples.  Remember that quantization noise is determined by the theoretical maximum dynamic range for your sample size.  The quantization noise floor for 16-bit samples will be 96dB below the full-scale level.  If you use TPD, your noise floor goes to 93dB below full scale.  This is only a problem, though, if your input continuous signal has more than 93dB of dynamic range, and if it does, you just add enough bits to push the quantization noise below the noise of your original samples. 

The add-more-bits approach does not, however, remove the need to dither.  Spectral (pure sine wave) components in the distortion caused by round-off can be quite noticable even when the overall quantization noise is below the signal's floor.  Dithering smooths this distortion into white noise, spreading it across all bands, and ensuring no component is too high.

If you ever have to convert from continuous real number samples to integers, keep in mind this simple rule of thumb.  Always dither before you quantize.