QUICK NAVIGATOR
PRODUCTS
TECHNOLOGIES
DEVELOPMENT TOOLS
* News
* Java Media Framework
* Intel Animation for Java
* Intel Spatial Audio for Java
* Runtime Software License
* SDK Software License
* System Requirements
* Download Area
* Documentation Online
* Gallery
* General FAQ
* Support Information

[INTEL NAVIGATION HEADER]

Intel Spatial Audio for Java* Package Tutorial

Lesson 5: Advanced Controls I

In this applet, the listener located in the center of the path crossed by the sound source, represented by a purple ball. Use the first two sets of buttons to adjust the reverberation settings and speed of sound in the Environment. (The speed of sound affects how Doppler effects are calculated.) Use the third set of buttons to change the pitch adjustment for the sound source, and use the Reset button to restore all settings to their original values.

You can edit the HTML file to specify a different sound file or a different icon to represent the sound source

Here is the source for the applet on this page, called AdvancedControls1.

Goal: This lesson covers the use of some of the advanced capabilities available in the Intel Spatial Audio for Java* package.

Doppler Effects

Doppler effects are calculated automatically whenever the speed of sound is set to a non-zero value. When you create an Environment, you can pass no parameters and accept the default settings, or pass an instance of the EnvironmentModel class. To use Doppler effects, set the EnvironmentModel.speedOfSound data member to a non-zero value. Intel Spatial Audio for Java uses arbitrary units: the speed of sound is expressed in generic units per-second. The units should match the units you are using to set the position or model of a sound source..

/* 
* sound travels 300 units per second 
*/
EnvironmentModel envModel = new EnvironmentModel(RenderOptions.DEFAULT, 
                                                 300.0f,
                                                 RenderOptions.DEFAULT,
                                                 null);
env.setModel(envModel);

Reverberation

Reverberation is a characteristic of the Environment. You can adjust the reverberation settings by using the Environment.setReverb() method. You can pass an integer to choose a common reverberation setting, or use an instance of the ReverbModel class to specify your own parameters for the reverberation intensity and decay time. You can also use the setReverb() method to turn reverberation on and off using the reverbState member of the ReverbModel class.

environment.setReverb(ReverbModel.STAGE_REVERB);
-- or --
environment.setReverb(true, 0.85f, 0.4f);

Use the corresponding getReverb() function to retrieve the current reverberation parameters.

Pitch Control

You can adjust the pitch of an individual sound source using the SoundSource.setPitch() method. Values from 0.25 to 4.0 are valid; 1 is the default and indicates that the sound should be played at its natural pitch.

/* 
* raise the pitch of this sound source
*/
soundSource.setPitch(2.0f);

Use the corresponding getPitch() function to retrieve the current pitch adjustment.

Advanced Media Controls

We have already used the setPlayState() method to adjust the play of a cached sound source. Remember that telling the sound to play causes it to loop indefinitely over the entire data file.

You can pass additional parameters to this function to provide more information on how the sound should be played.

/* 
* this tells the sound source to loop five times, 
* starting 2.4 seconds into the data file the first time.
*/
soundSource.setPlayState(MediaState.AUDIO_PLAY, 5, 2.4f);

You can retrieve information about the state of cached and streaming sound sources using the getMediaState() method.

You can restrict the region of a data file marked for playback using CachedSoundSource.setPlaybackMarks().

/* 
* all playback will now occur only over the first three 
* seconds of the data file.
*/
soundSource.setPlaybackMarks(0.0f, 3.0f);
Previous Lesson Tutorial Contents Next Lesson

 

This page was last updated on Feb 11th, 1997.

Legal Stuff

Free Web Hosting