Return to Snippet

Revision: 16169
at July 28, 2009 05:04 by sidneydekoning


Updated Code
// To also get the setting box here you can choose the Mic settings and choose a Mic, use :
// Security.showSettings(SecurityPanel.MICROPHONE);

var deviceArray:Array = Microphone.names;
trace("Available sound input devices:");
for (var i:int = 0; i < deviceArray.length; i++) {
	trace(" " + deviceArray[i]);
}

var mic:Microphone = Microphone.getMicrophone();
mic.gain = 60;
mic.rate = 11;
mic.setUseEchoSuppression(true);
mic.setLoopBack(true);
mic.setSilenceLevel(5, 1000);

mic.addEventListener(ActivityEvent.ACTIVITY, this.onMicActivity);
mic.addEventListener(StatusEvent.STATUS, this.onMicStatus);

var micDetails:String = "Sound input device name: " + mic.name + '\n';
micDetails += "Gain: " + mic.gain + '\n';
micDetails += "Rate: " + mic.rate + " kHz" + '\n';
micDetails += "Muted: " + mic.muted + '\n';
micDetails += "Silence level: " + mic.silenceLevel + '\n';
micDetails += "Silence timeout: " + mic.silenceTimeout + '\n';
micDetails += "Echo suppression: " + mic.useEchoSuppression + '\n';

function onMicActivity(evt:ActivityEvent):void {
	trace("activating=" + evt.activating + ", activityLevel=" + mic.activityLevel);
}

function onMicStatus(evt:StatusEvent):void {
	trace("status: level=" + evt.level + ", code=" + evt.code);
}

Revision: 16168
at July 28, 2009 05:01 by sidneydekoning


Initial Code
var deviceArray:Array = Microphone.names;
trace("Available sound input devices:");
for (var i:int = 0; i < deviceArray.length; i++) {
	trace(" " + deviceArray[i]);
}

var mic:Microphone = Microphone.getMicrophone();
mic.gain = 60;
mic.rate = 11;
mic.setUseEchoSuppression(true);
mic.setLoopBack(true);
mic.setSilenceLevel(5, 1000);

mic.addEventListener(ActivityEvent.ACTIVITY, this.onMicActivity);
mic.addEventListener(StatusEvent.STATUS, this.onMicStatus);

var micDetails:String = "Sound input device name: " + mic.name + '\n';
micDetails += "Gain: " + mic.gain + '\n';
micDetails += "Rate: " + mic.rate + " kHz" + '\n';
micDetails += "Muted: " + mic.muted + '\n';
micDetails += "Silence level: " + mic.silenceLevel + '\n';
micDetails += "Silence timeout: " + mic.silenceTimeout + '\n';
micDetails += "Echo suppression: " + mic.useEchoSuppression + '\n';

function onMicActivity(evt:ActivityEvent):void {
	trace("activating=" + evt.activating + ", activityLevel=" + mic.activityLevel);
}

function onMicStatus(evt:StatusEvent):void {
	trace("status: level=" + evt.level + ", code=" + evt.code);
}

Initial URL

                                

Initial Description

                                

Initial Title
Using the Microphone in AS3

Initial Tags

                                

Initial Language
ActionScript 3