Import flash.events.ActivityEvent;
Import Flash.media.Microphone;
var devicearray:array = microphone.names;
Name of all available sound capture devices
var mic:microphone = Microphone.getmicrophone ();
Gets the index value of the current microphone
Mic.gain = 60;
Microphone gain-that is, the microphone should amplify the signal in multiples of the signal before transmitting it
Mic.rate = 11;
The frequency at which the microphone captures sound, in units of kHz
Mic.setuseechosuppression (TRUE);
Specifies whether to use the Echo suppression feature of the audio codec
Mic.setloopback (TRUE);
Set the microphone to loopback mode or turn it off
Mic.setsilencelevel (20, 300);
Set the minimum volume input level that can be considered audible, and the length of silence to be experienced before actually muting
Mic.addeventlistener (activityevent.activity, this.onmicactivity);
function Onmicactivity (event:activityevent): void
{
Trace ("activity =" + event.activating + ", activity =" + Mic.activitylevel);
}
if (mic.activitylevel>30) {
Your code
} ********************************************** to prevent echo effects: M.setuseechosuppression (FALSE); Make the Flash program connect to the microphone input signal m = Microphone.get (); Connect audio to the _root so that each object can communicate with ' m '
Attachaudio (m); Preventing the effects of echoes
M.setuseechosuppression (FALSE); Using a sound to control the size of the graph we set, Activitylevel returns a value between 0-100 by the input of the sound.
Onenterframe = function () {
Circle._xscale = Circle._yscale = m.activitylevel+50;
};
Flash Call Microphone