Din (Ambient Noise)¶
There is an exception to when a Perception will not hear a noise emitted, even though it's between the Min Intensity and Max Intensity range, which is when the din (also commonly known as Ambient Noise) is loud enough to mask the noise emitted.
Thunderclap vs Whistle
Let's say we have an agent with a Perception component that can hear noises with an intensity between 0 and 1. If the Player emits a noise with an intensity of 0.5, the agent should be able to hear the noise if it is within the noise radius.
However let's say there is a thunderclap at the same time, which temporally changes the din (or ambient noise) to 0.75. In this case, the whistle won't be heard because the Perception component will be deaf to noises between 0 (Min Intensity) and 0.75 (current din). However any noise above 0.75 and below 1 will be heard.
The scope of a din source can either be local or global.
Global Din¶
Global Din affects the entire scene equally and can be set using the Set Global Din instruction. A Duration can be specified that determines the time it takes to change from the current value to the target one.
Local Din¶
The Local Din affects only a region of the scene and it is configured using the Din component.
The Radius field determines how far the ambient noise reaches, fading out the intensity at the edges of the sphere.
The Roll off slider allows to change how slow or fast the intensity fades. Setting the slider in the middle means the intensity fades out linearly, while moving the knot to the left will take longer for the intensity to fade the closer to the edges the Perception component is.
Linear when possible
It is recommended to leave the Roll off value at 6. Although in real life sound propagates logarithmically, players will feel more comfortable knowing that the din intensity changes linearly the closer they are to the source of the ambient noise.
The Use Obstruction field allows to use Obstruction components to block the ambient noise from affecting nearby sound-proof rooms.
The Level field is the intensity at which the din is at its highest point, gradually fading out towards the perimeter of the sphere.
To more consistently represent how sound and ambient noise affects the computed din, there is an Audio Source box field at the bottom of the component. This optional field allows to play an audio clip at a volume equal to the component's din.
This makes it much easier to synchronize the audio clips played as noise masks and the din values.