playMaker

Author Topic: Blow detection - Microphone input  (Read 12679 times)

createasaurus

  • Full Member
  • ***
  • Posts: 146
Blow detection - Microphone input
« on: March 03, 2014, 10:56:54 PM »
Blowing on a microphone as input is used in many games these days.  There is lots on fun to be had with this feature such as simulating playing a wind instrument, blowing up a balloon, or blowing out candles.

I've found lots of code samples online on how to achieve this, but they were well above my level.  I wish there could be a PlayMaker action that would just act like a button press (are they blowing or not, and how hard?)  Personally, I'd be using this feature on the WiiU, but I am sure many would love it for iOS, as there are many blowing games on the phones already.

PS My favorite WiiU blowing moment is blowing away tiny monsters in Super Mario 3D World.  My second favorite is blowing to power propeller platforms.

Thanks for considering!
« Last Edit: March 03, 2014, 11:01:00 PM by createasaurus »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Blow detection - Microphone input
« Reply #1 on: March 04, 2014, 07:30:08 AM »
Hi,

 This will do the job:

https://www.assetstore.unity3d.com/#/content/12518

tell me if you can't make it work, I'll have a look myself.


bye,

 Jean

createasaurus

  • Full Member
  • ***
  • Posts: 146
Re: Blow detection - Microphone input
« Reply #2 on: March 04, 2014, 09:14:18 AM »
I've downloaded Mic Control.  It is a great start.  Mic Control seems to detect loudness (with a sensitivity adjuster).  However, I also need to isolate the blowing sound.

Poking around the internet I have learned: "The noise/sound of someone blowing into the mic is made up of low-frequency sounds. A low pass filter can reduce the high frequency sounds coming in on the mic. You can recognize someone as having blown into the mic when the level of the filtered signal spikes."

The above quote and coding tutorials are from here:
http://mobileorchard.com/tutorial-detecting-when-a-user-blows-into-the-mic/

Although I am trying, I do not yet read code and I am struggling to put all the pieces together.  If you are willing to provide further guidance, I'd be grateful.  Thank you.
« Last Edit: March 04, 2014, 05:15:25 PM by createasaurus »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Blow detection - Microphone input
« Reply #3 on: March 05, 2014, 02:26:28 AM »
Hi,

 I do not recommend you base work on this, I would actually ask Unity community for some c# based examples instead, else it will be difficult to port.

I am running behind on a lot of playmaker pending work, so I can't really commit to this unfortunatly. Hopefully, someone can step in with some working samples or something. But in all cases, I would run this passed Unity community, if you find a working sample, I can then make it work within PlayMaker.

bye,

 Jean


createasaurus

  • Full Member
  • ***
  • Posts: 146
Re: Blow detection - Microphone input
« Reply #4 on: March 05, 2014, 07:33:57 AM »
Thank you for looking at this, I understand if you cannot commit.  I think I found an existing thread from the Unity forums posting code for this.

http://forum.unity3d.com/threads/118215-Blow-detection-(Using-iOS-Microphone)?p=802891&viewfull=1#post802891

Please let me know if this code seems good.  Thank you again.
« Last Edit: March 05, 2014, 10:23:59 AM by createasaurus »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Blow detection - Microphone input
« Reply #5 on: March 05, 2014, 11:53:05 PM »
Hi,

 well, you should give it a go it will be easy to see if this works for you since you that code will show meters based on object scaling, so have anobject taged "Meter" and it will showing you the feedback.

bye,

 Jean

createasaurus

  • Full Member
  • ***
  • Posts: 146
Re: Blow detection - Microphone input
« Reply #6 on: March 06, 2014, 11:29:16 PM »
I tested the script!  The good news, it works!... kind of.

The bad news, it does not work too well.  The effect is too often triggered when there is no blowing (fingers rubbing on the controller near mic, for example).  Also, you have to blow just right or the effect does not trigger and sometimes it has an unnatural delay.  It is not as sure fire as pressing a button per say.

I didn't realize that I was barking up such a complicated tree when I hoped for a blow trigger!

Next steps: I will continue to search, experiment, and ask...

Appeal to the community: if anybody has expertise on this, please comment. 

Thank you.
« Last Edit: March 07, 2014, 06:45:33 AM by createasaurus »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Blow detection - Microphone input
« Reply #7 on: March 11, 2014, 06:35:32 AM »
Hi,

 Indeed, sound is a tricky beast when it comes to detection, so good luck with this! Keep us updated.

bye,

 Jean