📄 ch11.htm
字号:
of time for resources to load, you should try to keep the quantity
and size of sounds used by your games within reasonable limits.
<P>
The second limitation, which is a little less obvious, is that
you can't use copyrighted sounds without written permission from
the owner of the copyright. For example, sounds sampled from copyrighted
movies or audio recordings can't be used without permission. It
is technically no different than using copyrighted software without
permission or a licensing agreement. So be careful when sampling
sounds from copyrighted sources.
<P>
<CENTER><TABLE BORDERCOLOR=#000000 BORDER=1 WIDTH=80%>
<TR><TD><B>Warning</B></TD></TR>
<TR><TD>
<BLOCKQUOTE>
Some seemingly public domain sound collections are actually copyrighted and can get you into trouble. Most of these types of collections come in the form of an audio CD containing a variety of sound effects. Be sure to read the fine print on these CDs, and
make sure you can legally reuse the sounds or get explicit permission from the publisher.</BLOCKQUOTE>
</TD></TR>
</TABLE></CENTER>
<P>
<P>
Beyond these two limitations, you are free to do whatever you
want with sounds in your game creations. Let's take a look at
how you can begin experimenting with sound.
<H2><A NAME="SoundUtilities"><B><FONT SIZE=5 COLOR=#FF0000>Sound
Utilities</FONT></B></A></H2>
<P>
To be able to create and modify your own sounds, you need some
type of software sound editing utility. Sound editing utilities
usually provide a means of sampling sounds from a microphone,
CD-ROM, or line input. From there, each utility varies as to what
degree of editing it provides. Some sound editing utilities include
very advanced signal processing features, in addition to the relatively
standard amplification and echoing features.
<P>
The most important component of a good sound editor in regard
to Java games is the capability to save sounds in the AU format.
It doesn't matter how cool the sounds are if you can't play them
with Java. Another key feature is the capability to zoom in and
clip sounds down to exactly the portions you want to use. Because
the length of sounds is of the utmost importance in Java games,
you should always clip sounds down to the absolute minimum length
possible.
<P>
The rest of this section focuses on some popular shareware sound
editors that you can use to edit sounds for Java games. They all
support the AU sound format and provide some degree of sound effects
processing. There are also equally, or more, feature-packed commercial
sound utilities out there, but I want to keep the focus on shareware
because you can easily download shareware and try it out.
<H3><A NAME="CoolEdit"><B>Cool Edit</B></A></H3>
<P>
Cool Edit, by Syntrillium Software, is a sound editor for Windows
95 that is loaded with features. Its creators have suggested thinking
of it as a paint program for audio. Just as a paint program enables
you to create images with colors, brush strokes, and a variety
of special effects, Cool Edit enables you to "paint"
with sound: tones, pieces of songs with voices and other noises,
sine waves and sawtooth waves, noise, or just pure silence. Cool
Edit provides a wide variety of special effects for manipulating
sounds, such as reverberation, noise reduction, echo and delay,
flanging, filtering, and many others.
<P>
You can get information about Cool Edit and download the latest
version from the Syntrillium Software Web site, which is located
at <TT><A HREF="http://www.netzone.com/syntrillium">http://www.netzone.com/syntrillium</A></TT>.
Figure 11.3 shows the Syntrillium Software Web site.
<P>
<A HREF="f11-3.gif" ><B>Figure 11.3 : </B><I>The Syntrillium Software Web site.</I></A>
<H3><A NAME="SoundExchangeSoX"><B>Sound Exchange (SoX)</B></A>
</H3>
<P>
Sound Exchange (also known as SoX), by Lance Norskog, is the self-proclaimed
Swiss army knife of sound editors because it provides a minimal
interface but a lot of features. It functions more as a sound
converter rather than a sound editor and is available for both
UNIX and DOS pcs. It provides support for converting between many
different sound formats, along with sampling rate conversion and
some sound effects. The complete source code for SoX is also available,
so if you're adventurous enough, you could port it to another
platform. As if you don't have enough to keep you busy learning
Java game programming!
<P>
You can get information about Sound Exchange and download the
latest version from the Sound Exchange Web site, which is located
at <TT><A HREF="http://www.spies.com/Sox">http://www.spies.com/Sox</A></TT>.
Figure 11.4 shows the Sound Exchange Web site.
<P>
<A HREF="f11-4.gif" ><B>Figure 11.4 : </B><I>The Sound Exchange sound utility Web site.</I></A>
<H3><A NAME="SoundMachine"><B>Sound Machine</B></A></H3>
<P>
Sound Machine, by Rod Kennedy, is a Macintosh sound editor with
lots of conversion and sound effects features. Mr. Kennedy is
also working on some interesting Netscape plug-ins that will interact
with Sound Machine. Pretty neat!
<P>
You can get information about Sound Machine and download the latest
version from the Sound Machine Web site, which is located at
<BLOCKQUOTE>
<TT><A HREF="http://online.anu.edu.au/RSISE/teleng/Software/SoundMachine/welcome.html">http://online.anu.edu.au/RSISE/teleng/Software/SoundMachine/welcome.html</A></TT>
</BLOCKQUOTE>
<P>
<A HREF="f11-5.gif" ><B>Figure 11.5 : </B><I>The Sound Machine sound editor Web site.</I></A>
<H3><A NAME="SoundHack"><B>Sound Hack</B></A></H3>
<P>
Sound Hack, by Tom Erbe, is another Macintosh sound utility with
a wide variety of neat features. Unlike Sound Machine, however,
Sound Hack is more of a sound processor, and it leans toward more
esoteric sound processing features. For example, Sound Hack includes
processing effects such as pitch shifting, binaural filter spatialization,
and spectral mutation, among others. If you have no idea what
these features are, just grab a copy of Sound Hack and try them
out for yourself!
<P>
You can get information about Sound Hack (including online documentation)
and download the latest version from the Sound Hack Web site,
which is located at <TT><A HREF="http://shoko.CALARTS.EDU/~tre/SndHckDoc">http://shoko.CALARTS.EDU/~tre/SndHckDoc</A></TT>.
Figure 11.6 shows the Sound Hack Web site.
<P>
<A HREF="f11-6.gif" ><B>Figure 11.6 : </B><I>The Sound Hack sound processor Web site.</I></A>
<H2><A NAME="CreatingandEditingSounds"><B><FONT SIZE=5 COLOR=#FF0000>Creating
and Editing Sounds</FONT></B></A></H2>
<P>
After you've decided on a sound utility, you're ready to start
creating and editing sounds. The first decision to make is how
you will create the sounds. For example, are you planning to record
sounds yourself with a microphone or sample sounds from a stereo
cassette deck or VCR? The microphone is probably the easiest route,
because many multimedia computers come equipped with one. It's
also the most creative route. However, you might already have
some sounds in mind from a prerecorded cassette, CD, or movie,
which means that you need to look into connecting an external
sound source to your computer. This is covered in detail a little
later in today's lesson.
<P>
Regardless of where you sample sounds from, the process of getting
a sampled sound cleaned up for use in a game is basically the
same. After you've sampled a sound, play it back to make sure
that it sounds okay. It's likely that the sound will be either
too loud or too soft. You can judge whether the volume of the
sound is acceptable by looking at the waveform displayed in the
sound editor. If the sound amplitude goes beyond the top or bottom
of the waveform display, you know it's definitely too loud. If
you can barely hear it, it's probably too soft. To remedy this
problem, you can either adjust the input level for the sound device
and resample the sound or try to use amplification effects provided
by the sound utility.
<P>
The <I>waveform</I> of a sound is the graphical appearance of
the sound when plotted over time.
<P>
The best way to fix the volume problem is to adjust the input
level of the sound device and resample the sound. For example,
in Windows 95 you can easily adjust the microphone or line input
level using the Volume Control application (see Figure 11.7).
<P>
<A HREF="f11-7.gif" ><B>Figure 11.7 : </B><I>The Windows 95 Volume Control application.</I></A>
<P>
After you have the volume of the sound at a level you like, you
need to clip the sound to remove unwanted portions of the sound.
<I>Clipping</I> a sound involves zooming in on the waveform in
a sound editor and cutting out the silence that appears before
and after the sound. This helps shorten the length of the sound
and prevents unnecessary latency.
<P>
<I>Clipping</I> is the process of removing unneeded parts of a
sound, such as silence at the beginning and end.
<P>
<CENTER><TABLE BORDERCOLOR=#000000 BORDER=1 WIDTH=80%>
<TR><TD><B>Note</B></TD></TR>
<TR><TD>
<BLOCKQUOTE>
<I>Latency</I> is the amount of time between when you queue a sound for playing and when the user actually hears it. Latency should be kept to a minimum so that sounds are heard when you want them to be heard without any delay. Unnecessary silence at the
beginning of a sound is a common cause of latency problems. The other, less controllable, cause is the audio mixing support in Java itself.
</BLOCKQUOTE>
</TD></TR>
</TABLE></CENTER>
<P>
<P>
When you have a sound clipped, it should be ready for prime time!
You might want to check out the kinds of effects that are available
with the sound utility you are using. Some simple effects range
from reverse to echo, with more advanced effects including fading
and phase shifts. It's all up to your imagination and your discerning
ears!
<H3><A NAME="RecordingwithaMicrophone"><B>Recording with a Microphone</B></A>
</H3>
<P>
If you are recording sounds with a microphone, you can get much
better results by covering the microphone with soft foam, like
the kind found on some portable earphones. Some microphones already
have foam covers. The foam cover greatly reduces the hiss caused
by blowing on the microphone. It seems that no matter how careful
you are, you always end up blowing into the microphone a little.
This causes a noisy hiss unless you have the microphone covered.
You can tape tissue over the microphone if you can't find any
foam.
<P>
After you have the microphone set up for recording, prepare to
throw convention aside and get creative. It's really amazing what
can be done with a microphone and a little reckless abandon! You
can come up with some pretty neat sound effects just by being
creative with everyday household items. Let's take a few examples.
<P>
If you need gunshots or simple explosions, try tapping the microphone
on a table. You can get different sounds by hitting it harder
or softer and by trying different surfaces. Please don't hold
me responsible if you beat your microphone to death on a table,
though! You'll notice that harder surfaces generate sharper sounds.
Because most gunshot sounds are repeated often, it's nice to have
them as short and sweet as possible. The sharp sounds generated
by a hard surface work pretty well for this.
<P>
If you're looking for more realistic explosions that actually
fade out, you're going to have to perform a little. Hold your
hand around the microphone and make a rough, blowing sound into
your hand. After a little practice, you can get pretty realistic
explosion sounds with this method. Just make sure no one's around
when you're practicing!
<P>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -