blow detection using android microphone

am trying to make a program for android that turns on ParticleSystem when the volume of blowing is above x decibels. I was trying to use this tutorial http://www.kaappine.fi/tutorials/using-microphone-input-in-unity3d/ , but I didnt get along with it… I would appreciate any help.

I think I found a solution. Instead of just using audio.clip , audio.mute etc, You have to get the AudioSource Instance. It can be using at start like this

AudioSource audio_source;

void Start(){
        audio_source = GetComponent<AudioSource>();

        //add the rest of the code like this
        audio_source.clip = Microphone.Start(null, true, 10, 44100);
        audio_source.loop = true; 
        while (!(Microphone.GetPosition(null) > 0)) { }
        audio_source.Play();

        //Do not Mute the audio Source.
}

After that you will hear what you say through the mic. If you mute the AudioSource, this would not work. In order to stop hearing your own input. Create a new Audio Mixer in your project assets folder.

In groups, click the + button and add a new group. Use any name you want.

Then go to that empty gameobject with the MicrophoneInput class. Go to the AudioSource in the hierarchy. Click on ‘Output’ and select the group you created. Then go back to the AudioMixer and lower the volume to 0. Do not mute it either. Just keep the volume as 0. :slight_smile: