Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Audio 3D audio hitches when teleporting

Discussion in 'Audio & Video' started by willqp, Jul 3, 2019.

  1. willqp

    willqp

    Joined:
    Dec 3, 2010
    Posts:
    12
    I'm working on a VR app that is using 3D audio. When the player teleports you can hear a blip in the audio. If you do it several times you can see the audio getting out of sync with the video. It doesn't happen with 2D audio or if the player moves smoothly to the new position, so it seems like the problem happens when the audio listener move delta is too big on one single frame. Are there some settings that could fix this? Is this a bug?
     
  2. nanaoftheyaw

    nanaoftheyaw

    Joined:
    Oct 28, 2014
    Posts:
    2
    I found the culprit. The Doppler effect. It doesn't update at the same time as the volume. Setting it to zero fixed it but that also means that the audio doesn't sound as realistic. Probably going to have to manually reintroduce the doppler effect to avoid that hitching like sound.
     
  3. sebastianzander

    sebastianzander

    Joined:
    Mar 22, 2018
    Posts:
    37
    I have the exact same problem. I use a floating origin in my game. Visually I have everything under control, meaning lagging cameras (I use Cinemachine) update immediately whenever the floating origin gets translated but I don't have a working solution for the mentioned audio hitches. I can differentiate the audio hitches into a Doppler effect and a volume component.

    I tried setting AudioSource.dopplerLevel = 0 just before the origin gets translated and reset it to its previous value right after the origin was translated. I can clearly hear that the Doppler effect due to the rapid change in translation and consequently interpreted high velocity is impeded. However, the volume dropout remains. For me, AudioListener seems to be the culprit, specifically. Although I translate the main camera (with the AudioListener attached) as well, the volume dropout unfortunately remains.

    Changing either AudioSource.spatialBlend or AudioSource.maxDistance for one or two frames around the translation doesn't convince me to be a nice solution, as then the volume would increase for a short time.
     
  4. FlightOfOne

    FlightOfOne

    Joined:
    Aug 1, 2014
    Posts:
    659
    Hi, did you ever figure this out?
     
  5. sebastianzander

    sebastianzander

    Joined:
    Mar 22, 2018
    Posts:
    37
    Hi FlightOfOne. No, unfortunately I did not.
     
  6. bluescrn

    bluescrn

    Joined:
    Feb 25, 2013
    Posts:
    628
    Another year on, has anybody got any solutions for this?

    Seems like we need an equivalent of Cinemachine's 'OnTargetObjectWarped' for audio sources/listeners, or a way to manually set their velocity.

    When does Unity even perform it's audio updates, particularly anything dealing with positions of sources/listeners? - it's not mentioned in the 'order of execution' docs. Is it guaranteed to happen between updates?

    If both an audio source and audio listener jump by the same distance in a frame, where does the doppler glitch actually come from, as the relative velocity between them should be unchanged?
     
    Last edited: Jun 6, 2023