Intel Spatial Audio for Java* Package TutorialLesson 5: Advanced Controls I
Goal: This lesson covers the use of some of the advanced capabilities available in the Intel Spatial Audio for Java* package. 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 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. 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. 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);
This page was last updated on Feb 11th, 1997.
|