Java Reference
In-Depth Information
However, while a point sound source will radiates uniformly in all directions, a cone
sound is directional and radiates more strongly at a certain direction, in the same way that
a spot light has more light output shining at an object of interest.
Technically, the amplitude of the sound from a cone sound depends on both the dis-
tance from the source as well as the angle the user has with the sound source in the virtual
world. Figure 3 gives an example for creating a cone sound. The codes are similar to those
in Figure 2, except for some additional controls that can be specified regarding how the
sound will be attenuated at different directions.
Specifically, the principal direction of the sound is given in line 38. On attenuation or
gain as a function of distance, two front and back distance gain attenuations are provided
in lines 2, 3 and 39. A single distance gain attenuation is also possible, corresponding to
using the same profile for both distance attenuation for front and back propagation.
Lines 4, 5, and 40 specify the variation of gain as a function of direction, giving the
coning profile for the sound. The specification of this is in the form of an array of triples.
The first of the triple gives the angle separation from the main direction, the second one
gives the gain factor, and the last one is a filter cut off frequency used for implementing a
low pass filter to remove the higher frequency components of the sound.
aural envIronment
In addition to placing multiple sound sources through the Sound leaf node in a virtual
world, it is also possible in Java 3D to implement specific acoustical characteristics so as
to simulate some special aural effects and add realism to the environment (View Model,
2006). We will outline in this section two examples on how this can be done by using the
appropriate classes and methods.
The code segment for the first example is given in Figures 4 to 6, in the form of codes
for three files,,, and The
main method is and is shown in Figure 4. A modified version of a
similar problem from the chapter on multiple views, this allows the user to navigate in the
virtual world.
Essentially, MultiViewApp creates a PointSoundScape object and invokes methods from
the PointSoundScape class. The most important line in this example is line 10, which add
an avatar to the virtual world, and lines 20 and 21, which initialize the sound in Java 3D.
An explicit method for initializing the sound is implemented as a customized view
branch has been used. The same effect can be accomplished by using the getViewer().
createAudioDevice() method implicitly from the SimpleUniverse utility class. Note that
Sound and Soundscape will become active when the ActivationVolume of the ViewPlatform
overlaps their scheduling or activation bounds.
Search WWH ::

Custom Search