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 Unit-E · Jan 13, 2014 at 09:20 PM · audiosyncdistortiondsp

All game audio distorts and desyncs after a few hours

We're making an arcade music game and are experiencing the following issue: when the game has been running for a few hours, it will eventually sound like a speaker blew out (heavy distortion that sounds like clipping) and the timing will be off. I can't tell if it happens all at once or gradually, since this happens over a period of 5+ hours. Our game timing is synced to audio samples.

Calling AudioSettings.SetDSPBufferSize with any buffer length or number of buffers causes the distortion to happen immediately in Linux (though timing appears to remain fine), but not in Windows. AudioSettings.GetDSPBufferSize reports that the game is using a buffer length of 1024 and size of 4. The Unity Editor's audio settings have the same report and same effects if set to "Let Unity manage my audio settings" and on "Best performance." "Best latency" and "Good latency" are untested, but would probably make this problem happen more frequently.

We're working on a fix for this ourselves, but I figured I'd see if the community here has an idea of what's going on so we can get this fixed more quickly.

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 Unit-E · Jan 14, 2014 at 10:57 PM 0
Share

Update: this only seems to happen in the Linux standalone build, and looks like it could be caused by memory leaks.

1 Reply

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

Answer by Unit-E · Jan 18, 2014 at 09:38 PM

I resolved this issue in part and thought I'd share how. There are actually 3 bugs involved:

AudioSettings.SetDSPBufferSize resets the AudioListener volume to maximum when called, regardless of what the AudioListener volume is set to. We had tried to call the buffersize before every game, but the volume would get so loud that it would clip, which made us think it was the distortion effect (the distortion effect is actually different, but sounds similar to clipping).

The audio distorting and going off-sync after a long period of time is likely due to floating-point errors since it happens at around the 7-hour mark. This only happens in the Linux standalone. Calling a SetDSPBufferSize periodically resets the sound system, which prevents this from happening. The distortions to the waveform are regular and happen every 1024 samples, as pictured: alt text

Finally, the Linux standalone simply seems to have a memory leak related to garbage collection. Even with the audio fix, the memory usage in a 2GB system inflates from 14% at boot to 52% in a 12-hour period. The Unity team indicated in their response to me that this is a known issue, but it's worth mentioning here.


audiodistortion.jpg (88.2 kB)
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

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

19 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

Related Questions

I need a way to run code much more frequently than update. Ideally, every 3 milliseconds 2 Answers

What's wrong with this? (audio.timeSamples) 1 Answer

Syncing FPS Firing Sound over network via RPC {PHOTON} 1 Answer

Audio sync with explosions 1 Answer

Tracker modules: can they send out messages? 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