test test
test test

Reputation: 11

unity can't record audio with kinect V2

I want to record audio in Unity with the microphone from the kinectV2.

I tried: audio.clip = Microphone.Start(null, true, 200, 22050)

But that doesn't work.

https://i.sstatic.net/ZEzKL.jpg

The only input I have is a Kinect NUI sensor. Here's the code I use for recording:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class RA : MonoBehaviour {

    bool isRecord = true;

    public AudioSource audio;

    void OnGUI(){
        if(isRecord){
            if(GUI.Button(new Rect(Screen.width/2-100, Screen.height/2-50,200,100), "Record")){ // start
                isRecord = !isRecord;
                audio.clip = Microphone.Start(null, true, 200, 22050); // 200s 22050 Hz 
            }
        }else{
            // stop, play
            if(GUI.Button(new Rect(Screen.width/2-100, Screen.height/2-50,200,100), "Close & Play")){
                isRecord = !isRecord;
                Microphone.End(null);
                audio.Play();
            }
        }
    }
}

This is the error code I'm getting:


Starting Microphone failed. result=25 (Unsupported file or audio format. ) UnityEngine.Microphone:Start(String, Boolean, Int32, Int32)

Upvotes: 1

Views: 703

Answers (1)

jvhang
jvhang

Reputation: 777

The issue seems to be with Unity and lack of support for Microphone Arrays, which is what the Kinect has.

Similar issues on Unity forum:

https://forum.unity.com/threads/capturing-from-a-microphone-array-errors-in-all-unity-versions.849781/

Upvotes: 0

Related Questions