public float sensitivity = 1000;
public float loudness = 0;
public Slider thresholdTopSlider;
public Slider thresholdBottomSlider;
public float thresholdTop;
public float thresholdBottom;
public bool clapping = false;
AudioSource _audio;
public float VelocityPerJump = 3;
public AudioClip FlyAudioClip;
float GetAverageVolume() {
float[ ] data = new float[1];
float a = 0;
if (GetComponent() != null)
{
_audio.GetOutputData(data, 0);
}
foreach (float s in data)
{
a += Mathf.Abs(s);
}
return a;
}
Use code tags. Your code is hard to read without them.
In Start I see you are setting mute to true, then replacing the reference to the AudioSource before starting the microphone (which you’re also doing twice for some reason). Depending on what AudioSource _audio was set to before you GetComponent another one, it may not have been the same AudioSource you are muting that you are using for the microphone recording. So I’d start looking at what you are trying to do there first.
hey joe sensored i really appreciate your answer but the problem is that i have mute the audio after audio.play() but it mutes the microphone…i dont know why…tell me i want that player do not listen his voice when he produces his sound…all code work perfect but when i mute the audio then microphone do not respond what player is saying…
my game is like when player makes some voice on mobile then my character jumps…
so i record his voice through microphone…but while testing my game i am hearing my own voice from the game too…that is not what i want…i just want microphone to listen my voice then with out producing any sound jumps the character…which microphone is doing well but with alot of noises and with my own voice