3D audio >> 2D audio.

Hey.

Im implenting a whole level, with about 200 sources of audio for the ambience.
They fade properly between each other, but I am still a bit annoyed with the 3D effects that the engine puts on the sounds in the beginning of the rolloff area of the sound.

meaning, that the sound is really low, as it should be, but it’s really obvious that it’s coming from a certain direction.

I have tried turning down the pan setting all the way to 0, but that makes the sound also ignore the distance to the source, which it shouldn’t.
I am just trying to avoid panning at all, i just want my 3D sound as a location only to respond to volume over distance to source.

Like having a 2D sound which with a curve can be adjusted in volume depending on the distance to the source.
is this possible?

it can work with 3D sounds, but it requires to have more sources and closer spaced than with the other method, but this requires hours of tweaking just to make 10 sources around each other, and avoid phasing and other regular problems.

So you want 2D sounds that get louder the closer you get?
Just write a script that controls volume based on distance instead of using a 3D sound.

of course… that would be a solution.
but i don’t get why i can turn the pan option up and down, if all it does is remove the changes drawn in the curves?

like. turning pan to 0. just makes this a regular 2D sound?
Pan would make more sence just to adjust the panning of the sound in the 3D world. - but not the attenuation, which is controls.

pan adjusts what ear it comes from nothing more, nothing less. a pan of 0 is equally in both ears.

yea, but a pan of 0, also ignores distance to object. = max volume.

You can use SpatialBlend (2D => 3D) this way, closer - mean more 2D, far - more 3D.

This gives you effect ‘2D AudioSource affect by min and max Distance, and still can change volume’

using UnityEngine;

public class spatialFader : MonoBehaviour
{
    private Transform Listener;
    private AudioSource source;
 
    private float sqrMinDist;
    private float sqrMaxDist;
 
    void Start()
    {
        Listener = FindObjectOfType<AudioListener>();
        source = GetComponent<AudioSource>();
        if (!source) return;
     
        sqrMinDist = source.minDistance * source.minDistance;
        sqrMaxDist = source.maxDistance * source.maxDistance;
    }

    void Update()
    {
        if (!source || Listener) return;
        var t = (transform.position - Listener.position);
        t = (t*t  - sqrMinDist) / (sqrMaxDist - sqrMinDist);
        source.spatialBlend = Mathf.Lerp(10f,22000f,t);
    } 
}