Sound Compression and Expansion
One minute of single-channel sound recorded with the fidelity you would
expect from a commercial compact disc occupies about 5.3 MB of disk space.
One minute of sound digitized by the current low-fidelity digitizing
peripherals for the Macintosh occupies more than 1 MB of disk space. Even one
minute of telephone-quality speech takes up more than half of a megabyte on a
disk. Despite the increased capacities of mass-storage devices, disk space can
be a problem if your application incorporates sound. The space problem is
particularly acute for multimedia applications. Because a large portion of the
space occupied by a multimedia application is likely to be taken up by sound
data, the complexity and richness of the application's sound component are
limited.
To help remedy this problem, the enhanced Sound Manager includes a set of new routines known collectively as Macintosh Audio Compression and
Expansion (MACE). MACE enables you to provide more audio information in
a given amount of storage space by allowing you to compress sound data and
then expand it for playback. These enhance-ments are based entirely in
software and require no specialized hardware.
The new audio compression and expansion features allow you to enhance your
applications by including more audio data. MACE also relieves some
distribution problems by reducing the number of disks required for shipping
an application that relies heavily on sound. MACE may make some new kinds of
applications feasible as well, such as talking dictionaries and
language-in struction software.
MACE adds three main kinds of capabilities to those already present in the
Sound Manager-audio data compression, real-time expansion and playback of compressed audio data, and buffered expansion and playback of compressed
audio data.
audio data either in the original buffer or in a separate buffer. If a
segment of audio data is too large to fit into a single buffer, then your
application can make repeated calls to the compression routine.
compressed audio data contained in a small internal buffer and play it
back at the same time. Since the audio data expansion and playback
occur at the same time, there is greater CPU loading when using this
method of sound expansion rather than buffered expansion.
buffer of com-pressed audio data and store the result in a separate
buffer. The expanded buffer can then be played back using other
playback. Applications that require screen updates or user interaction
during playback (such as animation or multimedia applications) should
use buffered expansion.
MACE provides audio data compression and expansion capabilities in ratios of
either 3:1 or 6:1 for all currently supported Macintosh models, from the
Macintosh Plus forward. The principal trade off when using MACE is that the
expanded audio data suffers a loss of fidelity in comparison to the original data.
A small amount of noise is introduced into a 3:1 compressed sound when it is
expanded and played back, and a greater amount of noise for the 6:1 ratio. The
3:1 buffer-to-buffer compression and expansion option is well suited for
high-fidelity sounds. The 6:1 buffer-to-buffer compression and expansion
option provides greater compression at the expense of lower-fidelity results
and is recommended for voice data only. This technique reduces the frequency
bandwidth of the audio signal by a factor of two to achieve the higher
compression ratio.
The following provides a summary of the available compression and expansion
options.
Table Audio compression and expansion options
3:1 and 6:1 Stereo
3:1 and 6:1 expansion expansion Sample-rate
Computer compression and playback and playback con version
Macintosh Plus Real-time Real-time No No
Macintosh SE Real-time Real-time No No
Macintosh Por table Real-time Real-time Yes Yes
Macintosh II
and successors Real-time Real-time Yes Yes
Note: Macintosh Plus, Macintosh SE, and Macintosh Por table
computers play only the right channel of stereo 'snd ' data through
the internal speaker. Certain Macintosh II models may play only a
single channel through the internal speaker.
play digitized audio signals can play compressed audio signals without
modification or recompilation.
TheMACE routines assume that each sample consists of 8 contiguous bits of
data. The compression techniques do not, however, depend on a particular
sample rate. The compression techniques produce their best quality output
when the sample rate is the same as the output rate of the sound hardware of the
machine playing the audio data. The output rate used in current Macintosh
computers is 22.254 kilohertz (hereafter referred to as the 22 kHz rate).
Because of speed limitations, the Macintosh Plus and Macintosh SE cannot
perform sample-rate conversion during expansion playback. On those
machines, all sounds are played back at a 22 kHz rate. To provide consistent
quality in sounds that may be played on different machines, you should record
all sounds at a 22 kHz sample rate.
TheMACE algorithms are optimized to provide the best sound quality possible
through the internal speaker in real time. However, the user who employs
high-quality speakers may notice a high-frequency hiss for some sounds
compressed at the 3:1 ratio. This hiss results from a design trade off between
maintaining real-time ope ration on the Macintosh Plus and preserving as much
frequency bandwidth of the signal as possible. If you think that your output
may be played on high-quality speakers, you may want to filter out the hiss
before compression by passing the audio output through an equalizer that
removes frequencies above 10 kHz. When you use the 6:1 compression and
expansion ratio, your frequency response is cut in half. For example, when
you use the 22 kHz sample rate, the highest frequency possible would normally
be 11 kHz; however, after compressing and expanding the data at the 6:1 ratio,
the highest frequency you could get would be only 5.5 kHz