Search Unity

Audio Unity Recorder: microphone not picked up during recording

Discussion in 'Audio & Video' started by GSanLob, Jan 20, 2019.

  1. GSanLob

    GSanLob

    Joined:
    Oct 11, 2017
    Posts:
    14
    Hi, I’ve been loving the Unity Recorder. Thanks for a great Asset! My only only hiccup came when I tried to input the microphone during a record. I’m trying to make a puppet that I can voice in real time during gameplay. And I would like to record this via Unity Recorder. Before I hit record, the microphone works fine and I could hear the audio feed in. But once I started recording, the actual output file(mp4) has messed up microphone input. It’s almost as if once I hit record, the microphone input stops, but the audio clip keeps replaying the last 10 seconds of microphone input(10 seconds because I think that’s what I specified for lengthSec in Microphone.Start() ).

    Is there any way to fix this or bypass this?

    I’m on a windows machine. I downloaded the Unity Recorder a few days ago, so I believe it’s up to date. My Unity version is 2018.2.

    Thank you!
     
    hughperkins likes this.
  2. kilik128

    kilik128

    Joined:
    Jul 15, 2013
    Posts:
    909
    same here
     
  3. Sylance

    Sylance

    Joined:
    Jan 2, 2018
    Posts:
    3
    same here
     
  4. TAP66

    TAP66

    Joined:
    Nov 30, 2018
    Posts:
    3
    and again
     
  5. Steve-Holt

    Steve-Holt

    Joined:
    Sep 22, 2014
    Posts:
    2
    Same here. Almost.
    I dont get any indication that the microphone is even being registered. I have a character with mouth-animation based on microphone input that works fine, but when i press "Start Recording" on Unity Recorder, the mouth stops moving, i dont hear the audio in my headphones, and i get this error:

    "IndexOutOfRangeException: Index was outside the bounds of the array.
    SpeechBlendMicrophoneInput.Start () ..."

    This is what my script says:

    using UnityEngine.Audio;

    Start()
    {
    string device_name = Microphone.devices[0];
    }
     
  6. HeyBishop

    HeyBishop

    Joined:
    Jun 22, 2017
    Posts:
    238
    I'm attempting to do the exact same thing. I'm even referring to it as a puppet!
    @markvi, is this a bug?

    I have a pretty simple script running on a GameObject with an AudioSource:

    Code (CSharp):
    1. using System.Collections;
    2. using System.Collections.Generic;
    3. using UnityEngine;
    4.  
    5. public class AudioTap : MonoBehaviour
    6. {
    7.     public string[] connectMics = new string[] {
    8.         "Desktop Microphone (RØDE NT-USB Mini)",
    9.         "Headset Microphone (Oculus Virtual Audio Device)",
    10.         "Microphone (HD Pro Webcam C920)" };
    11.     public int useMic = 0;
    12.  
    13.     public bool showConnectedMicsDebugLog = false;
    14.  
    15.     // Start recording with built-in Microphone and play the recorded audio right away
    16.     void Start()
    17.     {
    18.         if (showConnectedMicsDebugLog)
    19.         {
    20.             int deviceCount = 0;
    21.             foreach (var device in Microphone.devices)
    22.             {
    23.                 Microphone.GetDeviceCaps(device, out int minFreq, out int maxFreq);
    24.                 Debug.Log("Mic[" + deviceCount + "] = " + device + ", minFreq: " + minFreq + ", maxFreq: " + maxFreq);
    25.                 deviceCount++;
    26.             }
    27.         }
    28.  
    29.         AudioSource audioSource = GetComponent<AudioSource>();
    30.         audioSource.clip = Microphone.Start(connectMics[useMic], false, 30, 48000);
    31.         audioSource.Play();
    32.     }
    Just like @GSanLob, I'm hearing the audio just fine until I hit record on the Unity Recorder.

    In the same scene, I have another GameObject playing an audio clip. The audio from that source is recorded with the Recorder, but not the mic.

    I've recorded a video demonstrating my problem:
     
    Crayden and KenjiShiguma like this.
  7. HeyBishop

    HeyBishop

    Joined:
    Jun 22, 2017
    Posts:
    238
    Hi there, circling back - any suggestions on how to record audio from a mic?
     
    hughperkins likes this.
  8. hughperkins

    hughperkins

    Joined:
    Dec 3, 2022
    Posts:
    191
    I have the same issue. Looks like whilst using the Recorder, `Microphone.devices` is empty, and unable to use the Microphone? Kind of unfortunate because otherwise the Recorder seems like potentially very useful... (easier than using QuickTime etc.... if it worked :p )
     
  9. EnsenaSoft

    EnsenaSoft

    Joined:
    Nov 28, 2012
    Posts:
    13
    This is a problem for us as well. Without being able to use Microphone as we can otherwise in Editor, their is no way to get recording of app that requires microphone input as a means of play. :(
     
  10. smartplay

    smartplay

    Joined:
    Feb 13, 2019
    Posts:
    21
    same here