Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by TykoX64 · Dec 09, 2014 at 06:11 PM · audioaudiosourcelagdsp

AudioSource.Play lags.

I'm working on an Android app where audio needs to be played when the user touches the screen. The problem is that there is a slight delay between the touch and the actual audio starting even though play is called in the same frame that the touch is registered. the delay seems to be anywhere from 2-7 frames worth and it's not a consistent delay. I've tried changing the DSP buffer size down to 512x2 which is the lowest I can go without distorting the audio. Also using decompressed audio files doesn't seem to help. there are a lot of audio files so keeping them compressed is ideal.

Has anyone else had this issue and what workarounds or fixes could be implemented?

:edit: I have tested other non unity android apps on the same device that have less lag.

Comment
Add comment · Show 1
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Zach28 · Jun 19, 2016 at 06:04 AM 0
Share

Have you solved the problem? Been trying to fix this for days and now i'm stock. Because of this, i cant make improvements on my first game T_T please reply

2 Replies

· Add your reply
  • Sort: 
avatar image
1

Answer by zakirshikhli · Dec 29, 2019 at 04:34 PM

I fixed music lag issue by swtiching this setting: Player Settings -> Project Settings -> Audio -> DSP Buffer Size -> choose Best Performance. When I selected "best latency", lag becomes even worst. (My device is Redmi 7A on Miui 11 Global). Leave other Audio settings as is (reset to default)


I also selected "decompress on load" + "preload audio data" for bg music files.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
0

Answer by tanoshimi · Dec 09, 2014 at 06:34 PM

Audio lag on Android is a known issue, and one that varies in severity from device to device (see here for an article from Google I/O presentation on the subject, and if you search here on UA you'll find several posts on the topic).

MP3s certainly always feature a decompression lag, so you'll want to keep your clips as uncompressed WAV. Are you playing the audio using PlayOneShot? That's also inefficient - you should probably have a pool of instantiated AudioSources and just load in the appropriate clip.

You already mention you've reduced the buffer size. Other than that, I'm not sure there is a concrete solution :(

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image TykoX64 · Dec 09, 2014 at 06:50 PM 0
Share

Thanks for the quick response.

I have AudioSources on several object that play the sounds and they are preloaded with the audio clips they need in the editor. I'm not using play one shot nor loading the clips dynamically anywhere. I'm aware that android has issues but for some reason other (non unity) apps have a much smaller delay that what my app is experiencing on the same device.

I will try decompressing the files and see if that has some relevant change on the delay with the updates I've been making, unfortunately this makes the AP$$anonymous$$ size on the "too big" side.

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

28 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Passing audio information from unity to third-party 0 Answers

AudioClip huge lag on some android devices 0 Answers

Audio from Video starts stuttering + video playback lag after a few minutes 0 Answers

Playing each channel of a midi track on separate audio sources? 0 Answers

[NoBraves] Sound makes lag 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges