2010-11-20 8 views

答えて

3

MicRecorder。以下はプロジェクトサイトからのものです。

はちょうどそれらの数行を使用し、アプリケーション内のマイクからの音声を録音するには:

// volume in the final WAV file will be downsampled to 50% 
var volume:Number = .5; 
// we create the WAV encoder to be used by MicRecorder 
var wavEncoder:WaveEncoder = new WaveEncoder(volume); 
// we create the MicRecorder object which does the job 
var recorder:MicRecorder = new MicRecorder(wavEncoder); 
// starts recording 
recorder.record(); 
// stop recording 
recorder.stop(); 

記録RecordingEvent.RECORDINGイベントが時間程度に関する情報を与えて派遣されて起動します。

recorder.addEventListener(RecordingEvent.RECORDING, onRecording); 
recorder.addEventListener(Event.COMPLETE, onRecordComplete); 

private function onRecording(event:RecordingEvent):void 
{ 
    trace (event.time); 
} 

private function onRecordComplete(event:Event):void 
{ 
    fileReference.save (recorder.output, "recording.wav"); 
} 

ます。また、何を再生することができます記録するときには、Event.COMPLETEは、あなたがMicorder.outputバイトを取得し、簡単なFileReferenceオブジェクトを使用して(WAVとしてこの場合)オーディオストリームを保存することができ、送出される停止しました素敵なas3wavsoundライブラリからWavSoundオブジェクトに生のWAVファイルを渡すことによって記録されています

private function onRecordComplete(event:Event):void 
{ 
    var player:WavSound = new WavSound(recorder.output); 
    player.play(); 
} 

MicRecorderオブジェクトが使用可能なデフォルトのマイクデバイスではデフォルトで依存しているが、作成時には、代替として、任意のマイクのインスタンスを渡すことができますMicRecorderオブジェクト:

// a specific Microphone instance can be passed 
var recorder:MicRecorder = new MicRecorder(wavEncoder, microphoneDevice); 
関連する問題