When sound is represented digitally the amplitude of the sound wave is taken at different points in time and recorded as a number. How often a sample is taken defines the sampling rate. What number is used to record the amplitude of each sample defines the sampling resolution.
The sampling resolution is the representation (or size of the numbers) used to write samples in digital sound recording.
In some common digital audio formats, the amplitude of samples is recorded digitally with basic data types (e.g., integers) with specific number of bytes and bits. Thus, the sampling resolution can also be called bit depth or bit resolution (number of bits per sample).
As in the examples below, the advantages and disadvantages of larger and smaller sampling resolutions are obvious. Larger sampling resolutions allow for larger dynamic ranges and larger signal-to-noise ratios but require more space for the recorded audio data.
The following are examples.
Sampling resolution of CD-quality audio
In audio CDs, each sample is recorded as a 16-bit integer. 16 bits (2 bytes) can represent 216 = 65536 values. In CD audio, these are the values between -32768 and 32767. The absolute value of the amplitude of samples can only use 65536 / 2 = 215 = 32768 values. This is because the audio signal oscillates up and down, taking positive and negative values with a zero value in CD audio representing zero amplitude.
The implications for CD-quality audio are as follows:
- The dynamic range of CD audio – the ratio of loudest to quietest samples – is 20 log10 (215/1) ≈ 90 dB. This is appropriate, as it is also approximately the dynamic range of human hearing.
- Since each sample takes 2 bytes, the sampling rate in CD audio is 44.1 kHz (44100 samples per second), and CD audio is stereo (it uses two channels and therefore two samples at each point in time), one second of CD audio takes 2 * 44100 * 2 = 176000 bytes. The typical 74-minute CD then must accommodate 176000 * 60 * 74 ≈ 747 Mb of data.
Note that CD audio uses uniform sampling rates and sampling resolutions (i.e., the PCM process). That is, the sampling rate and sampling resolution does not change throughout the CD.
Sampling resolution, dynamic range, and quantization errors
As above, the sampling resolution of 16 bits in CD audio allows the dynamic range of approximately 90 dB.
For comparison, consider an audio recording with the uniform sampling resolution of 8 bits per sample and assume that this recording similarly uses signed integers to store information. The dynamic range of this recording would be 20 log10 (27/1) ≈ 42 dB.
More interesting is that 8-bit recording will contain quantization noise. Since recorded samples must be rounded and assuming they are rounded to the closest integer, the largest possible error in the recording will be 0.5. This is the largest potential difference between the real analog signal and the digitized recording at a specific sample. These differences are the noise in the recording due to the sampling and quantization process. The signal to noise ratio, which is the ratio of this error to the maximum value of the signal amplitude, is 20 log10 (0.5 / 27) ≈ -48 dB. If the range of human hearing is 90 dB, then this noise will be very audible. Thus, 8-bit recording is likely to contain noise that is simply due to the sampling process.
In comparison, the signal to noise ratio in 16-bit recording will be 20 log10 (0.5 / 215) ≈ -96 dB. The noise will not be audible, unless amplified.
Sampling resolution and the Wave file format
An example of common wave files is Microsoft PCM wave files (wave files with compression code 1). Common sampling resolutions in such files are 8-bit, 16-bit, 24-bit, or (more rarely) 32-bit. Samples are stored as integer values and may be signed (with positive and negative values) or unsigned (positive only). Often, 8-bit sampling uses unsigned (positive) integers, which means that the samples will take the values between 0 and 28 = 258, with zero amplitude represented by the value 128 in the middle. 16-bit and 24-bit sampling, on the other hand, often use signed (both positive and negative) integers, with zero amplitude represented by the value 0.
Another example wave file format is Microsoft IEEE (wave files with compression code 3). Files with this format use 32-bit sampling resolution. In these files, samples take floating point values between -1 and 1 and not integer values.