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. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

How to solve the audio delay issue on some specific devices?

Discussion in 'Audio & Video' started by cdytoby, May 29, 2015.

  1. cdytoby

    cdytoby

    Joined:
    Nov 19, 2014
    Posts:
    181
    In my game, I need to have shoot, hit, blast sound effect, and they are all less than 1 seconds. However, when the sound plays, it have lag on some specific devices.

    HTC One M8: 0.4s lag <br/>
    Samsung Galaxy S6: 0.4s lag <br/>
    Samsung Galaxy S3: 0.4s lag <br/>
    Samsung Galaxy Tab 3: no lag <br/>
    iPad Air: no lag<br/>

    Any idea how to solve the problem?

    I already tried the following:

    AudioSettings, best latency; <br/>
    All audio data are wav; <br/>
    All audio data are imported and compressed as PCM; <br/>
    All audio data are "decompress on load"; <br/>
    AudioSources bypass all the effects; <br/>
    There is a Android latency plugin, seems not working on new Unity, there is no sound at all; <br/>
    There is another audio plugin, which have the same problem.

    I have asked on the communities in different places, and not a single answer is posted.
     
  2. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,555
    I would like to know the answer as well. Android platforms always have this complaint.
     
  3. bennyboy

    bennyboy

    Joined:
    May 5, 2015
    Posts:
    13
    Do you have this problem only on the first fire of the sound, or always?
     
  4. bennyboy

    bennyboy

    Joined:
    May 5, 2015
    Posts:
    13
    Yeah, and not only in Unity. I've spent literally hours with Javascript trying to get web pages to line up sound events properly. The answer with webpages seems to be to "preplay" the sound for like 1/100 of a second before you start, just so Android initializes it.

    So far, my attempts to get sounds working on Android on the initial startup of Unity have failed, though. There's always about a 1/2 second lag the first time my starting music plays the first time.
     
  5. cdytoby

    cdytoby

    Joined:
    Nov 19, 2014
    Posts:
    181
    Always. No matter how many times I clicked, it's the same lag.
     
  6. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,555
    I forgot to mention something that may help. Make sure all your sound effects are wav files, not mp3's. "Starting to play" an mp3 takes about 120 times longer on average.
     
  7. cdytoby

    cdytoby

    Joined:
    Nov 19, 2014
    Posts:
    181
    All the audio datas are wav file, not mp3 vorbis or other compressed data.
     
    Z0leee87 likes this.
  8. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,555
    Ok. I haven't seen this problem on our Android games for some reason.