You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

31 lines
773 B

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class RecordMic : MonoBehaviour {
AudioClip myAudioClip;
void OnGUI()
{
if (GUI.Button(new Rect(10, 10, 60, 50), "Record"))
{
myAudioClip = Microphone.Start(null, false, 10, 44100);
}
if (GUI.Button(new Rect(10, 70, 60, 50), "Save"))
{
for (int i = 1; ; i++)
if (System.IO.File.Exists("myfile"))
{
SaveAudio.Save("myfile" + i, myAudioClip);
}
else
{
SaveAudio.Save("myfile", myAudioClip);
// audio.Play();
}
}
}
}