Unity: Capturing audio from a microphone | 41 Post
http://www.41post.com/4884/programming/unity-capturing-audio-from-a-microphone
こんな短いプログラムで録音出来るんですね。録音出来る時間を録音開始時に指定しないといけないがちょっと厄介ですね。
長時間やスタート時に録音時間が決めれない様な時は連続して録音を繰り返して後で連結とかなのかなぁ?
以下にこの記事のサンプルプログラムで使われていた主なメソッドの引数の解説を書いておきます。
メソッド解説
Microphone.GetDeviceCaps
static function GetDeviceCaps (deviceName : String, out minFreq : int, out maxFreq : int) : void
引数 | 説明 |
---|---|
deviceName | デバイス名の指定。 null の場合はデフォルトのものが使用される |
minFreq | 設定可能なサンプリング周波数の下限 |
maxFreq | 設定可能なサンプリング周波数の上限 |
Unity Script Reference – Microphone.GetDeviceCaps
http://docs.unity3d.com/Documentation/ScriptReference/Microphone.GetDeviceCaps.html
Microphone.Start
static function Start (deviceName : String, loop : boolean, lengthSec : int, frequency : int) : AudioClip
引数 | 説明 |
---|---|
deviceName | デバイス名の指定。 null の場合はデフォルトのものが使用される |
loop | true の時、録音が lengthSec で指定した長さにまで達した時にAudioClipオブジェクトが先頭から上書きされる |
lengthSec | 録音によって生成されるAudioClipオブジェクトの長さ |
frequency | サンプリング周波数の指定 |
Unity Script Reference – Microphone.Start
http://docs.unity3d.com/Documentation/ScriptReference/Microphone.Start.html