Digital Sound & Music: Concepts, Applications, & Science, Chapter 5, last updated 6/25/2013
mu_inverse(127/128) = 0.9574
ceil(32768*0.9574) = 31373
Both 32145 and 32178 convert back to 31373.
With mu-law encoding, the results are better than they would have been if a linear
method of bit reduction had been used. Let’s look at the linear method. Again suppose we
convert from 16 to 8 bits by dividing by 256 and rounding down. Then both 16-bit values of 33
and 66 would convert to 0 at 8 bits. To convert back up to 16 bits, we multiply by 256 again and
still have 0. We’ve lost all the information in these samples. On the other hand, by a linear
method both 32145 and 32178 convert to 125 at 8 bits. When they’re scaled back to 16 bits, they
both become 32000. A comparison of percentage errors for all of these samples using the two
conversion methods is shown in Table 5.2. You can see that mu-law encoding preserves
information at low amplitudes that would have been lost by a linear method. The overall result is
that with a bit depth of only 8 bits for transmitting the data, it is possible to retrieve a dynamic
range of about 12 bits or 72 dB when the data is uncompressed to 16 bits (as opposed to the 48
dB expected from just 8 bits). The dynamic range is increased because fewer of the low
amplitude samples fall below the noise floor.
sample at 16
sample after
companding, 16
to 8 to 16
error sample after
16 to 8 to 16
33 0 100% 32 3%
66 0 100% 63 4.5%
32145 32000 0.45% 31373 2.4%
32178 32000 0.55% 31373 2.5%
Table 5.2 Comparison of error in linear and nonlinear companding
Rather than applying the mu-law function directly, common implementations of mu-law
encoding achieve an equivalent effect by dividing the 8-bit encoded sample into a sign bit,
mantissa, and exponent, similar to the way floating point numbers are represented. An
advantage of this implementation is that it can be performed with fast bit-shifting operations.
The programming exercise associated with this section gives more information about this
implementation, comparing it with a literal implementation of the mu-law and inverse mu-law
functions based on logarithms.
Mu-law encoding (and its relative, A-law, which is used Europe) reduces the amount of
data in an audio signal by quantizing low-amplitude signals with more precision than high
amplitude ones. However, since this bit-depth reduction happens in conjunction with
digitization, it might more properly be considered a conversion rather than a compression
Actual audio compression relies on an analysis of the frequency components of the audio
signal coupled with a knowledge of how the human auditory system perceives sound a field of
study called psychoacoustics. Compression algorithms based on psychoacoustical models are
grouped under the general category of perceptual encoding, as is explained in the following
Previous Page Next Page