Search Unity

  1. Unity 2018.3 is now released.
    Dismiss Notice
  2. The Unity Pro & Visual Studio Professional Bundle gives you the tools you need to develop faster & collaborate more efficiently. Learn more.
    Dismiss Notice
  3. We've updated our Terms of Service. Please read our blog post from Unity CTO and Co-Founder Joachim Ante here
    Dismiss Notice
  4. Want to provide direct feedback to the Unity team? Join the Unity Advisory Panel.
    Dismiss Notice
  5. Improve your Unity skills with a certified instructor in a private, interactive classroom. Watch the overview now.
    Dismiss Notice

Audio A 3D Audio Question

Discussion in 'Audio & Video' started by D4N005H, Dec 26, 2018.

  1. D4N005H

    D4N005H

    Joined:
    Oct 12, 2013
    Posts:
    331
    Hello,

    Imagine we have cars in a scene. As the cars go far away, their sound will change. Here is a video that shows how it changes in real life:


    As you may notice from 00:49 to 01:05, there are some frequency changes. I'd like to do the same to the car sounds of my project. But I don't have any clue how to mimic this. Would be glad if someone could shed some light and help.


    Regards.
     
    Last edited: Dec 27, 2018
  2. D4N005H

    D4N005H

    Joined:
    Oct 12, 2013
    Posts:
    331
    Would be cool if anyone replied. Here is a sample video clip of my project. There are no Reverb zones and as it is noticeable, only the volume changes when the car moves.
     
  3. r618

    r618

    Joined:
    Jan 19, 2009
    Posts:
    700
    you can apply lowpass filter which will gradually lower the cutoff frequency as the car gets further away probably starting with 'max' frequency at distance 0, but you will have to tune in since the falloff won't be linear
     
  4. WashingMachine

    WashingMachine

    Unity Technologies

    Joined:
    Mar 23, 2017
    Posts:
    24
    Have you tried fiddling with the "Doppler" setting on the audio source?
     
  5. D4N005H

    D4N005H

    Joined:
    Oct 12, 2013
    Posts:
    331
    Thank you for your informative replies, Although I already played with the Doppler settings, I did it again. I increased the Doppler effect to 2.5, I then wrote a script to control the Low Pass Filter. I then coded another script to add reverb effects based on the distance of the car from the camera. And here is the result, watch and hear it!
    EDIT: I sure know this is not near perfect, but I've found the clues to simulate the audio effects.

    I amplified the sounds for better showing the new sound effect.
    UPDATE: There is no need to write a script for this case! I found that Unity already has an undocumented feature for this!! Here is how it works, you add a Reverb Zone to the scene and configure it in the way that the car sounds like the first video in the distance. Then you call this function for your AudioSource:
    Code (CSharp):
    1. audioSource.SetCustomCurve(AudioSourceCurveType.ReverbZoneMix, customCurve); //custmCurve is a set of animation keys that dictates Unity how to mix the sound with the Reverb Zone over the distance between the scene camera and the audioSource object. Pretty neat!!
     
    Last edited: Jan 14, 2019 at 8:51 AM