Reputation: 11
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
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:
Upvotes: 0