Daniel Lip
Daniel Lip

Reputation: 11335

Why can I only hear this audio source while the camera is close?

The noise is very loud and sometimes I can hear audio from other place/s in the scene.

The player character have a camera as child and the camera have a audio listener :

Player camera inspector settings

When the player is standing under a object in the scene that have a audio source attached then the sound is starting. If I'm moving the player a bit the sound stop. It seems like only when the player audio listener is detecting the object audio source then the sound start :

At this position the sound is hearing making noise mostly unclear sound just noise :

Player

If I'm moving the player a bit forward to the red door the noise stop. When moving back to this position the noise start again.

Now when standing at this position and the noise is happening if I'm looking up to the ceiling I can see the object that have the audio source and that when I'm standing under it the noise start :

Object with audio source

I did some tests :

If I'm turning oof disable the player Audio Listener this noise getting much much louder.

If the player Audio Listener is on enabled true but the object audio source is turned off when the audio source is turned off the noise stop. But turning off the object audio source disable the audio source is not a solution there is a reason why there is a audio source on this object.

I didn't check other objects in the scene with audio source there are many objects with audio source.

I can't figure out why it happens.

Upvotes: 0

Views: 1498

Answers (1)

Ruzihm
Ruzihm

Reputation: 20269

Audio Sources and Audio Listeners are what make 3d sounds in Unity.

From the Unity Documentation on Audio Listeners:

The Audio Listener acts as a microphone-like device. It receives input from any given Audio Source in the scene and plays sounds through the computer speakers. For most applications it makes the most sense to attach the listener to the Main Camera. If an audio listener is within the boundaries of a Reverb Zone reverberation is applied to all audible sounds in the scene. Furthermore, Audio Effects can be applied to the listener and it will be applied to all audible sounds in the scene.

From the documentation on Audio Sources:

The Audio Source plays back an Audio Clip in the scene. The clip can be played to an audio listener or through an audio mixer. The audio source can play any type of Audio Clip and can be configured to play these as 2D, 3D, or as a mixture (SpatialBlend). The audio can be spread out between speakers (stereo to 7.1) (Spread) and morphed between 3D and 2D (SpatialBlend). This can be controlled over distance with falloff curves.

You can only hear the sound when you are close because the Rolloff says the volume should go to 0 after the Audio Listener is 4 units away. You can tell by looking at the graph under Rolloff.

Upvotes: 1

Related Questions