public void StartRecording()

in Scripts/Runtime/Lib/Mic.cs [217:254]


        public void StartRecording(int sampleLen = 10)
        {
            if (!IsInputAvailable)
            {
                Debug.LogWarning("Tried to start recording when no input is available.");
                return;
            }

            StopRecording();

            if (!Microphone.IsRecording(CurrentDeviceName))
            {
                Debug.Log("[Mic] " + CurrentDeviceName + " was not started when starting recording, restarting mic.");
                StartMicrophone();
            }

            IsRecording = true;

            SampleDurationMS = sampleLen;

            Sample = new float[AudioEncoding.samplerate / 1000 * SampleDurationMS * AudioClip.channels];

            if (AudioClip)
            {
                StartCoroutine(ReadRawAudio());

                // Make sure we seek before we start reading data
                Microphone.GetPosition(CurrentDeviceName);

                Debug.Log("[Mic] Started recording with " + CurrentDeviceName);
                if (OnStartRecording != null)
                    OnStartRecording.Invoke();
            }
            else
            {
                OnStartRecordingFailed.Invoke();
            }
        }