簡體   English   中英

unity 無法使用 kinect V2 錄制音頻

[英]unity can't record audio with kinect V2

我想用來自 kinectV2 的麥克風在 Unity 中錄制音頻。

我試過:audio.clip = Microphone.Start(null, true, 200, 22050)

但這不起作用。

https://imgur.com/Fh5AaHB

我唯一的輸入是 Kinect NUI 傳感器。 這是我用於錄制的代碼:

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();
            }
        }
    }
}

這是我得到的錯誤代碼:


啟動麥克風失敗。 結果=25(不支持的文件或音頻格式。)UnityEngine.Microphone:Start(String, Boolean, Int32, Int32)

問題似乎與 Unity 和缺乏對麥克風陣列的支持有關,而這正是 Kinect 所擁有的。

Unity 論壇上的類似問題:

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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM