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 Tocaro · Jan 04, 2012 at 04:34 AM · audioclipmicrophone3.5

Microphone in 3.5 beta

Essentially I want to move an object based on the volume of the players voice (or failing that, simply move an object when the speaker is making noise) but I'm looking through the documentation on 'Microphone' and it's not great:

 // Start recording with built-in Microphone and play the recorded audio right away
 
 function Start() {
 audio.clip = Microphone.startRecord("Built-in Microphone", true, 10);
 audio.Play();
 }

The above code is from the unity script reference for Microphone.Start and it's got a few problems. First, it's Microphone.Start not Microphone.startRecord and second it's suppose to have four arguments in it (string,boolean,int,int), not just three.

In short, the sample code doesn't work so I'm having trouble working from it.

So to reiterate, I want to be able to move an object based on the volume of the sound input in the microphone.

So is anyone having any luck with dealing with Microphone input in the 3.5 beta and if so could you please help start me off on coding this?

I tried fixing the example code but I'm not sure what to put in for the frequency, although anything above 0 works it doesn't seem to be doing anything (yes I have an audio source component on the scripted object and the camera/audio listener is close enough to hear things):

 audio.clip = Microphone.Start(null, true, 10,??);
 audio.Play();

Anyway, recording the audio is just half the problem, I need to analyze it on the fly, presumably using AudioClip.GetData in some fashion (not quite sure how I'd get the data for the part of the array that's currently being recorded though, among other things).

Anyway, any help would be greatly appreciated.

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 Riro · Jan 16, 2012 at 12:10 AM 0
Share

Bump. I am also doing something very similar.

I do have some microphone functionality working via a Obj-C plugin I found here http://goo.gl/t2Y2r. However this inhibits my ability to test with unity remote somewhat, and I feel as though the projects code is beco$$anonymous$$g fragmented.

Can you point me to the docs for the unity microphone class? I can't find it anywhere in the unity support pages... I feel as though this should be easy to find, but I don't see it anywhere.

avatar image Tocaro · Jan 24, 2012 at 11:46 PM 0
Share

I'd love to point you to the microphone class, but I don't have the docs anymore, I uninstalled the 3.5 beta a few days ago and reinstalled the most recent non beta release. However if you are running the beta you should just be able to search for '$$anonymous$$icrophone.Start' or something akin.

1 Reply

· Add your reply
  • Sort: 
avatar image
2

Answer by Linda · Jan 18, 2012 at 10:44 PM

Hi, I had a similar problem but i was able to fix it, by expanding you first fixing:

 function OnGUI()
 {
   if (GUI.Button(Rect(10,10,60,50),"Record"))
   {    
     // null graift auf das standart microfon des jeweiligen users zu
     // soll nie Aufnahme geloopt werden (hier nciht -> false)
     // Aufnahme Zeit in Sekunden (hier momentan 3)
     // Aufnahme Fraquenz (hier 44100)
     audio.clip= Microphone.Start ( null, false, 3, 44100 ); 
   }
   if (GUI.Button(Rect(10,70,60,50),"Play"))
   {    
     //Aufnahme abspielen
     audio.Play();
   }
 }
Comment
Add comment · Show 3 · 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 Tocaro · Jan 24, 2012 at 11:47 PM 0
Share

Thanks Linda, I see you figured out my problem with the frequency. I can't check this though since I uninstalled the 3.5beta but if it worked for you I'll give it a up vote.

avatar image Riro · Jan 25, 2012 at 12:15 AM 0
Share

We have mic input (no external code, just unity and C#) up and running on this thread, should be easy to use it for movement. http://forum.unity3d.com/threads/118215-Blow-detection-(Using-iOS-$$anonymous$$icrophone)

avatar image fil · Nov 26, 2012 at 02:36 PM 0
Share

hi, it's possible to save it to a file?

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

9 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

quickest way to read & write audio files with mic input? audio buffer? 0 Answers

How to get current gain from microphone? 1 Answer

Is it possible to record using Microphone.start and have non-fixed Audio clip length? 1 Answer

Extract pointer from Audioclip's buffer 0 Answers

Microphone recording problems (double sample, audiosource stops working) 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