3D Sound Removing the Doppler Effect

Hello!
I’m currently creating a project that involves a 3D environment that the player is able to walk around explore, with music that changes as they traverse around the environment.
So far I have been adding layers of music as Audio Source components in various 3D objects in the space, things like rocks, lanterns etc. I need to remove the Doppler effect as I’m using music rather than sound effects the music raises or lowers in pitch as the player moves about, something that I don’t want!
So far I’ve been removing the Doppler effect by lowering the level down to 0 this has worked really well. Unfortunately the latest piece of music/audio file seems to still have a Doppler effect, even after lowering the level down. Any idea why this is? Any way I can combat this? Is there a better, more efficient way of creating a dynamic, 3D soundscape?

Thanks in advance!

I believe that the Doppler effect can be simulated in Unity, but I don’t think it is there by default.

Is it definitely still varying the pitch with Doppler on 0, or could it be just the panning? I’d try putting panning on 0 as well, if it’s not important to your 3D positioning of the music.

Hello…

if i am getting you right,then you want to get the continuous sound with the same volume whatever will be the sound.
then you just need to place your audio sources need to your audio listener also disable your 3d sound effect for you audio clips…

hope it will help you…

Thanks
Niki.j

it seems that the pitch is going up when moving forward/closer to the audio source and down when moving back/away from the audio source. i’ve noticed that if i put panning at 0, the audio will almost become 2D constantly loud (or ‘on’) rather than be positioned in a 3D space.

the opposite in fact, i need things to become louder when you approach them quieter when you walk away from them. think of a standard sound effect, like the crackling of a fire, but using music instead. each track (bass, lead melody etc.) of the music needs to be positioned in the 3D space, getting louder when you approach and quieter when you back away.
thanks for the help though! :slight_smile:

Cant you just use a 2d sound and change its volume based on the distance between the camera and the audio source?

probably! haha, is that scripting? forgive my naivety but i’m a musician first and a programmer second (if not third, fourth or fifth! :stuck_out_tongue: ).

example on its way! :stuck_out_tongue:

using UnityEngine;
using System.Collections;

public class VolumeInterpolate : MonoBehaviour {
	
	public Transform player = null;
	public float maxDistance = 0f;
	
	private AudioSource _aSource = null;
	private Transform _myTr = null;

	void Start () {
		_myTr = transform;
		_aSource = (AudioSource)GetComponent<AudioSource>();
		_aSource.volume = 0f;
	}
	
	// Update is called once per frame
	void Update (){
		float distance = Vector3.Distance(_myTr.position, player.position);
		if(distance <= maxDistance)
		{
			_aSource.volume = Mathf.Abs((distance / maxDistance) - 1f);
		}
	}
}

You need to attach this to your AudioSources and change them to 2D in your import settings.

hi,
I want to remove unwanted noise from output audio .So please help me out?

1 Like

guys this is utterly wrong

TO REMOVE THE STUPID DOPPLER EFFECT, JUST SET TO ZERO

it’s that simple.

do NOT use a script to affect the volume with distance!!! that’s what audio source does for you!

just select “3D sound” and it will do that. BUT be sure to set Doppler effect to zero.

(you only use doppler effect in very unusual situations … just forget about it)

1 Like