Microphone Object


The Microphone object controls access to the microphone input attached to a client's computer. The Microphone object controls capture settings, including sample and gain. You can also set the microphone to trigger events when it detects sound (or silence). The Flash Communication Server is required to record or transmit the microphone source to other Flash clients ; however, the Microphone object can be accessed locally without the server.

The Microphone object is enabled using the Microphone.get() method. To enable Code Hints and Code Completion in the Flash MX ActionScript Editor, use the suffix _mic in the name of the Microphone variable.

Microphone Methods

Microphone.get([index])

Captures the microphone feed and assigns it to a MovieClip object or a NetStream. You can quickly access the microphone feed using attachAudio .

[index] The integer number identifying an individual microphone in a multiple microphone environment. The number is determined by the Microphone. names property. If there is only one microphone, omit this parameter.
Microphone.setGain(gain)

Sets the amount of gain (or volume increase) to apply to the microphone.

gain A value that determines the amount of volume to add to the microphone source. The valid range is 0 (silence) to 100 (maximum record volume). This setting can be changed by the user in the Flash player's Microphone Settings panel.
Microphone.setRate(kHz)

Sets the frequency (or sample rate) in kilohertz (kHz) of the sound capture driver.

kHz Values can be 5, 8, 11, 22, or 44 only. The default is 8kHz. 44 is equivalent to CD-quality sound, but requires more bandwidth to distribute.
Microphone.setSilenceLevel(level [, timeout])

Sets the sound sensitivity or how much sound is required to trigger the Microphone.onActivity event.

sensitivity The sound sensitivity value from 0 to 100 (highest sensitivity); default value is 10.
timeout The length of time, in milliseconds , of no audio before setting the Microphone.onActivity event to false; default value is 2000 (2 sec).
Microphone.setUseEchoSuppression(suppress)

Sets the echo suppression filter setting in the audio compressor.

suppress A Boolean value; a value of true turns the suppression filter on. The user can change this setting in the Flash player's Settings panel.

Microphone Properties

Microphone.activityLevel returns the amount of sound being received through the microphone source. It is great for VU meters .

Microphone.gain returns the gain value being applied to the sound source. This can be set using the Microphone.setGain() function.

Microphone.index returns the index value of the current microphone being used.

Microphone.muted returns the Boolean value if microphone access is granted by the user.

Microphone.name returns the manufacturer's name of the current sound capture device.

Microphone.names returns an array of strings containing the names of all microphone sources available to the Flash player. This will not invoke the Privacy Settings panel.

Microphone.rate returns the current sound capture frequency or sample rate in kHz.

Microphone.silenceLevel returns the value of the sensitivity setting set using Microphone.setSilenceLevel() .

Microphone.silenceTimeout returns the value of time, in milliseconds, to trigger a false Microphone.onActivity event.

Microphone.useEchoSuppression returns a Boolean value indicating the status of the echo suppression filter.

Microphone Events

Microphone.onActivity is invoked when the microphone senses or stops sensing sound in the microphone range. This event can be controlled using Microphone.setSilenceLevel .

Microphone.onStatus is invoked when the status of the microphone changes. The status changes only if the user denies microphone access in the Flash player's Privacy panel. This event will receive a Microphone Information object detailed in Appendix C.



Macromedia Flash Communication Server MX
Macromedia Flash Communication Server MX
ISBN: 0735713332
EAN: 2147483647
Year: 2002
Pages: 200
Authors: Kevin Towes

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net