Search Unity

Feedback Audio latency on Android

Discussion in 'Android' started by vallis_unity, Jul 18, 2023.

  1. vallis_unity

    vallis_unity

    Joined:
    Apr 14, 2022
    Posts:
    73
    Audio latency on Android seems to be a well known issue (see: https://forum.unity.com/threads/need-a-fix-for-audio-lag-android.267620/, https://forum.unity.com/threads/need-a-fix-for-audio-lag-android.267620/, https://stackoverflow.com/questions/24585027/unity3d-audio-latency-in-android, etc.)

    I am seeing ~300ms of delay on an S21 Ultra. No changes to any of the audio or asset settings make any difference at all. Rewriting the audio system to use native audio (via https://assetstore.unity.com/packages/tools/audio/android-native-audio-35295) resolves the problem and exhibits completely reasonable audio latency.

    It seems fair to say that 300ms of audio latency cannot be considered usable for most real-time applications. Is there any intention to fix this within Unity? Is there any explanation as to why the built in audio system is so bad compared to native plugins? Are there any work arounds in 2023 which don't require writing two separate audio systems for a multiplatform game?
     
  2. Tomas1856

    Tomas1856

    Unity Technologies

    Joined:
    Sep 21, 2012
    Posts:
    3,905
    Please submit a bug report with repro project attached, I don't think there are known bugs to issue you're describing above.
     
    vallis_unity likes this.
  3. vallis_unity

    vallis_unity

    Joined:
    Apr 14, 2022
    Posts:
    73
    I have submitted a bug report and created a repro project: https://unity3d.atlassian.net/servicedesk/customer/portal/2/IN-48324

    Attached is a video of the issue. The four buttons in the app do the following:

    1) Static - uses a static Audio Source component with a static clip and calls .Play() when clicked.
    2) One Shot - uses .PlayOneShot() and specifies the same clip as above.
    3) Dynamic - spawns a new Audio Source and plays it when clicked, cleaning up sounds when they finish playing in Update()
    4) Native - uses the AndroidNativeAudio plugin to play sound.

    It's pretty clear in the video how much latency there is with the first three buttons.
     

    Attached Files:

    Tomas1856 likes this.
  4. vallis_unity

    vallis_unity

    Joined:
    Apr 14, 2022
    Posts:
    73
  5. vallis_unity

    vallis_unity

    Joined:
    Apr 14, 2022
    Posts:
    73
    Hi @Tomas1856, sorry to bump an old thread but I was just wondering if you might have any insight into the status of this? From the issue in the tracker I linked above, this seems to impact iOS and Android. For most real-time scenarios I imagine 500ms audio lag is basically a show stopping issue. Is this something which is just accepted in 2023 while it's in beta and I can be confident it'll be resolved before LTS, or is there some way of working around this that I'm missing? Many thanks!
     
  6. John-Greenstone

    John-Greenstone

    Joined:
    Nov 10, 2015
    Posts:
    8
    BUMP BUMP BUMP!
    Meta Quest development is imposible on 2023 because of this issue.
     
  7. JakeHobbs

    JakeHobbs

    Joined:
    Mar 29, 2020
    Posts:
    9
    BUMP for me too!

    Unity 2021 LTS has a frustrating framepacing issue with URP which I've discovered is fixed in 2023... But the audio latency is awful! This desperately needs fixing - there seems to be no reliable version of Unity that is currently good for Quest 2 development..!
     
    QuadrantGames likes this.
  8. Tomas1856

    Tomas1856

    Unity Technologies

    Joined:
    Sep 21, 2012
    Posts:
    3,905
    Poked Audio team internally.
     
  9. StupidPlusPlus

    StupidPlusPlus

    Joined:
    Oct 4, 2017
    Posts:
    4
    BIG BUMP!

    Recently started testing on newer Android devices and I'm experiencing upward of 400ms latency. I cannot publish on Android devices until this issue is resolved or I implement a solution myself. This has seriously stagnated my progress.
     
    QuadrantGames likes this.
  10. michaelberg

    michaelberg

    Unity Technologies

    Joined:
    Jan 11, 2017
    Posts:
    21
    This latency issue is with our fairly new Android AAudio driver, which first appeared in Unity 2023.x, so it shouldn't affect earlier versions of Unity. We do have a fix internally that we're just now starting to test.

    Thanks for reporting this! Unfortunately, I don't have any good immediate work-arounds for this other than just using an earlier release of Unity or waiting for the fix to be released. Sorry for the inconvenience.
     
    StupidPlusPlus and vallis_unity like this.
  11. vallis_unity

    vallis_unity

    Joined:
    Apr 14, 2022
    Posts:
    73
    Appreciate the update, thank you. Happy to know a fix is in the pipeline. Do you have any idea what the timeline might look like for this fix arriving in 2023.2?
     
  12. JakeHobbs

    JakeHobbs

    Joined:
    Mar 29, 2020
    Posts:
    9
    For anyone else having this dilemma - try moving to 2022.3.9f1 for now - both the audio issue and performance issues seem to be absent from this version at least.
     
  13. QuadrantGames

    QuadrantGames

    Joined:
    Jan 10, 2016
    Posts:
    20
    Unity 2021 and 2022 both have native lib errors for specific android devices on android 13, Unity 2023 fixes these issues, but now has this audio latency issue. I am stuck.

    I have tried the latest alpha version of 2023 and audio is still broken, any chance a fix will be pushed anytime soon?
     
  14. wtetotew

    wtetotew

    Joined:
    Apr 12, 2020
    Posts:
    68
    I'm using Unity 2019 and the latency is here and very noticeable.
    Is it better on newer versions?
     
  15. Ra1dN

    Ra1dN

    Joined:
    Dec 20, 2018
    Posts:
    1
    BUMP! :)
    Currently our app will not be released on android because of this issue. Any news from the audio team?
     
  16. Chizunah

    Chizunah

    Joined:
    Jul 11, 2021
    Posts:
    1
    Same issue here ! I had to update Unity to version 2023.1.18f1 to fix a bug but now I have huge sound latency on android phones ... :(
    Is there anything we can do but wait for a fix ?
    Can you tell us when a fix will be released ?
     
  17. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    11,749
    I mean this latency is the result of them trying to fix the audio latency Unity has had since 2014, so the lessons here are: a. don’t hold your breath, b. lower your expectations about what a fix will do for you.
     
    dacarrera likes this.
  18. vallis_unity

    vallis_unity

    Joined:
    Apr 14, 2022
    Posts:
    73
  19. MerhatPandzharov

    MerhatPandzharov

    Joined:
    Aug 29, 2015
    Posts:
    83
    When will this get fixed?
     
  20. damien-max

    damien-max

    Joined:
    Dec 19, 2017
    Posts:
    1
    Bump here, every audio in my app has a latency of ~500ms. I had no issues in 2022.3.6f1 and just moved to 2023.2.4f1. Reverting to 2022 with no other things done instantly fixed the issue. Won't be upgrading for now!
     
  21. jakob-leitner

    jakob-leitner

    Joined:
    Nov 11, 2020
    Posts:
    18
  22. vallis_unity

    vallis_unity

    Joined:
    Apr 14, 2022
    Posts:
    73
  23. AGeens

    AGeens

    Joined:
    Feb 1, 2022
    Posts:
    6
    I had this audio delay issue as well when creating quest builds using Unity 2023.2.0b16 and as stated in the bug report I can confirm that after updating to Unity 2023.3.0b4 the issue is fixed!