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 JoshuaT · May 25, 2012 at 09:33 AM · audiosoundchannel

Adaptive audio/Channel switching

Hi, I'm wanting to use a multi-channel audio files for a game in Unity. The file would contain multiple channels, which would be pairs of L/R combiniations of adaptive music. For example, channels 1 & 2 would be L/R track 1, channels 3 & 4 would be L/R track 2.

You can create these tracks in FMOD, and Unity uses FMOD for its audio, however, for the life of me, I can't find how to turn certain channels on and turn other channels off, to get the desired effect.

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

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by Andrew_Johnson · Jun 22, 2016 at 04:07 PM

I've done something similar with swapping between 2 channels, and this link was very helpful. To change the volume between 2 channels I used the code:

 for (var i = 0; i < data.Length; i = i + channels)
             {
                 data[i] = (float)(data[i] * vol);
                 data[i + 1] = (float)(data[i + 1] * (1-vol));
             }

"vol" is a public variable between 0 and 1 that you can set with a script. My guess for how it would work for 4 channels is:

 for (var i = 0; i < data.Length; i = i + 4)
             {
                 data[i] = (float)(data[i] * vol);
                 data[i + 1] = (float)(data[i + 1] * vol);
                 data[i + 2] = (float)(data[i + 2] * (1-vol));
                 data[i + 3] = (float)(data[i + 3] * (1-vol));
             }
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 Andrew_Johnson · Jun 22, 2016 at 03:16 PM 0
Share

I know it's 4 years late but I'm tired of finding questions I want to ask un-answered in my search results and at least the next person to come across this will find an answer.

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

Playing sounds to specific output channels 1 Answer

Calculating rhythm of any music? 3 Answers

How To Turn Off Sound For Certain Objects? 1 Answer

unity won't play sounds i implement 1 Answer

Audio not coming out of speakers 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