我想构建一个空中应用程序,它从用户那里获取输入(例如,要生成的文件名列表),并生成具有所需命名的声音文件。声音文件应该是“空/静音”声音(wav,aif或mp3)。有可能生成这样的文件吗?如果没有,我可以使用现有声音并将其嵌入应用程序并在生成文件时将其作为源吗?
这样做的目的是在项目中准备一个文件结构,该结构将由我们的Sound Director替换。这样,我们可以在创建之前触发所有声音。
答案 0 :(得分:5)
是,
public var mic:Microphone = Microphone.getMicrophone();
//setting mic silence to 100 means no sound is collected by the mic
mic.setSilenceLevel(100, 200);
//or mic.gain = 0 will collect no sound
mic.gain = 0;
mic.rate = 44;
mic.setLoopBack(true);
Security.showSettings("2");
mic.setLoopBack(false);
mic.setUseEchoSuppression(false);
mic.addEventListener(ActivityEvent.ACTIVITY, activityHandler, false, 0, true);
mic.addEventListener(StatusEvent.STATUS, statusHandler, false, 0, true);
private function activityHandler(event:ActivityEvent):void {
trace("activityHandler: Gain:" + mic.gain);
}
private function statusHandler(event:StatusEvent):void {
trace("statusHandler: " + event.code);
}