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 harrisonbergeron · Jun 11, 2012 at 05:53 AM · iosaudiofmod

How do I reduce the CPU load spike caused by playing an audio clip?

alt textI'm experiencing a considerable processor load spike when playing a short sound on iOS. I've tried compressed sounds, decompressed sounds, and just about anything else. The issue is that I load a sound into an audio source using myAudioSource.clip = nameOfClip; then I play it using myAudioSource.Play(); It rewards me with up to a 23ms time to process for AudioManager.Update. The issue is that it will cause the iPhone to lag out and FMOD seems to have a hard time recovering.

Eventually the iPhone will recover after 30 seconds or so. What is the best way to load in and play clips to avoid this huge processor spike?

I have 11 playing sources and 9 audio voices. At 11 playing sources and 8 audio voices, the processing time is only around 2ms.

Screen Shot 2012-06-10 at 4.23.39 PM.png (155.6 kB)
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 dannyskim · Jun 11, 2012 at 05:44 PM 1
Share

Have you set the audio clips to decompress on load? I know you said you tried decompressed sounds, but if you could use the exact verbiage from Unity it would help clarify what exactly you have tried.

avatar image harrisonbergeron · Jun 11, 2012 at 10:35 PM 0
Share

Yes, I'm using "decompress" on load. It's certainly better than "compressed in memory," but it's not good enough.

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by Kailric · Jul 13, 2016 at 05:02 PM

This thread is really old but it is the only one I found so far with this topic. I searched for this as I was having spikes when a clip would play. I have several unique voice overs for characters in the game but I only need two specific characters for each scene so I use "Resources.LoadAll (playerName);" to "load" the clips that will be used. However, I think what I have discovered that this does not actually load a clip in preparation to be played but rather just assigns it to an array spot. So then when I actually play the clip the audiosource has to actually load the clip as well. This was apparently causing my spikes.

To fix this I used a for loop and called LoadAudioData() on each clip to preload it. Starting the scene now takes a bit longer but it seems to have eliminated the sound lag spike. It would be nice if we could set the Load In Background property of Audio files in code, but it appears this isn't possible.

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

5 People are following this question.

avatar image avatar image avatar image avatar image avatar image

Related Questions

iOS/Android : Advanced sound management for Unity Free ? 0 Answers

Disable Unity audio/FMOD on iOS 0 Answers

Not getting any audio in my simple roll-a-ball unity/Fmod builds. 1 Answer

Read audio/music currently playing on speakers? 0 Answers

Unity 5.6 iOS GVR audio spatializer incompatible? 0 Answers


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