Free Porn
xbporn

buy twitter followers
uk escorts escort
liverpool escort
buy instagram followers
Array

Recording Audio

Must Read

Admin
Admin
Just post!

When recording, the device buffers the microphone input. Create a ByteArray object to store the audio data. Create a reference to the microphone and add a listener to the SampleDataEvent.SAMPLE_DATA event:

import flash.media.Microphone;
import flash.utils.ByteArray;
import flash.events.SampleDataEvent;
var bytes:ByteArray = new ByteArray();

var microphone:Microphone=Microphone.getMicrophone();
if (microphone!= null) {
microphone.gain = 100;
microphone.rate = 22;
microphone.setSilenceLevel(0, 4000);
microphone.addEventListener(SampleDataEvent.SAMPLE_DATA, recording);
}
function recording(event:SampleDataEvent):void {
while(event.data.bytesAvailable) {
var sample:Number = event.data.readFloat();
bytes.writeFloat(sample);
}
}

To stop the recording, remove the event listener. You can do this in code using a timer:

import flash.utils.Timer;
import flash.events.TimerEvent;
var timer:Timer = new Timer(5000);
timer.addEventListener(TimerEvent.TIMER, stopRecording);
timer.start();
function stopRecording(event:TimerEvent):void {
microphone.removeEventListener(SampleDataEvent.SAMPLE_DATA, recording);
timer.reset();
}

You can also let the user click a button to stop the recording. In this case, be aware of the memory and storage being used. You may want to prompt the user if the recording has been going on for more than a few seconds.

Previous articleThe Microphone
Next articlePlaying Back Audio
- Advertisement -

Latest News

Elevate Your Bentley Experience: The Bespoke Elegance of Bentayga EWB by Mulliner

Bentley Motors redefines the essence of bespoke luxury with the introduction of the Bentayga EWB's groundbreaking two-tone customization option—a...
- Advertisement -

More Articles Like This

- Advertisement -