- Home /
Question by
nilesh410451 · Apr 21, 2016 at 02:16 PM ·
microphonerecordingrecordmic
Unity Microphone Auto start recording and auto stop recording
I want Microphone should start recording as soon as person start talking and stop recording when person stop talking..
i have done it for start recording but not able to do it for stop recording...
void Update() { loudness = GetAveragedVolume() * sensitivity; //print (loudness);
if (loudness > 0.6 && !isRecording) {
stopMicrophone();
isRecording=true;
print ("start recording");
MicrophoneRecording.SharedInstance.startRecording();
}
}
float GetAveragedVolume()
{
float[] data = new float[256];
float a = 0;
audio.GetOutputData(data, 0);
foreach (float s in data)
{
a += Mathf.Abs(s);
}
return a / 256;
}
Comment
Your answer
Follow this Question
Related Questions
Failed to get record driver caps. result=37 1 Answer
Multiple Microphone Inputs 0 Answers
Microphone doesn't record (or save) sometimes Android Unity 20.1.10f1 0 Answers
Unity Recorder Console Error 2 Answers