Tuesday, October 24, 2006

Coding: Microphone properties in Flash 8

Microphone


public class Microphone
extends Object

The Microphone class lets you capture audio from a microphone attached to the computer that is running Flash Player.

The Microphone class is primarily for use with Flash Communication Server but can be used in a limited fashion without the server, for example, to transmit sound from your microphone through the speakers on your local system.

Caution: Flash Player displays a Privacy dialog box that lets the user choose whether to allow or deny access to the microphone. Make sure your Stage size is at least 215 x 138 pixels; this is the minimum size Flash requires to display the dialog box.

Users and Administrative users may also disable microphone access on a per-site or global basis.

To create or reference a Microphone object, use the Microphone.get() method.

Availability: ActionScript 1.0; Flash Player 6

Property summary



activityLevel:Number [read-only]
A numeric value that specifies the amount of sound the microphone is detecting.

gain:Number [read-only]
The amount by which the microphone boosts the signal.

index:Number [read-only]
A zero-based integer that specifies the index of the microphone, as reflected in the array returned by Microphone.names.

muted:Boolean [read-only]
A Boolean value that specifies whether the user has denied access to the microphone (true) or allowed access (false).

name:String [read-only]
A string that specifies the name of the current sound capture device, as returned by the sound capture hardware.
static
names:Array [read-only]
Retrieves an array of strings reflecting the names of all available sound capture devices without displaying the Flash Player Privacy Settings panel.

rate:Number [read-only]
The rate at which the microphone is capturing sound, in kHz.

silenceLevel:Number [read-only]
An integer that specifies the amount of sound required to activate the microphone and invoke Microphone.onActivity(true).

silenceTimeOut:Number [read-only]
A numeric value representing the number of milliseconds between the time the microphone stops detecting sound and the time Microphone.onActivity(false) is invoked.

useEchoSuppression:Boolean [read-only]
Property (read-only); a Boolean value of true if echo suppression is enabled, false otherwise.


Event summary


Event
Description
onActivity = function(active:Boolean) {}
Invoked when the microphone starts or stops detecting sound.
onStatus = function(infoObject:Object) {}
Invoked when the user allows or denies access to the microphone.

Method summary
Modifiers
Signature
Description
static
get([index:Number]) : Microphone
Returns a reference to a Microphone object for capturing audio.

setGain(gain:Number) : Void
Sets the microphone gain--that is, the amount by which the microphone should multiply the signal before transmitting it.

setRate(rate:Number) : Void
Sets the rate, in kHz, at which the microphone should capture sound.

setSilenceLevel(silenceLevel:Number, [timeOut:Number]) : Void
Sets the minimum input level that should be considered sound and (optionally) the amount of silent time signifying that silence has actually begun.

setUseEchoSuppression(useEchoSuppression:Boolean) : Void
Specifies whether to use the echo suppression feature of the audio codec.

Methods inherited from class Object

-------

This makes it clear that if I use Flash Professional 8 for coding, i would be able to make use of the following properties of sound:

activityLevel, gain index,muted,name, rate and silenceLevel .

No comments: