The Microphone

Must Read

Why Debt Consolidation Loans Are Not a Cure For Debt

Debt consolidation loans will help you get out of debt at best and minimize the impact of debt on...

Find the Best Student Loan Consolidation Company

Consolidating all your student loans is primarily a convenient form of repaying all your student loans, leaving you with...

Canon PowerShot G12 Adjust the Viewfinder Diopter

If you use the viewfinder on your G12, everything may not appear in crisp focus. To remedy this, use...

You can use the microphone in many applications on a mobile device. For example, you can take quick audio notes. You can add an audio caption to your photograph. You can even create a DJ multitrack tool with a convenient multitouch interface. is a static class for monitoring and capturing audio from the device’s native microphone. It is a subclass of the EventDispatcher class.

Your application needs the audio permission to use it:

<uses-permission android:name=”android.permission.RECORD_AUDIO”/>

First make sure your device has a microphone and gives you access to it:

if (Microphone.isSupported) {
// continue on

If it does, create a reference to it through its getMicrophone method. On Android devices, you only have access to one microphone:

var microphone:Microphone = Microphone.getMicrophone();

The microphone has several properties that you can set to improve your recording.

gain works as a volume multiplier and has a value between 0 and 100. The default value is 50 or a multiplier of 1. Any value above 50 boosts the microphone and below reduces it.

You want to boost the microphone to the maximum, not only because the mobile hardware is of a lesser quality than your desktop, but also because your users may be outdoors, or in a noisy place, while using your application:

microphone.gain = 100;

rate defines the sample rate and impacts the quality of the input audio. A higher sample rate gives a better sound quality but requires more memory on playback and takes more storage room. The sample rate is measured in kilohertz (kHz) with values of 5, 8, 11, 22, and 44. Considering that the microphone is only mono, a value of 22 should be sufficient. Try a smaller rate depending on your application’s needs:

microphone.rate = 22;

activityLevel is a read-only property that returns the amount of sound detected, from 0 to 100. It can be used as a visual aid for users to monitor how loud they should be speaking:

var level:Sprite = new Sprite();
level.x = stage.stageWidth*0.5;
level.y = stage.stageHeight*0.5;;, 0, 100);;
// while recording
level.width = microphone.activityLevel * 3;
level.height = microphone.activityLevel * 3;

silenceLevel represents the amount of noise needed to activate the microphone. The default is 10, but you can modify this using setSilenceLevel. A second optional parameter is the amount of time before a silent state starts:

microphone.setSilenceLevel(0, 3000);



Please enter your comment!
Please enter your name here

Latest News

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,...

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...

High Key Lighting Techniques for Professional Photographers

I’ve written many times about high key lighting techniques and how to achieve them. The term “high key” is a bit misleading. As I’ve...

More Articles Like This