Array

The Microphone

Must Read

Bad Credit HELOC Loans

People with bad credit are often leery of applying for home equity line of credit (HELOC) loans. This is...

Wednesday: Determining the Number and Granularity of Ad Groups

A common question we get when making PPC presentations is, “How many keywords should you include in an ad...

Internet Marketing Guide – 3 Truths to choose the right guide for you

What Is The Best Internet Marketing Guide For You?As one of the most common questions, any kind of Internet...
Admin
test

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.

flash.media.Microphone 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:

import flash.media.Microphone;
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;
level.graphics.beginFill(0xFF6600);
level.graphics.drawCircle(0, 0, 100);
level.graphics.endFill();
// 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);

 

LEAVE A REPLY

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