Unigine.SoundReverb Class
Inherits from: | Node |
This class is used to create reverberation zones for sound sources with reverberation flag. Such sound will have initial reflections, reverberation and echo. It can have modified pitch.
If the sound passes through two reverberation zones (for example, one reverberation zone around the player and another one around the sound source), the heard sound reverberation effect will be twice as strong.
Creating a Reverberation Zone#
To create a reverberation zone, first, create a sound source that will reverberate, then create an instance of the SoundReverb class and specify all required settings:
// create a sound source
SoundSource sound = new SoundSource("static_mono_00.oga");
sound.WorldTransform = MathLib.Translate(new Vec3(10.0f));
// disable sound muffling when being occluded
sound.Occlusion = 0;
// set the distance at which the sound gets clear
sound.MinDistance = 1.0f;
// set the distance at which the sound becomes out of audible range
sound.MaxDistance =10.0f;
// set the gain that result in attenuation of 6 dB
sound.Gain = 0.5f;
// loop the sound
sound.Loop = 1;
// start playing the sound sample
sound.Play();
// create a reverberation zone
SoundReverb reverb = new SoundReverb(new vec3(10.0f));
// set transformation
reverb.WorldTransform = MathLib.Translate(new Vec3(10.0f));
// set the threshold size that determines the distance of changing from partial to full reverberation audibility
reverb.Threshold = (new vec3(1.0f, 1.0f, 1.0f));
// set the other settings for the reverberation zone
reverb.Density = 0.2f;
reverb.Diffusion = 0.5f;
reverb.DecayTime = 1.0f;
reverb.ReflectionGain = 2.0f;
reverb.LateReverbGain = 8.0f;
To update the settings of the created reverberation zone, you can simply call the corresponding methods when necessary.
See Also#
-
A set of UnigineScript API samples located in the <UnigineSDK>/data/samples/sounds/ folder:
- sound_reverb_00
- sound_reverb_01
- Sounds sample in C# Component Samples suite
SoundReverb Class
Properties
vec3 Threshold#
vec3 Size#
float ReflectionGain#
float ReflectionDelay#
float ModulationTime#
float ModulationDepth#
float LateReverbGain#
float LateReverbDelay#
float GainLF#
float GainHF#
float Gain#
float EchoTime#
float EchoDepth#
float Diffusion#
float Density#
float DecayTime#
float DecayLFRatio#
float DecayHFRatio#
float AirAbsorption#
float RoomRolloff#
int ReverbMask#
Members
SoundReverb ( vec3 size ) #
Constructor. Creates a new reverberation zone of specified size.Arguments
- vec3 size - Size of the reverberation zone in units.