Optimize Sound #58
Chapter 7, Sound
Picking a piece of music that matches the mood of your site and then time-
compressing sections of it to create a set of UI sounds is a quick and easy
way to create unique sounds that enhance your site graphics with matching
If you don’t even want to do that, then there are always abandonware sound
assets—maybe not totally free of copyright problems, but a much better way
to go if the only other alternative is plundering the UI sounds from your OS
Optimize Sound Hack #58
Optimize MP3 sound for Flash.
In Flash sites, sound is not only integral but can also be the largest band-
width hog. It’s easy to find information on optimizing bitmaps for web use,
but there is very little on optimizing sound. This hack shows ways to edit
sounds before importing them into Flash so that the maximum quality can
be achieved for a given filesize (or the minimum filesize for a given quality).
Hacking Around Quantization Noise
The sampling process inherently introduces an error called quantization
error, which produces quantization noise. Quantization is the technical term
for the process of converting a continuous (analog) signal into a digital one
that can be defined by a number of fixed levels (quantization levels). The
more commonly used term for this process is digitization, and a signal con-
sisting of a number of quantization levels is called a digital signal. Quantiza-
tion noise causes the high-pitched edge you hear on low-quality sound
samples. It is the effect that makes your telephone voice sound mechanical.
When you sample a continuous (analog) signal, you end up with an approx-
imation that consists of discrete levels, creating a waveform that looks like a
series of steps, as shown in Figure 7-16. These levels are the number of
quantization levels. The quantization noise is the difference between the
analog wave and its digital approximation (the digital signal is always an
approximation of the original analog level).
There are two ways to reduce quantization noise. The standard way is to
decrease the quantization step size by increasing the number of quantiza-
tion levels. This is why using 16-bit sound samples (65,536 quantization lev-
els) sounds much better than using 8-bit samples (256 quantization levels).
It also doubles your filesize versus 8-bit samples.
Chapter 7, Sound
#58 Optimize Sound
The hacky way around is to use all the available quantization levels. Using
as many of the quantization levels as possible increases the fidelity of the
digitized signal. Also, unlike analog noise, which can increase as you
increase the signal volume or power, quantization noise stays at the same
level regardless of the signal volume (it depends on the spacing between
available quantization levels rather than the signal amplitude). So increasing
the signal level drastically reduces the signal-to-noise ratio (SNR).
Consider the two waves shown in Figure 7-17. The bottom one shows a
wave that has been recorded at low volumes. The quantization levels are
large compared to the signal, causing sampling resolution to be low and the
SNR to be high. The top wave has a higher volume and uses more quantiza-
tion levels; it will have a much better SNR and digitization fidelity.
The maximum benefit is achieved if you increase the volume of the sample
so that it is just below the maximum quantization level (around 90–95%), as
indicated by the dotted line at the top of Figure 7-17.
To increase the volume of a sample, you need to either increase its ampli-
tude using a maximizer filter or normalize it. We will show how to normal-
ize using Adobe Audition.
Figure 7-16. An analog waveform (light curve) and its digital approximation (dark steps)

Get Flash Hacks now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.