Game Development Reference
In-Depth Information
Adding some ambient audio
Audio is an extremely important moodsetter in games, and any other cross-media product,
which is often overlooked. Bad audio can just as easily break immersion as good audio can
improve it.
We're going to add some ambient audio to our scene to help set the mood. Since the sky
box we use is a rather gloomy and watery scene, we're going to add the sound of ocean
waves crashing against the shore.
Ambient sounds can either be sounds you hear throughout a whole scene, such as the buzz-
ing of traffic in a city, or local to a specific place, the sound of a waterfall, and so on. In this
case, we can picture our scene as a small island, and thus the waves should be heard
wherever you go.
As it happens, there is a suitable
.ogg
file in the
Environments
folder inside
Sound
. If
we have added the
jme3-test-data
library to our project, we can access it easily.
The SDK can handle both
.ogg
or uncompressed
.wav
files. The
.ogg
format is open
and free, meaning you won't need any license to use it. This is not necessarily the case with
other compression types.