ActionScript 3 在AS3中使用麦克风

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了ActionScript 3 在AS3中使用麦克风相关的知识,希望对你有一定的参考价值。

// 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);
}

以上是关于ActionScript 3 在AS3中使用麦克风的主要内容,如果未能解决你的问题,请参考以下文章

ActionScript 3 AS3:在ActionScript中使用E4X生成动态XML

ActionScript 3 在AS3中使用RegExp去除空白

ActionScript 3 在AS3中使用自定义事件传递数据

ActionScript 3 AS3在阵列中?

ActionScript 3 AS3:在数组中搜索

使用 ActionScript 3 将保存声音录制到文件中。不是来自麦克风