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
2
Question by oliver-jones · Feb 15, 2014 at 06:38 PM · iosaudiolagdelaylatency

iOS - Audio Lag?

Hello,

I have an audio file thats played through my AudioSource every time the user taps on the screen. I've noticed that there is a slight lag between me touching the screen, and the audio playing, about 0.2 second of a lag. It doesn't seem like much, but when you're playing the game - it can be very off putting.

What I've done:

  • Made sure the audio actually starts playing at the very start of my audio clip

  • Made it into a WAV (I read they're better for iOS)

  • Decompress the audio on load

  • Made it a 2D audio (its supposed to be 2D anyway)

Yet there is still a delay, why is this? Its only a small file (144KB) Thanks

Comment
Add comment · Show 2
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 POLYGAMe · Feb 16, 2014 at 08:06 PM 0
Share

This probably isn't worth mentioning, but it does catch people out... does the actual audio file have any empty space at the top? Or does the sound start exactly at the beginning of the file?

avatar image oliver-jones · Feb 16, 2014 at 08:09 PM 0
Share

Thanks for the response, I did mention that I did that. But no - that isn't the issue unfortunately. Still working around.

1 Reply

· Add your reply
  • Sort: 
avatar image
2
Best Answer

Answer by MakeCodeNow · Feb 15, 2014 at 06:41 PM

There's a bit of lag inherent to the touch event and your framerate, but I bet the problem is that want a smaller Audio DSP Buffer. Bigger buffers will stutter less, but have higher latency. Try something smaller for you. Once you do that, you can probably even use compressed audio and be fine.

Comment
Add comment · Show 4 · 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 oliver-jones · Feb 15, 2014 at 11:51 PM 0
Share

Okay - so how would one apply a smaller buffer, do I literally just do 'AudioSettings.SetDSPBufferSize()' in my code somewhere? What would be the recommended 'bufferLength' and 'numBuffers'?

Thanks

avatar image MakeCodeNow · Feb 16, 2014 at 07:39 PM 0
Share

Yeah, you just call SetDSPBufferSize. What I would reccommend is that you star with the default values returned by GetDSPBufferSize, and then chop them down until you get something that works. Just be sure to test on a range of devices!

avatar image MakeCodeNow · Feb 19, 2014 at 07:46 AM 0
Share

PS - please mark this answer as accepted :)

avatar image oliver-jones · Feb 19, 2014 at 09:17 AM 0
Share

Under project settings > audio, you can also change the buffer size within that by default. That seemed to do the trick. Thanks :)

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

20 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

Related Questions

Rhythm game input latency issue 0 Answers

Android audio lag solutions 1 Answer

!RIDICULOUS! Audio Latency - Android 3 Answers

Audio Lag Between Multiple Listeners 0 Answers

iOS : Delayed response to touch began? 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