ActionScript® 3.0 Reference for the Adobe® Flash® Platform
Home  |  Hide Packages and Classes List |  Packages  |  Classes  |  What's New  |  Index  |  Appendixes

Language Reference only
Filters: AIR 32.0 and earlier, Flash Player 32.0 and earlier, Flash Lite 4
Flex 4.6 and earlier, Flash Pro CS6 and earlier
Hide Filters
flash.media 

Microphone  - AS3

Packagesx

Top Level
adobe.utils
air.desktop
air.net
air.update
air.update.events
coldfusion.air
coldfusion.air.errors
coldfusion.air.events
coldfusion.service
coldfusion.service.events
coldfusion.service.mxml
com.adobe.acm.solutions.authoring.domain.extensions
com.adobe.acm.solutions.ccr.domain.extensions
com.adobe.consulting.pst.vo
com.adobe.dct.component
com.adobe.dct.component.datadictionary
com.adobe.dct.component.datadictionaryElement
com.adobe.dct.component.dataElementsPanel
com.adobe.dct.component.toolbars
com.adobe.dct.event
com.adobe.dct.exp
com.adobe.dct.model
com.adobe.dct.service
com.adobe.dct.service.provider
com.adobe.dct.transfer
com.adobe.dct.util
com.adobe.dct.view
com.adobe.ep.taskmanagement.domain
com.adobe.ep.taskmanagement.event
com.adobe.ep.taskmanagement.filter
com.adobe.ep.taskmanagement.services
com.adobe.ep.taskmanagement.util
com.adobe.ep.ux.attachmentlist.component
com.adobe.ep.ux.attachmentlist.domain
com.adobe.ep.ux.attachmentlist.domain.events
com.adobe.ep.ux.attachmentlist.domain.renderers
com.adobe.ep.ux.attachmentlist.skin
com.adobe.ep.ux.attachmentlist.skin.renderers
com.adobe.ep.ux.content.event
com.adobe.ep.ux.content.factory
com.adobe.ep.ux.content.handlers
com.adobe.ep.ux.content.managers
com.adobe.ep.ux.content.model.asset
com.adobe.ep.ux.content.model.preview
com.adobe.ep.ux.content.model.relation
com.adobe.ep.ux.content.model.search
com.adobe.ep.ux.content.model.toolbar
com.adobe.ep.ux.content.search
com.adobe.ep.ux.content.services
com.adobe.ep.ux.content.services.load
com.adobe.ep.ux.content.services.permissions
com.adobe.ep.ux.content.services.preview
com.adobe.ep.ux.content.services.providers
com.adobe.ep.ux.content.services.query
com.adobe.ep.ux.content.services.relationships
com.adobe.ep.ux.content.services.search.lccontent
com.adobe.ep.ux.content.services.version
com.adobe.ep.ux.content.view
com.adobe.ep.ux.content.view.components.activate
com.adobe.ep.ux.content.view.components.grid
com.adobe.ep.ux.content.view.components.grid.hover
com.adobe.ep.ux.content.view.components.grid.hover.component
com.adobe.ep.ux.content.view.components.grid.renderers
com.adobe.ep.ux.content.view.components.relationships
com.adobe.ep.ux.content.view.components.review
com.adobe.ep.ux.content.view.components.search.renderers
com.adobe.ep.ux.content.view.components.searchpod
com.adobe.ep.ux.content.view.components.toolbar
com.adobe.ep.ux.content.view.components.toolbar.controlRenderers
com.adobe.ep.ux.content.view.components.version
com.adobe.ep.ux.documentsubmit.component
com.adobe.ep.ux.documentsubmit.domain
com.adobe.ep.ux.documentsubmit.skin
com.adobe.ep.ux.taskaction.component
com.adobe.ep.ux.taskaction.domain
com.adobe.ep.ux.taskaction.domain.events
com.adobe.ep.ux.taskaction.skin
com.adobe.ep.ux.taskdetails.component
com.adobe.ep.ux.taskdetails.domain
com.adobe.ep.ux.taskdetails.skin
com.adobe.ep.ux.tasklist.component
com.adobe.ep.ux.tasklist.domain
com.adobe.ep.ux.tasklist.skin
com.adobe.ep.ux.webdocumentviewer.domain
com.adobe.exm.expression
com.adobe.exm.expression.error
com.adobe.exm.expression.event
com.adobe.exm.expression.impl
com.adobe.fiber.runtime.lib
com.adobe.fiber.services
com.adobe.fiber.services.wrapper
com.adobe.fiber.styles
com.adobe.fiber.util
com.adobe.fiber.valueobjects
com.adobe.gravity.binding
com.adobe.gravity.context
com.adobe.gravity.flex.bundleloader
com.adobe.gravity.flex.progress
com.adobe.gravity.flex.serviceloader
com.adobe.gravity.framework
com.adobe.gravity.init
com.adobe.gravity.service.bundleloader
com.adobe.gravity.service.logging
com.adobe.gravity.service.manifest
com.adobe.gravity.service.progress
com.adobe.gravity.tracker
com.adobe.gravity.ui
com.adobe.gravity.utility
com.adobe.gravity.utility.async
com.adobe.gravity.utility.error
com.adobe.gravity.utility.events
com.adobe.gravity.utility.factory
com.adobe.gravity.utility.flex.async
com.adobe.gravity.utility.logging
com.adobe.gravity.utility.message
com.adobe.gravity.utility.sequence
com.adobe.gravity.utility.url
com.adobe.guides.control
com.adobe.guides.domain
com.adobe.guides.i18n
com.adobe.guides.spark.components.skins
com.adobe.guides.spark.components.skins.mx
com.adobe.guides.spark.headers.components
com.adobe.guides.spark.headers.skins
com.adobe.guides.spark.layouts.components
com.adobe.guides.spark.layouts.skins
com.adobe.guides.spark.navigators.components
com.adobe.guides.spark.navigators.renderers
com.adobe.guides.spark.navigators.skins
com.adobe.guides.spark.util
com.adobe.guides.spark.wrappers.components
com.adobe.guides.spark.wrappers.skins
com.adobe.guides.submit
com.adobe.icc.dc.domain
com.adobe.icc.dc.domain.factory
com.adobe.icc.editors.events
com.adobe.icc.editors.handlers
com.adobe.icc.editors.managers
com.adobe.icc.editors.model
com.adobe.icc.editors.model.config
com.adobe.icc.editors.model.el
com.adobe.icc.editors.model.el.operands
com.adobe.icc.editors.model.el.operators
com.adobe.icc.enum
com.adobe.icc.external.dc
com.adobe.icc.obj
com.adobe.icc.services
com.adobe.icc.services.category
com.adobe.icc.services.config
com.adobe.icc.services.download
com.adobe.icc.services.export
com.adobe.icc.services.external
com.adobe.icc.services.formbridge
com.adobe.icc.services.fragmentlayout
com.adobe.icc.services.layout
com.adobe.icc.services.letter
com.adobe.icc.services.locator
com.adobe.icc.services.module
com.adobe.icc.services.render
com.adobe.icc.services.submit
com.adobe.icc.services.user
com.adobe.icc.token
com.adobe.icc.vo
com.adobe.icc.vo.render
com.adobe.icomm.assetplacement.controller
com.adobe.icomm.assetplacement.controller.utils
com.adobe.icomm.assetplacement.data
com.adobe.icomm.assetplacement.model
com.adobe.livecycle.assetmanager.client
com.adobe.livecycle.assetmanager.client.event
com.adobe.livecycle.assetmanager.client.handler
com.adobe.livecycle.assetmanager.client.managers
com.adobe.livecycle.assetmanager.client.model
com.adobe.livecycle.assetmanager.client.model.cms
com.adobe.livecycle.assetmanager.client.service
com.adobe.livecycle.assetmanager.client.service.search
com.adobe.livecycle.assetmanager.client.service.search.cms
com.adobe.livecycle.assetmanager.client.utils
com.adobe.livecycle.content
com.adobe.livecycle.rca.model
com.adobe.livecycle.rca.model.constant
com.adobe.livecycle.rca.model.document
com.adobe.livecycle.rca.model.participant
com.adobe.livecycle.rca.model.reminder
com.adobe.livecycle.rca.model.stage
com.adobe.livecycle.rca.service
com.adobe.livecycle.rca.service.core
com.adobe.livecycle.rca.service.core.delegate
com.adobe.livecycle.rca.service.process
com.adobe.livecycle.rca.service.process.delegate
com.adobe.livecycle.rca.token
com.adobe.livecycle.ria.security.api
com.adobe.livecycle.ria.security.service
com.adobe.mosaic.layouts
com.adobe.mosaic.layouts.dragAndDrop
com.adobe.mosaic.layouts.interfaces
com.adobe.mosaic.mxml
com.adobe.mosaic.om.constants
com.adobe.mosaic.om.events
com.adobe.mosaic.om.impl
com.adobe.mosaic.om.interfaces
com.adobe.mosaic.skinning
com.adobe.mosaic.sparklib.editors
com.adobe.mosaic.sparklib.optionMenu
com.adobe.mosaic.sparklib.scrollableMenu
com.adobe.mosaic.sparklib.scrollableMenu.skins
com.adobe.mosaic.sparklib.tabLayout
com.adobe.mosaic.sparklib.tabLayout.events
com.adobe.mosaic.sparklib.tabLayout.layouts
com.adobe.mosaic.sparklib.tabLayout.skins
com.adobe.mosaic.sparklib.text
com.adobe.mosaic.sparklib.util
com.adobe.solutions.acm.authoring.presentation
com.adobe.solutions.acm.authoring.presentation.actionbar
com.adobe.solutions.acm.authoring.presentation.common
com.adobe.solutions.acm.authoring.presentation.events
com.adobe.solutions.acm.authoring.presentation.fragment
com.adobe.solutions.acm.authoring.presentation.letter
com.adobe.solutions.acm.authoring.presentation.letter.data
com.adobe.solutions.acm.authoring.presentation.preview
com.adobe.solutions.acm.authoring.presentation.rte
com.adobe.solutions.acm.ccr.presentation
com.adobe.solutions.acm.ccr.presentation.contentcapture
com.adobe.solutions.acm.ccr.presentation.contentcapture.events
com.adobe.solutions.acm.ccr.presentation.contentcapture.preview
com.adobe.solutions.acm.ccr.presentation.datacapture
com.adobe.solutions.acm.ccr.presentation.datacapture.renderers
com.adobe.solutions.acm.ccr.presentation.pdf
com.adobe.solutions.exm
com.adobe.solutions.exm.authoring
com.adobe.solutions.exm.authoring.components.controls
com.adobe.solutions.exm.authoring.components.toolbars
com.adobe.solutions.exm.authoring.domain
com.adobe.solutions.exm.authoring.domain.expression
com.adobe.solutions.exm.authoring.domain.impl
com.adobe.solutions.exm.authoring.domain.method
com.adobe.solutions.exm.authoring.domain.variable
com.adobe.solutions.exm.authoring.enum
com.adobe.solutions.exm.authoring.events
com.adobe.solutions.exm.authoring.model
com.adobe.solutions.exm.authoring.renderer
com.adobe.solutions.exm.authoring.view
com.adobe.solutions.exm.expression
com.adobe.solutions.exm.impl
com.adobe.solutions.exm.impl.method
com.adobe.solutions.exm.method
com.adobe.solutions.exm.mock
com.adobe.solutions.exm.mock.method
com.adobe.solutions.exm.runtime
com.adobe.solutions.exm.runtime.impl
com.adobe.solutions.exm.variable
com.adobe.solutions.prm.constant
com.adobe.solutions.prm.domain
com.adobe.solutions.prm.domain.factory
com.adobe.solutions.prm.domain.impl
com.adobe.solutions.prm.domain.manager
com.adobe.solutions.prm.presentation.asset
com.adobe.solutions.prm.presentation.constant
com.adobe.solutions.prm.presentation.document
com.adobe.solutions.prm.presentation.event
com.adobe.solutions.prm.presentation.file
com.adobe.solutions.prm.presentation.project
com.adobe.solutions.prm.presentation.team
com.adobe.solutions.prm.presentation.util
com.adobe.solutions.prm.service
com.adobe.solutions.prm.services.impl
com.adobe.solutions.prm.vo
com.adobe.solutions.rca.constant
com.adobe.solutions.rca.domain
com.adobe.solutions.rca.domain.common
com.adobe.solutions.rca.domain.factory
com.adobe.solutions.rca.domain.impl
com.adobe.solutions.rca.domain.impl.manager
com.adobe.solutions.rca.domain.manager
com.adobe.solutions.rca.presentation
com.adobe.solutions.rca.presentation.comment
com.adobe.solutions.rca.presentation.constant
com.adobe.solutions.rca.presentation.event
com.adobe.solutions.rca.presentation.gantt
com.adobe.solutions.rca.presentation.gantt.ruler
com.adobe.solutions.rca.presentation.template
com.adobe.solutions.rca.presentation.template.audit
com.adobe.solutions.rca.presentation.template.definition
com.adobe.solutions.rca.presentation.template.documents
com.adobe.solutions.rca.presentation.template.stages
com.adobe.solutions.rca.presentation.util
com.adobe.solutions.rca.service
com.adobe.solutions.rca.services.impl
com.adobe.solutions.rca.vo
com.adobe.solutions.rca.vo.um
com.adobe.viewsource
fl.accessibility
fl.containers
fl.controls
fl.controls.dataGridClasses
fl.controls.listClasses
fl.controls.progressBarClasses
fl.core
fl.data
fl.display
fl.events
fl.ik
fl.lang
fl.livepreview
fl.managers
fl.motion
fl.motion.easing
fl.rsl
fl.text
fl.transitions
fl.transitions.easing
fl.video
flash.accessibility
flash.concurrent
flash.crypto
flash.data
flash.desktop
flash.display
flash.display3D
flash.display3D.textures
flash.errors
flash.events
flash.external
flash.filesystem
flash.filters
flash.geom
flash.globalization
flash.html
flash.media
flash.net
flash.net.dns
flash.net.drm
flash.notifications
flash.permissions
flash.printing
flash.profiler
flash.sampler
flash.security
flash.sensors
flash.system
flash.text
flash.text.engine
flash.text.ime
flash.ui
flash.utils
flash.xml
flashx.textLayout
flashx.textLayout.compose
flashx.textLayout.container
flashx.textLayout.conversion
flashx.textLayout.edit
flashx.textLayout.elements
flashx.textLayout.events
flashx.textLayout.factory
flashx.textLayout.formats
flashx.textLayout.operations
flashx.textLayout.utils
flashx.undo
ga.controls
ga.layouts
ga.model
ga.uiComponents
ga.util
ga.views
ga.wrappers
lc.foundation
lc.foundation.domain
lc.foundation.events
lc.foundation.ui
lc.foundation.util
lc.preloader
lc.procmgmt
lc.procmgmt.commands
lc.procmgmt.domain
lc.procmgmt.events
lc.procmgmt.formbridge
lc.procmgmt.impl
lc.procmgmt.ui.attachments
lc.procmgmt.ui.controls
lc.procmgmt.ui.controls.card
lc.procmgmt.ui.controls.renderer
lc.procmgmt.ui.help
lc.procmgmt.ui.layout
lc.procmgmt.ui.presentationmodel
lc.procmgmt.ui.process
lc.procmgmt.ui.search
lc.procmgmt.ui.startpoint
lc.procmgmt.ui.task
lc.procmgmt.ui.task.form
lc.procmgmt.ui.task.form.commands
lc.procmgmt.ui.tracking
mx.accessibility
mx.automation
mx.automation.air
mx.automation.delegates
mx.automation.delegates.advancedDataGrid
mx.automation.delegates.charts
mx.automation.delegates.containers
mx.automation.delegates.controls
mx.automation.delegates.controls.dataGridClasses
mx.automation.delegates.controls.fileSystemClasses
mx.automation.delegates.core
mx.automation.delegates.flashflexkit
mx.automation.events
mx.binding
mx.binding.utils
mx.charts
mx.charts.chartClasses
mx.charts.effects
mx.charts.effects.effectClasses
mx.charts.events
mx.charts.renderers
mx.charts.series
mx.charts.series.items
mx.charts.series.renderData
mx.charts.styles
mx.collections
mx.collections.errors
mx.containers
mx.containers.accordionClasses
mx.containers.dividedBoxClasses
mx.containers.errors
mx.containers.utilityClasses
mx.controls
mx.controls.advancedDataGridClasses
mx.controls.dataGridClasses
mx.controls.listClasses
mx.controls.menuClasses
mx.controls.olapDataGridClasses
mx.controls.scrollClasses
mx.controls.sliderClasses
mx.controls.textClasses
mx.controls.treeClasses
mx.controls.videoClasses
mx.core
mx.core.windowClasses
mx.data
mx.data.crypto
mx.data.errors
mx.data.events
mx.data.messages
mx.data.mxml
mx.data.offline.errors
mx.data.utils
mx.effects
mx.effects.easing
mx.effects.effectClasses
mx.events
mx.filters
mx.flash
mx.formatters
mx.geom
mx.graphics
mx.graphics.codec
mx.graphics.shaderClasses
mx.logging
mx.logging.errors
mx.logging.targets
mx.managers
mx.messaging
mx.messaging.channels
mx.messaging.config
mx.messaging.errors
mx.messaging.events
mx.messaging.management
mx.messaging.messages
mx.modules
mx.netmon
mx.olap
mx.olap.aggregators
mx.preloaders
mx.printing
mx.resources
mx.rpc
mx.rpc.events
mx.rpc.http
mx.rpc.http.mxml
mx.rpc.livecycle
mx.rpc.mxml
mx.rpc.remoting
mx.rpc.remoting.mxml
mx.rpc.soap
mx.rpc.soap.mxml
mx.rpc.wsdl
mx.rpc.xml
mx.skins
mx.skins.halo
mx.skins.spark
mx.skins.wireframe
mx.skins.wireframe.windowChrome
mx.states
mx.styles
mx.utils
mx.validators
org.osmf.containers
org.osmf.display
org.osmf.elements
org.osmf.events
org.osmf.layout
org.osmf.logging
org.osmf.media
org.osmf.metadata
org.osmf.net
org.osmf.net.dvr
org.osmf.net.httpstreaming
org.osmf.net.metrics
org.osmf.net.qos
org.osmf.net.rtmpstreaming
org.osmf.net.rules
org.osmf.traits
org.osmf.utils
spark.accessibility
spark.automation.delegates
spark.automation.delegates.components
spark.automation.delegates.components.gridClasses
spark.automation.delegates.components.mediaClasses
spark.automation.delegates.components.supportClasses
spark.automation.delegates.skins.spark
spark.automation.events
spark.collections
spark.components
spark.components.calendarClasses
spark.components.gridClasses
spark.components.mediaClasses
spark.components.supportClasses
spark.components.windowClasses
spark.core
spark.effects
spark.effects.animation
spark.effects.easing
spark.effects.interpolation
spark.effects.supportClasses
spark.events
spark.filters
spark.formatters
spark.formatters.supportClasses
spark.globalization
spark.globalization.supportClasses
spark.layouts
spark.layouts.supportClasses
spark.managers
spark.modules
spark.preloaders
spark.primitives
spark.primitives.supportClasses
spark.skins
spark.skins.mobile
spark.skins.mobile.supportClasses
spark.skins.spark
spark.skins.spark.mediaClasses.fullScreen
spark.skins.spark.mediaClasses.normal
spark.skins.spark.windowChrome
spark.skins.wireframe
spark.skins.wireframe.mediaClasses
spark.skins.wireframe.mediaClasses.fullScreen
spark.transitions
spark.utils
spark.validators
spark.validators.supportClasses
xd.core.axm.enterprise.view.components
xd.core.axm.enterprise.view.skins
xd.core.axm.view.components
xd.core.axm.view.components.support

Language Elements

Global Constants
Global Functions
Operators
Statements, Keywords & Directives
Special Types

Appendixes

What's New
Compiler Errors
Compiler Warnings
Run-Time Errors
Migrating to ActionScript 3
Supported Character Sets
MXML Only Tags
Motion XML Elements
Timed Text Tags
List of deprecated elements
Accessibility Implementation Constants
How to Use ActionScript Examples
Legal notices
Packageflash.media
Classpublic final class Microphone
InheritanceMicrophone Inheritance EventDispatcher Inheritance Object

Language Version: ActionScript 3.0
Runtime Versions: AIR 1.0, Flash Player 9

Use the Microphone class to monitor or capture audio from a microphone.

To get access to the device microphone, you can use Microphone.getMicrophone() method. However, this method returns a simple microphone, which does not have the ability to eliminate acoustic echo. In order to eliminate acoustic echo, you need to get an instance of microphone using Microphone.getEnhancedMicrophone() method. This method returns a device microphone that has the acoustic echo cancellation feature enabled for mobile. Use acoustic echo cancellation to create real-time audio/video applications that don't require headsets.

Create a real-time chat application

To create a real-time chat application, capture audio and send it to Flash Media Server. Use the NetConnection and NetStream classes to send the audio stream to Flash Media Server. Flash Media Server can broadcast the audio to other clients. To create a chat application that doesn't require headsets, use acoustic echo cancellation. Acoustic echo cancellation prevents the feedback loop that occurs when audio enters a microphone, travels out the speakers, and enters the microphone again. To use acoustic echo cancellation, call the Microphone.getEnhancedMicrophone() method to get a reference to a Microphone instance. Set Microphone.enhancedOptions to an instance of the MicrophoneEnhancedOptions class to configure settings.

Play microphone audio locally

Call the Microphone setLoopback() method to route the microphone audio directly to the local computer or device audio output. Uncontrolled audio feedback is an inherent danger and is likely to occur whenever the audio output can be picked up by the microphone input. The setUseEchoSuppression() method can reduce, but not eliminate, the risk of feedback amplification.

Capture microphone audio for local recording or processing

To capture microphone audio, listen for the sampleData events dispatched by a Microphone instance. The SampleDataEvent object dispatched for this event contains the audio data.

For information about capturing video, see the Camera class.

Runtime microphone support

The Microphone class is not supported in Flash Player running in a mobile browser.

AIR profile support: The Microphone class is supported on desktop operating systems, and iOS and Android mobile devices. It is not supported on AIR for TV devices. See AIR Profile Support for more information regarding API support across multiple profiles.

You can test for support at run time using the Microphone.isSupported property. Note that for AIR for TV devices, Microphone.isSupported is true but Microphone.getMicrophone() always returns null.

Privacy controls

Flash Player displays a Privacy dialog box that lets the user choose whether to allow or deny access to the microphone. Your application window size must be at least 215 x 138 pixels, the minimum size required to display the dialog box, or access is denied automatically.

Content running in the AIR application sandbox does not need permission to access the microphone and no dialog is displayed. AIR content running outside the application sandbox does require permission and the Privacy dialog is displayed.

