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 DavidJinnai · Feb 07, 2014 at 04:34 PM · microphonemic

Can't get multiple microphone inputs simultaneously

I'm trying to get two microphone volumes at once in unity. Unity supports microphone by this Microphones class (https://docs.unity3d.com/Documentation/ScriptReference/Microphone.html), but seems this class can only handle one Microphone at same time.

This is how my code looks. I'm running like this in two different scripts attached to two different objects. However, only the microphone initialized second will run and the first one will die when the second one starts.

How can I get multiple microphone inputs simultaneously? If there are no way to do in standard library, is there any useful plugins?

Thank you :)

     void Start ()
     {
 
         deviceName = Microphone.devices[0];
         audio = this.gameObject.AddComponent<AudioSource>();
         audio.clip = 
             Microphone.Start(deviceName, true, 999, 44100);
         audio.loop = true;
         audio.mute = true;
         while (!(Microphone.GetPosition(deviceName) > 0))
         {
         }
         volumes = new float[LAppDefine.MIC_FRAME_NUM];
         audio.Play();
     }
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 foyleman · Nov 20, 2014 at 08:17 PM 0
Share

I need this functionality too. I'm trying to cycle the mics, but thats causing me to lose audio. How can I capture multiple audio devices (mics) at once.

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by MarkD · Jul 04, 2016 at 07:39 PM

It is pretty easy. You already have the script for 1 microphone. Simply create a second game object and place the script on there.

Instead of typing the number 0, you can create an int variable, this way you can set the device to listen to in the inspector.

Alternatively you could use an enum to have words showing the microphone's name and their position will automatically match their number on your system (thus the one you need between the [ ].

That is how I do it in my script MicControl2.

Comment
Add comment · Show 2 · 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 MarkD · Oct 22, 2016 at 10:12 PM 0
Share

Also, don't forget that osX (if you are on a mac), only allows one microphone connection at a time.

Here is a link on how to use two microphones in gareband, I do not know how usefull it is towars Unity. http://www.macworld.com/article/2089460/a-tale-of-two-microphones.html

avatar image UnetDev · Nov 10, 2018 at 02:13 AM 0
Share

$$anonymous$$icrophone.Start is a static function call, so if you call it in another script, it will block the first call.

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

21 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 avatar image

Related Questions

Unity Microphone Auto start recording and auto stop recording 0 Answers

microphone.devices can be detected but is empty 2 Answers

No Microphone Device 2 Answers

Get the device audio volume 0 Answers

how to check if the user speak to microphone? 2 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