Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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
1
Question by Amiad · Jun 29, 2011 at 06:39 AM · audiomicrophonemic

how to check if the user speak to microphone?

I want to check if the user speak to microphone (in c#). I searched easy way to do it and not found. I tried some libraries of audio but its not matched.

I need that the code will like:

 if (user speak) speak=true;
 else speak=false;

Is have easy way to do it?

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 ina · Jun 29, 2011 at 08:33 AM 0
Share

I vote unity 4 has a universal mic input namespace.

2 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by CHPedersen · Jun 29, 2011 at 06:51 AM

This is a tough one, I'm afraid. As far as I know, there is no easy way to detect when the user speaks. There is no functionality in Unity for recording audio from a microphone, though plug-ins do exist if you have Unity Pro.

Even then, recording audio is just half the fun. You'd also need to figure out how to detect speech in the audio. If your app is used in quiet environments, I suppose you could simply trigger it when the recorded audio reaches above some threshold in dB, but if the app needs to work in noisy environments too, you'd need to analyze the signal somehow and see if it contains human speech.

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 Amiad · Jun 29, 2011 at 07:02 AM 0
Share

I have Unity Pro. Where is plugins for microphone? The environment is quiet, how I can to check db?

thanks

avatar image CHPedersen · Jun 29, 2011 at 07:23 AM 0
Share

It depends on what your platform is going to be. If you're developing for the iPhone, this plugin seems to do what you want:

http://www.prime31.com/unity/

If you're not on the iPhone however, things look somewhat more bleak. On windows, you can record audio in C# using calls to external, native functions in a dll-file called "winmm.dll". This project demonstrates how to do that:

http://www.codeproject.com/$$anonymous$$B/audio-video/SoundCatcher.aspx

The soundcatcher project has an FFT implementation that involves calculating decibels, to answer your other question.

Errr... I don't mean to be rude, but be warned that capturing audio this way is kind of hairy and sounds like it might be a little much for you. You might be better off altogether if you simply wait for the audio guys from Unity to offer this functionality inside Unity itself.

avatar image Amiad · Jun 29, 2011 at 11:30 AM 0
Share

I succesed to record from microphone but I not know if the user speak. [DllImport("winmm.dll", EntryPoint = "mciSendStringA", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)] private static extern int mciSendString(string lpstrCommand, string lpstrReturnString, int uReturnLength, int hwndCallback);

 public static void record_voice()
 {
     mciSendString("open new Type waveaudio Alias recsound", "", 0, 0);
     mciSendString("record recsound", "", 0, 0);
 }

 public static void savefile()
 {
     mciSendString("save recsound test.wav", "", 0, 0);
     mciSendString("close recsound ", "", 0, 0);
 }

I see FFT but I not understaned how it help me.

avatar image
0

Answer by makisig.du · Sep 18, 2011 at 01:14 PM

I guess you already know that you can extend Unity's functionality through plugins and there are a number of plugins already available that you may use to detect mic input. However, if you're going to differentiate actual speech from any other auditory signal, then that's a whole new deal altogether.

My team took weeks putting together a cross-platform speech recognition plugin for Unity and all I can tell you now is that there is no easy way of doing it, unfortunately. At least, not at the time I posted this answer.

Maybe when it becomes more popular, Unity might consider including an API for it. For now, we had to make one.

Here's a sample of what we did. Don't hesitate to drop us a line if you want to discuss further.

http://www.youtube.com/watch?v=P_u-CANKKno

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

What causes Microphone Start to not work, giving error result = 25? 0 Answers

Multiple Microphone Inputs 0 Answers

Get the device audio volume 0 Answers

recording sound from different locations? 0 Answers

Deleting an AudioClip created by the microphone 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