使用Unity C#

时间:2018-11-18 09:27:42

标签: c# unity3d audio microphone recording

感谢您的光临。 我有两个连接到PC的麦克风,我想同时录制它们的声音。有可能做到这一点吗?任何方法。也许我需要购买一些设备?

1 个答案:

答案 0 :(得分:0)

您应该能够使用麦克风类来获取可用录音设备的列表

// Get list of Microphone devices and print the names to the log
void Start()
{
    foreach (var device in Microphone.devices)
    {
        Debug.Log("Name: " + device);
    }
}

您可以使用此设备列表从每个设备创建音频剪辑

[SerializeField]
private AudioSource audioSource1;
[SerializeField]
private AudioSource audioSource2;

// Start recording with built-in Microphone and play the recorded audio right away
private IEnumerator Record()
{
    audioSource1.clip = Microphone.Start("<audio-device-1>", true, 10, 44100);
    audioSource2.clip = Microphone.Start("<audio-device-2>", true, 10, 44100);
}