**Answer**
add this C# script to your project: https://gist.github.com/2317063 (credits to [Dark Table][1])
on other C# script call SavWav.Save("myfile", myAudioClip);
for example:
public class audioRec : MonoBehaviour {
AudioClip myAudioClip;
void Start() {}
void Update () {}
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"))
{
SavWav.Save("myfile", myAudioClip);
// audio.Play();
}
}
}
It saves the .Wav file to some strange folder. to change that, open SavWav.cs file and change line 41 (var filepath = Path.Combine(Application.persistentDataPath, filename);) to:
var filepath = Path.Combine(Application.dataPath, filename);
hope it helps. credits to people on this post: http://forum.unity3d.com/threads/119295-Writing-AudioListener.GetOutputData-to-wav-problem
[1]: http://forum.unity3d.com/members/4397-Dark-Table
Trending Articles
More Pages to Explore .....