View the examples

More examples

Learn more

Related API Elements



Public Properties
 PropertyDefined By
  activityLevel : Number
[read-only] The amount of sound the microphone is detecting.
Microphone
  codec : String
The codec to use for compressing audio.
Microphone
 Inheritedconstructor : Object
A reference to the class object or constructor function for a given object instance.
Object
  enableVAD : Boolean
Enable Speex voice activity detection.
Microphone
  encodeQuality : int
The encoded speech quality when using the Speex codec.
Microphone
  enhancedOptions : MicrophoneEnhancedOptions
Controls enhanced microphone options.
Microphone
  framesPerPacket : int
Number of Speex speech frames transmitted in a packet (message).
Microphone
  gain : Number
The amount by which the microphone boosts the signal.
Microphone
  index : int
[read-only] The index of the microphone, as reflected in the array returned by Microphone.names.
Microphone
  isSupported : Boolean
[static] [read-only] The isSupported property is set to true if the Microphone class is supported on the current platform, otherwise it is set to false.
Microphone
  muted : Boolean
[read-only] Specifies whether the user has denied access to the microphone (true) or allowed access (false).
Microphone
  name : String
[read-only] The name of the current sound capture device, as returned by the sound capture hardware.
Microphone
  names : Array
[static] [read-only] An array of strings containing the names of all available sound capture devices.
Microphone
  noiseSuppressionLevel : int
Maximum attenuation of the noise in dB (negative number) used for Speex encoder.
Microphone
      permissionStatus : String
[static] [read-only] Determine whether the application has been granted the permission to use Microphone.
Microphone
  rate : int
The rate at which the microphone is capturing sound, in kHz.
Microphone
  silenceLevel : Number
[read-only] The amount of sound required to activate the microphone and dispatch the activity event.
Microphone
  silenceTimeout : int
[read-only] The number of milliseconds between the time the microphone stops detecting sound and the time the activity event is dispatched.
Microphone
  soundTransform : flash.media:SoundTransform
Controls the sound of this microphone object when it is in loopback mode.
Microphone
  useEchoSuppression : Boolean
[read-only] Set to true if echo suppression is enabled; false otherwise.
Microphone
Public Methods
 MethodDefined By
 Inherited
addEventListener(type:String, listener:Function, useCapture:Boolean = false, priority:int = 0, useWeakReference:Boolean = false):void
Registers an event listener object with an EventDispatcher object so that the listener receives notification of an event.
EventDispatcher
 Inherited
Dispatches an event into the event flow.
EventDispatcher
  
[static] Returns a reference to an enhanced Microphone object that can perform acoustic echo cancellation.
Microphone
  
[static] Returns a reference to a Microphone object for capturing audio.
Microphone
 Inherited
Checks whether the EventDispatcher object has any listeners registered for a specific type of event.
EventDispatcher
 Inherited
Indicates whether an object has a specified property defined.
Object
 Inherited
Indicates whether an instance of the Object class is in the prototype chain of the object specified as the parameter.
Object
 Inherited
Indicates whether the specified property exists and is enumerable.
Object
 Inherited
removeEventListener(type:String, listener:Function, useCapture:Boolean = false):void
Removes a listener from the EventDispatcher object.
EventDispatcher
  
Requests Microphone permission for the application.
Microphone
  
setLoopBack(state:Boolean = true):void
Routes audio captured by a microphone to the local speakers.
Microphone
 Inherited
Sets the availability of a dynamic property for loop operations.
Object
  
setSilenceLevel(silenceLevel:Number, timeout:int = -1):void
Sets the minimum input level that should be considered sound and (optionally) the amount of silent time signifying that silence has actually begun.
Microphone
  
setUseEchoSuppression(useEchoSuppression:Boolean):void
Specifies whether to use the echo suppression feature of the audio codec.
Microphone
 Inherited
Returns the string representation of this object, formatted according to locale-specific conventions.
Object
 Inherited
Returns the string representation of the specified object.
Object
 Inherited
Returns the primitive value of the specified object.
Object
 Inherited
Checks whether an event listener is registered with this EventDispatcher object or any of its ancestors for the specified event type.
EventDispatcher
Events
 Event Summary Defined By
 Inherited[broadcast event] Dispatched when the Flash Player or AIR application gains operating system focus and becomes active.EventDispatcher
 Inherited[broadcast event] Dispatched when the Flash Player or AIR application operating loses system focus and is becoming inactive.EventDispatcher
Property Detail

activityLevel

property
activityLevel:Number  [read-only]

Language Version: ActionScript 3.0
Runtime Versions: AIR 1.0, Flash Player 9

The amount of sound the microphone is detecting. Values range from 0 (no sound is detected) to 100 (very loud sound is detected). The value of this property can help you determine a good value to pass to the Microphone.setSilenceLevel() method.

If the microphone muted property is true, the value of this property is always -1.



Implementation
    public function get activityLevel():Number

Throws
PermissionError — The application does not have permission to use Microphone.

Related API Elements

codec

property 
codec:String

Language Version: ActionScript 3.0
Runtime Versions: Flash Player 10, AIR 1.5

The codec to use for compressing audio. Available codecs are Nellymoser (the default) and Speex. The enumeration class SoundCodec contains the various values that are valid for the codec property.

If you use the Nellymoser codec, you can set the sample rate using Microphone.rate(). If you use the Speex codec, the sample rate is set to 16 kHz.

Speex includes voice activity detection (VAD) and automatically reduces bandwidth when no voice is detected. When using the Speex codec, Adobe recommends that you set the silence level to 0. To set the silence level, use the Microphone.setSilenceLevel() method.



Implementation
    public function get codec():String
    public function set codec(value:String):void

Throws
PermissionError — The application does not have permission to use Microphone.

Related API Elements

enableVAD

property 
enableVAD:Boolean

Language Version: ActionScript 3.0
Runtime Versions: Flash Player 10.1, AIR 2

Enable Speex voice activity detection.



Implementation
    public function get enableVAD():Boolean
    public function set enableVAD(value:Boolean):void

Throws
PermissionError — The application does not have permission to use Microphone.

encodeQuality

property 
encodeQuality:int

Language Version: ActionScript 3.0
Runtime Versions: Flash Player 10, AIR 1.5

The encoded speech quality when using the Speex codec. Possible values are from 0 to 10. The default value is 6. Higher numbers represent higher quality but require more bandwidth, as shown in the following table. The bit rate values that are listed represent net bit rates and do not include packetization overhead.

Quality valueRequired bit rate (kilobits per second)
0 3.95
15.75
27.75
39.80
412.8
516.8
620.6
723.8
827.8
934.2
1042.2



Implementation
    public function get encodeQuality():int
    public function set encodeQuality(value:int):void

Throws
PermissionError — The application does not have permission to use Microphone.

Related API Elements

enhancedOptions

property 
enhancedOptions:MicrophoneEnhancedOptions

Language Version: ActionScript 3.0
Runtime Versions: Flash Player 10.3, AIR 2.7

Controls enhanced microphone options. For more information, see MicrophoneEnhancedOptions class. This property is ignored for non-enhanced Microphone instances.



Implementation
    public function get enhancedOptions():MicrophoneEnhancedOptions
    public function set enhancedOptions(value:MicrophoneEnhancedOptions):void

Throws
PermissionError — The application does not have permission to use Microphone.

Related API Elements

framesPerPacket

property 
framesPerPacket:int

Language Version: ActionScript 3.0
Runtime Versions: Flash Player 10, AIR 1.5

Number of Speex speech frames transmitted in a packet (message). Each frame is 20 ms long. The default value is two frames per packet.

The more Speex frames in a message, the lower the bandwidth required but the longer the delay in sending the message. Fewer Speex frames increases bandwidth required but reduces delay.



Implementation
    public function get framesPerPacket():int
    public function set framesPerPacket(value:int):void

gain

property 
gain:Number

Language Version: ActionScript 3.0
Runtime Versions: AIR 1.0, Flash Player 9

The amount by which the microphone boosts the signal. Valid values are 0 to 100. The default value is 50.



Implementation
    public function get gain():Number
    public function set gain(value:Number):void

Throws
PermissionError — The application does not have permission to use Microphone.

Related API Elements

index

property 
index:int  [read-only]

Language Version: ActionScript 3.0
Runtime Versions: AIR 1.0, Flash Player 9

The index of the microphone, as reflected in the array returned by Microphone.names.



Implementation
    public function get index():int

Throws
PermissionError — The application does not have permission to use Microphone.

Related API Elements

isSupported

property 
isSupported:Boolean  [read-only]

Language Version: ActionScript 3.0
Runtime Versions: Flash Player 10.1, AIR 2

The isSupported property is set to true if the Microphone class is supported on the current platform, otherwise it is set to false.



Implementation
    public static function get isSupported():Boolean

muted

property 
muted:Boolean  [read-only]

Language Version: ActionScript 3.0
Runtime Versions: AIR 1.0, Flash Player 9

Specifies whether the user has denied access to the microphone (true) or allowed access (false). When this value changes, a status event is dispatched. For more information, see Microphone.getMicrophone().



Implementation
    public function get muted():Boolean

Throws
PermissionError — The application does not have permission to use Microphone.

Related API Elements

name

property 
name:String  [read-only]

Language Version: ActionScript 3.0
Runtime Versions: AIR 1.0, Flash Player 9

The name of the current sound capture device, as returned by the sound capture hardware.



Implementation
    public function get name():String

Related API Elements

names

property 
names:Array  [read-only]

Language Version: ActionScript 3.0
Runtime Versions: AIR 1.0, Flash Player 9

An array of strings containing the names of all available sound capture devices. The names are returned without having to display the Flash Player Privacy Settings panel to the user. This array provides the zero-based index of each sound capture device and the number of sound capture devices on the system, through the Microphone.names.length property. For more information, see the Array class entry.

Calling Microphone.names requires an extensive examination of the hardware, and it may take several seconds to build the array. In most cases, you can just use the default microphone.

Note: To determine the name of the current microphone, use the name property.



Implementation
    public static function get names():Array

Related API Elements

noiseSuppressionLevel

property 
noiseSuppressionLevel:int

Language Version: ActionScript 3.0
Runtime Versions: Flash Player 10.1, AIR 2

Maximum attenuation of the noise in dB (negative number) used for Speex encoder. If enabled, noise suppression is applied to sound captured from Microphone before Speex compression. Set to 0 to disable noise suppression. Noise suppression is enabled by default with maximum attenuation of -30 dB. Ignored when Nellymoser codec is selected.



Implementation
    public function get noiseSuppressionLevel():int
    public function set noiseSuppressionLevel(value:int):void

Throws
PermissionError — The application does not have permission to use Microphone.
    

permissionStatus

property 
permissionStatus:String  [read-only]

Language Version: ActionScript 3.0
Runtime Versions: AIR 24.0

Determine whether the application has been granted the permission to use Microphone.



Implementation
    public static function get permissionStatus():String

Related API Elements

rate

property 
rate:int

Language Version: ActionScript 3.0
Runtime Versions: AIR 1.0, Flash Player 9

The rate at which the microphone is capturing sound, in kHz. Acceptable values are 5, 8, 11, 22, and 44. The default value is 8 kHz if your sound capture device supports this value. Otherwise, the default value is the next available capture level above 8 kHz that your sound capture device supports, usually 11 kHz.

Note: The actual rate differs slightly from the rate value, as noted in the following table:

rate valueActual frequency
4444,100 Hz
2222,050 Hz
1111,025 Hz
88,000 Hz
55,512 Hz



Implementation
    public function get rate():int
    public function set rate(value:int):void

Throws
PermissionError — The application does not have permission to use Microphone.

Related API Elements

silenceLevel

property 
silenceLevel:Number  [read-only]

Language Version: ActionScript 3.0
Runtime Versions: AIR 1.0, Flash Player 9

The amount of sound required to activate the microphone and dispatch the activity event. The default value is 10.



Implementation
    public function get silenceLevel():Number

Throws
PermissionError — The application does not have permission to use Microphone.

Related API Elements

silenceTimeout

property 
silenceTimeout:int  [read-only]

Language Version: ActionScript 3.0
Runtime Versions: AIR 1.0, Flash Player 9

The number of milliseconds between the time the microphone stops detecting sound and the time the activity event is dispatched. The default value is 2000 (2 seconds).

To set this value, use the Microphone.setSilenceLevel() method.



Implementation
    public function get silenceTimeout():int

Throws
PermissionError — The application does not have permission to use Microphone.

Related API Elements

soundTransform

property 
soundTransform:flash.media:SoundTransform

Language Version: ActionScript 3.0
Runtime Versions: AIR 1.0, Flash Player 9

Controls the sound of this microphone object when it is in loopback mode.



Implementation
    public function get soundTransform():flash.media:SoundTransform
    public function set soundTransform(value:flash.media:SoundTransform):void

Throws
PermissionError — The application does not have permission to use Microphone.

useEchoSuppression

property 
useEchoSuppression:Boolean  [read-only]

Language Version: ActionScript 3.0
Runtime Versions: AIR 1.0, Flash Player 9

Set to true if echo suppression is enabled; false otherwise. The default value is false unless the user has selected Reduce Echo in the Flash Player Microphone Settings panel.



Implementation
    public function get useEchoSuppression():Boolean

Related API Elements

Method Detail

getEnhancedMicrophone

()method
public static function getEnhancedMicrophone(index:int = -1):Microphone

Language Version: ActionScript 3.0
Runtime Versions: Flash Player 10.3, AIR 2.7

Returns a reference to an enhanced Microphone object that can perform acoustic echo cancellation. Use acoustic echo cancellation to create audio/video chat applications that don't require headsets.

The index parameter for the Microphone.getEnhancedMicrophone() method and the Microphone.getMicrophone() method work the same way.

To use this method on Android, add MODIFY_AUDIO_SETTINGS permission under Android manifest additions in the application descriptor.

Important: At any given time you can have only a single instance of enhanced microphone device. All other Microphone instances stop providing audio data and receive a StatusEvent with the code property Microphone.Unavailable. When enhanced audio fails to initialize, calls to this method return null, setting a value for Microphone.enhancedOptions has no effect, and all existing Microphone instances function as before.

To configure an enhanced Microphone object, set the Microphone.enhancedOptions property. The following code uses an enhanced Microphone object and full-duplex acoustic echo cancellation in a local test:

	     var mic:Microphone = Microphone.getEnhancedMicrophone();
	     var options:MicrophoneEnhancedOptions = new MicrophoneEnhancedOptions();
	     options.mode = MicrophoneEnhancedMode.FULL_DUPLEX;
	     mic.enhancedOptions = options;
	     mic.setLoopBack(true);
	 

The setUseEchoSuppression() method is ignored when using acoustic echo cancellation.

When a SWF file tries to access the object returned by Microphone.getEnhancedMicrophone() —for example, when you call NetStream.attachAudio()— 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 Player requires to display the dialog box.)

Parameters

index:int (default = -1) — The index value of the microphone.

Returns
Microphone — A reference to a Microphone object for capturing audio. If enhanced audio fails to initialize, returns null.

Related API Elements

getMicrophone

()method 
public static function getMicrophone(index:int = -1):Microphone

Language Version: ActionScript 3.0
Runtime Versions: AIR 1.0, Flash Player 9

Returns a reference to a Microphone object for capturing audio. To begin capturing the audio, you must attach the Microphone object to a NetStream object (see NetStream.attachAudio()).

Multiple calls to Microphone.getMicrophone() reference the same microphone. Thus, if your code contains the lines mic1 = Microphone.getMicrophone() and mic2 = Microphone.getMicrophone() , both mic1 and mic2 reference the same (default) microphone.

In general, you should not pass a value for index. Simply call air.Microphone.getMicrophone() to return a reference to the default microphone. Using the Microphone Settings section in the Flash Player settings panel, the user can specify the default microphone the application should use. (The user access the Flash Player settings panel by right-clicking Flash Player content running in a web browser.) If you pass a value for index, you can reference a microphone other than the one the user chooses. You can use index in rare cases—for example, if your application is capturing audio from two microphones at the same time. Content running in Adobe AIR also uses the Flash Player setting for the default microphone.

Use the Microphone.index property to get the index value of the current Microphone object. You can then pass this value to other methods of the Microphone class.

When a SWF file tries to access the object returned by Microphone.getMicrophone() —for example, when you call NetStream.attachAudio()— 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 Player requires to display the dialog box.)

When the user responds to this dialog box, a status event is dispatched that indicates the user's response. You can also check the Microphone.muted property to determine if the user has allowed or denied access to the microphone.

If Microphone.getMicrophone() returns null, either the microphone is in use by another application, or there are no microphones installed on the system. To determine whether any microphones are installed, use Microphones.names.length. To display the Flash Player Microphone Settings panel, which lets the user choose the microphone to be referenced by Microphone.getMicrophone, use Security.showSettings().

Parameters

index:int (default = -1) — The index value of the microphone.

Returns
Microphone — A reference to a Microphone object for capturing audio.

Events
status:StatusEvent — Dispatched when a microphone reports its status. If the value of the code property is "Microphone.Muted", the user has refused to allow the SWF file access to the user's microphone. If the value of the code property is "Microphone.Unmuted", the user has allowed the SWF file access to the user's microphone.

Related API Elements


Example  ( How to use this example )

The following example shows how you can request access to the user's microphone using the static Microphone.getMicrophone() method and listening for the status event. Example provided by ActionScriptExamples.com.
var mic:Microphone = Microphone.getMicrophone();
mic.setLoopBack();
mic.addEventListener(StatusEvent.STATUS, mic_status);
 
var tf:TextField = new TextField();
tf.autoSize = TextFieldAutoSize.LEFT;
tf.text = "Detecting microphone...";
addChild(tf);
 
function mic_status(evt:StatusEvent):void {
    tf.text = "Microphone is muted?: " + mic.muted;
    switch (evt.code) {
        case "Microphone.Unmuted":
            tf.appendText("\n" + "Microphone access was allowed.");
            break;
        case "Microphone.Muted":
            tf.appendText("\n" + "Microphone access was denied.");
            break;
    }
}

    requestPermission

()method 
public function requestPermission():void

Language Version: ActionScript 3.0
Runtime Versions: AIR 24.0

Requests Microphone permission for the application.


Events
PermissionStatus:PermissionEvent — dispatched when the requested permission is granted/denied by the user.

setLoopBack

()method 
public function setLoopBack(state:Boolean = true):void

Language Version: ActionScript 3.0
Runtime Versions: AIR 1.0, Flash Player 9

Routes audio captured by a microphone to the local speakers.

Parameters

state:Boolean (default = true)


Throws
PermissionError — The application does not have permission to use Microphone.

setSilenceLevel

()method 
public function setSilenceLevel(silenceLevel:Number, timeout:int = -1):void

Language Version: ActionScript 3.0
Runtime Versions: AIR 1.0, Flash Player 9

Sets the minimum input level that should be considered sound and (optionally) the amount of silent time signifying that silence has actually begun.

  • To prevent the microphone from detecting sound at all, pass a value of 100 for silenceLevel; the activity event is never dispatched.
  • To determine the amount of sound the microphone is currently detecting, use Microphone.activityLevel.

Speex includes voice activity detection (VAD) and automatically reduces bandwidth when no voice is detected. When using the Speex codec, Adobe recommends that you set the silence level to 0.

Activity detection is the ability to detect when audio levels suggest that a person is talking. When someone is not talking, bandwidth can be saved because there is no need to send the associated audio stream. This information can also be used for visual feedback so that users know they (or others) are silent.

Silence values correspond directly to activity values. Complete silence is an activity value of 0. Constant loud noise (as loud as can be registered based on the current gain setting) is an activity value of 100. After gain is appropriately adjusted, your activity value is less than your silence value when you're not talking; when you are talking, the activity value exceeds your silence value.

This method is similar to Camera.setMotionLevel(); both methods are used to specify when the activity event is dispatched. However, these methods have a significantly different impact on publishing streams:

  • Camera.setMotionLevel() is designed to detect motion and does not affect bandwidth usage. Even if a video stream does not detect motion, video is still sent.
  • Microphone.setSilenceLevel() is designed to optimize bandwidth. When an audio stream is considered silent, no audio data is sent. Instead, a single message is sent, indicating that silence has started.

Parameters

silenceLevel:Number — The amount of sound required to activate the microphone and dispatch the activity event. Acceptable values range from 0 to 100.
 
timeout:int (default = -1) — The number of milliseconds that must elapse without activity before Flash Player or Adobe AIR considers sound to have stopped and dispatches the dispatch event. The default value is 2000 (2 seconds). (Note: The default value shown in the signature, -1, is an internal value that indicates to Flash Player or Adobe AIR to use 2000.)


Throws
PermissionError — The application does not have permission to use Microphone.

Related API Elements

setUseEchoSuppression

()method 
public function setUseEchoSuppression(useEchoSuppression:Boolean):void

Language Version: ActionScript 3.0
Runtime Versions: AIR 1.0, Flash Player 9

Specifies whether to use the echo suppression feature of the audio codec. The default value is false unless the user has selected Reduce Echo in the Flash Player Microphone Settings panel.

Echo suppression is an effort to reduce the effects of audio feedback, which is caused when sound going out the speaker is picked up by the microphone on the same system. (This is different from acoustic echo cancellation, which completely removes the feedback. The setUseEchoSuppression() method is ignored when you call the getEnhancedMicrophone() method to use acoustic echo cancellation.)

Generally, echo suppression is advisable when the sound being captured is played through speakers — instead of a headset —. If your SWF file allows users to specify the sound output device, you may want to call Microphone.setUseEchoSuppression(true) if they indicate they are using speakers and will be using the microphone as well.

Users can also adjust these settings in the Flash Player Microphone Settings panel.

Parameters

useEchoSuppression:Boolean — A Boolean value indicating whether to use echo suppression (true) or not (false).


Throws
PermissionError — The application does not have permission to use Microphone.

Related API Elements

MicrophoneExample.as

The following example captures sound using echo suppression from a microphone after the user allows access to their computer's microphone. The Security.showSettings() method displays the Flash Player dialog box, which requests permission to access the user's microphone. The call to setLoopBack(true) reroutes input to the local speaker, so you can hear the sound while you run the example.

Two listeners listen for activity and status events. The activity event is dispatched at the start and end (if any) of the session and is captured by the activityHandler() method, which traces information on the event. The status event is dispatched if the attached microphone object reports any status information; it is captured and traced using the statusHandler() method.

Note: A microphone must be attached to your computer for this example to work correctly.

package {
    import flash.display.Sprite;
    import flash.events.*;
    import flash.media.Microphone;
    import flash.system.Security;

    public class MicrophoneExample extends Sprite {
        public function MicrophoneExample() {
            var mic:Microphone = Microphone.getMicrophone();
            Security.showSettings("2");
            mic.setLoopBack(true);
                    
            if (mic != null) {
                mic.setUseEchoSuppression(true);
                mic.addEventListener(ActivityEvent.ACTIVITY, activityHandler);
                mic.addEventListener(StatusEvent.STATUS, statusHandler);
            }
        }

        private function activityHandler(event:ActivityEvent):void {
            trace("activityHandler: " + event);
        }

        private function statusHandler(event:StatusEvent):void {
            trace("statusHandler: " + event);
        }
    }
}