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
8
Question by invicticide · Mar 26, 2011 at 10:33 PM · audiooptimizationaudiosourceaudioclip

What are some ways to prevent audio flanging and phase cancellation when using a lot of voices?

I'm working on a game which plays a large number of short, one-shot sound effects in very rapid succession: weapons fire, weapon impacts, unit deaths, building destruction, and so on. Part of the point of the game is that the amount of onscreen chaos can grow to absurd levels. As that happens, the number of active sounds skyrockets. This presents a few problems:

  • Audio overload and unusually loud sounds due to like sounds stacking within the same frame
  • Audio flanging due to like sounds playing almost, but not quite, in time with each other
  • Phase cancellation due to like sounds playing almost exactly out of phase with each other

My question is: what are some ways to address these issues? I'm having a hard time finding discussion of techniques for these things.

So far, I've implemented a custom AudioMixer class which allocates a fixed-size pool of AudioSources for each unique AudioClip, and cycles through that pool as requests for that sound come in. There's also a voice-limiting mechanism on that pool which prevents a given sound from being triggered more than once every N seconds. This effectively addressed the "audio overload" issue by preventing like sounds stacking in a single frame. The flanging and phase cancellation issues seem rather trickier.

Has anyone dealt with this sort of thing before? Any ideas or suggestions?

Comment
Add comment
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

2 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by Nicolaj Schweitz · Mar 30, 2011 at 08:38 PM

I don't think there is one good answer to this problem, but please, everyone, share your ideas!

Let's take it on the forum: http://forum.unity3d.com/threads/83830-Audio-mixing-in-Unity?p=538319#post538319

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 Kilometers · Sep 23, 2011 at 07:21 AM

Simple. Let's say I have Sound A. Using the high precision system timer I can track the last time Sound A was played. I figure out a minimum amount of milliseconds that prevents most phase issues (let's say 60 ms), then I add an if statement determining whether or not 60 ms have elapsed. If so, allow the sound to play again if needed.

You can also add effects to simulate the clutter and chaos, without the phasing. Let's say Unity3d tries to play 5 instances of Sound A within 50 milliseconds of one another. Instead of just cancelling all but one of them, you could add a distortion filter that reacts to how many Sound A's are trying to be played.

Also, I do not remember if Unity3d has a pitch filter, but if so you could use the filter to randomly (and slightly) stretch and squish Sound A, further reducing phase issues.

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

1 Person is following this question.

avatar image

Related Questions

How to record audio in chunks and send through websocket? 0 Answers

[Rhytm game] How to spawn on exact time of music? 3 Answers

One sound gets quieter when other is played? 1 Answer

Check scilence in audio clip using FFT. 0 Answers

Ambisonic Audio Support for PS4 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