Digital Sound & Music: Concepts, Applications, & Science, Chapter 5, last updated 6/25/2013
55
value possible. (16-bit samples range from 32768 to 32767.) Converted to 8 bits, the sample
value becomes 127. (32767/256 = 127 with a remainder of 255.) The error from rounding is
255/32768. This is an error of less than 1%. But compare this to the error for the lowest
magnitude 16-bit samples, those between 0 and 255. They all round to 0 when reduced to a bit
depth of 8, which is 100% error. The point is that with a linear bit depth reduction method,
rounding down has a greater impact on low amplitude samples than on high amplitude ones.
In a nonlinear method such as mu-law encoding, when the bit depth is reduced, the effect
is that not all samples are encoded in the same number of bits. Low amplitude samples are given
more bits to protect them from quantization error.
Equation 5.5 (which is, more precisely, a function) effectively redistributes the sample
values so that there are more quantization levels at lower amplitudes and fewer quantization
levels at higher amplitudes. For requantization from 16 to 8 bits, .
Let x be a sample value, . Let
( )
if x is negative and
( )
otherwise. Then the mu-law function (also denoted -law) is defined by
( ) ( )
(
( | |)
( )
)
( )
(
(
| |)
)
Equation 5.5
The graph of the mu-law function in Figure 5.44 has the original sample value (on a scale
of 1 to 1) on the x-axis and the sample value after it is run through the mu-law function on the
y-axis. Notice that the difference between, say, mu(0.001) and mu(0.002) is greater than the
difference between mu(0.981) and mu(0.982).
mu(0.001) = 0.0410
mu(0.002) = 0.0743
mu(0.981) = 0.9966
mu(0.982) = 0.9967
The mu-law function has the effect of “spreading out” the quantization intervals more at lower
amplitudes.
Figure 5.44 Graph of -law function
MATLAB
Exercise:
Mu-Law
Encoding in
MATLAB
Previous Page Next Page