Recording Audio

Must Read

Basic Design Considerations

Before you examine the scenarios and considerations for mobile phone applications, use Figure 1 to frame the main areas...

What Is Multitouch and Gesture?

Multitouch is a technology that is capable of detecting one or more touches (typically via a finger) and movements...

Home Equity Lines Of Credit For Starting Your Own Business!

All the initial steps for starting your own business can easily be financed with the funds obtained from a...

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.utils.ByteArray;
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( {
var sample:Number =;

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

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

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


Please enter your comment!
Please enter your name here

Latest News

Top 10 Provinces of Thailand Not to be missed for Travel

10 SuratthaniThe source of the proverbial Chaiya salted egg. Surat Thani is a province with many attractions,...

Underlight As Accent, For Power and The Main Light for Photography

Underlighting, in which fill or accent light comes from under the topic, is not widely used technique in the traditional Portraits, even though it will have...

How To Fix Overexposure As A Creative Tool, The Complete Guide

As an creative tool, overexposure is sort of underrated. What I’m close to propose could be a deliberate and well thought out technique for...

7D Mark II is Canon’s best DSLR cameras without full-frame sensor.

The expected long-awaited Canon EOS 7D Mark II are shipping in November for $ 1,799 without a lens. With a higher price tag, you...

Low key photography and How to isolate your subject.

Low key photography doesn’t depend on underexposure to make its point; the key to low key is that the majority of tones, even correctly...

More Articles Like This