- Home /
How to save multiple microphone recordings
Hey, I have codes for starting/stopping to record using the microphone, and a code to play this recording. Whenever I try to record multiple files though, they overwrite each other and also I have no clue where they are being saved to. I would like to know a way that would allow me to record and save multiple microphone recordings, and then be able to play them. Here are my code scripts, so if anyone knows how to solve this that would be greatly appreciated, thanks!
using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI;
public class StartRecording : MonoBehaviour {
// Use this for initialization
void Start () {
}
public void recordAudio()
{
//Starts recording audio
AudioSource aud = GetComponent<AudioSource> ();
aud.clip = Microphone.Start (Microphone.devices [0], false, 10000, 44100);
//checks whether it is actually recording
Debug.Log ("It Started");
Debug.Log (Microphone.devices [0]);
}
}
using System.Collections; using System.Collections.Generic; using UnityEngine;
public class EndRecording : MonoBehaviour {
// Use this for initialization
void Start () {
}
public void StopRecord ()
{
//Accesses recording being made and stops it
AudioSource aud = GetComponent<AudioSource> ();
Microphone.End (Microphone.devices [0]);
}
}
using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI;
public class PlayAudio : MonoBehaviour {
// Use this for initialization
void Start () {
}
public void playAud()
{
//Plays recording stored
AudioSource aud = GetComponent<AudioSource> ();
aud.Play (44100);
}
}
Your answer
![](https://koobas.hobune.stream/wayback/20220612161852im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Guys i need help with audio! 0 Answers
Unity Microphone downsampling audio 2 Answers
Delay with Microphone.Start 1 Answer
Timing pulses from microphone 0 Answers