Symptoms
- I am developing a game on Android and I get a lot of sound delay when I play an AudioClip.
Cause
You have made a game for Android. When you are playing AudioClips in real-time there is an unacceptable amount of latency in the response you hear back.
Resolution
Typically, the audio-in latency needs to be below 25ms to be useable.
On iOS, audio-in latency is around 20ms, which is perfect for recording software or producing real-time effects. On Android, however, the latency is around 200-300ms, which causes a noticeable delay in the sound you hear in real-time.
A workaround you can try to fix this issue within Unity is change the DSP Buffer Size to set your audio to Best Latency in the Audio Manager:
- In the Unity Editor click Edit
- Click Project Settings
- Select Audio. You will see the DSP Buffer Size in the list of options within the Audio Manager in your Inspector view; Default, Best latency, Good latency, Best Performance.
- Select Best latency to see if this improves your audio response in real time.
More Information
There are various plugins on the Asset Store that may help with the sound quality within your project.
Comments
4 comments
If "Best Latency" setting (small buffer size) is still not enough for you going native is definitely the way to go. "Native Audio" asset store plugins can make a native call to both iOS and Android's fastest native way from one central interface. https://assetstore.unity.com/packages/tools/audio/native-audio-107067
- On iOS it uses OpenAL. It is faster than AVAudioPlayer.
- On Android it uses AudioTrack, which was confirmed to be faster than SoundPool and no difference from OpneSL ES.
I don't understand. Unity is a game engine and as such is supposed to support audio isn't it? A game cannot work with a quarter of a second delay on it. I've never had this problem before and yet I am seeing really obvious delays in audio on an Android device (LG G6). The "best latency" setting made no difference. This is a bug that hasn't been resolved (am using 2018.2.10f1).
when audio set on rate button open the url and then play a audio ?????
which solution??
Writing this post is like saying water wets
Please sign in to leave a comment.