Search Unity

Audio [SOLVED] Doppler effect issues

Discussion in 'Audio & Video' started by BubbleheadStudios, Oct 18, 2019.

  1. BubbleheadStudios

    BubbleheadStudios

    Joined:
    Oct 28, 2017
    Posts:
    6
    Hi everyone,

    I'm making a racing game and needing to use the doppler effect on AI engines to simulate high speed (and it just sounds cool!) but I'm getting some weird choppy artefacts that seem to get worse the longer the game runs. I've tried various audio compression, file types, audio load-in (streaming etc). I've tried putting the audio source on a rigidbody, even tried manipulating the AudioVelocityUpdateMode to see if anything changes.
    The vehicles are moving at relatively high speeds but when you do hear the doppler (and ignore artefacts) it has quite a 'believable' sound.

    Unfortunately I feel that the doppler effect is integral to the sound design of the game so I'm trying to persevere!

    Anyone have any ideas or a work around? Would it be worth me getting invested in FMOD to see if they have a better doppler set up?

    I'm using Unity 2018.2.18f1.

    dopplerEffect.jpg

    Thanks in advance :)
     
  2. BubbleheadStudios

    BubbleheadStudios

    Joined:
    Oct 28, 2017
    Posts:
    6
    Found the issue:

    I'm using Cinemachine for camera handling and had the Audio Listener on the Main Camera. I should have had the Audio Listener on the Cinemachine Virtual Camera instead. I'm using FMOD now too, and it works a treat.

    My understanding is that when Cinemachine works, it kinda moves around the Main Camera to align with whatever virtual camera you have active, causing all kinds of weird audio artefacts - if your audio listener is on the Main Camera object.

    Hope this helps!
     
    derkoi, DChap and VeryBadPenny like this.
  3. DChap

    DChap

    Joined:
    Dec 24, 2016
    Posts:
    23
    Hey thanks for the info! This issue has been bugging the hell out of me.

    Question:
    If you put the Audio Listener on your Virtual Cams (assuming you have more than one) how do you deal with the problem of having more than one Audio Listener in the scene? I have a cutscene where I'm cutting back and forth between different cameras and will often get some quick static/ distortion when the camera cuts. Took me a while to figure out the doppler effect was causing it.
     
  4. BubbleheadStudios

    BubbleheadStudios

    Joined:
    Oct 28, 2017
    Posts:
    6
    Hi DChap,

    What I would probably try is to create a script that has an array of all Audio Listeners in your scene, then when you flip cameras, flip Audio Listeners too, i.e just turn them off the same time you switch your Virtual Camera - and turn on the one you need on the active VCam. That should fix your problem!
     
    DChap likes this.
  5. chadfranklin47

    chadfranklin47

    Joined:
    Aug 11, 2015
    Posts:
    229
    This becomes a bit more involved when you have a blend between 2 virtual cameras.