Version: 2017.2
public static AudioClip Start (string deviceName, bool loop, int lengthSec, int frequency);

パラメーター

deviceName デバイス名
loop ループ録音を行なうかどうか、行なう場合は lengthSec に到達したときにクリップの最初に戻って録音を継続する
lengthSec 録音するオーディオクリップの長さ
frequency 録音するオーディオクリップの周波数

戻り値

AudioClip 録音を開始できなかった場合 false を返す

説明

デバイス名を指定して録音を開始します

デバイス名に null や空の文字列を渡すと、デフォルトのマイクが使用されます。利用可能なマイクデバイスの一覧を devices プロパティーにより取得できます。GetDeviceCaps プロパティーを使用して、マイクでサポートされているサンプルレートの範囲を調べることができます。

Note that if you want to use the Microphone class in the web player, you need to get the user's permission to do so. Call Application.RequestUserAuthorization before calling any Microphone methods.

using UnityEngine;
using System.Collections;

public class ExampleClass : MonoBehaviour { void Start() { AudioSource aud = GetComponent<AudioSource>(); aud.clip = Microphone.Start("Built-in Microphone", true, 10, 44100); aud.Play(); } }

5.4.0 以降では、web player はサポートされないことに注意してください。