2010-11-18 92 views
1

我试图从AIR 2应用程序运行Festival text to speech从Flex4运行Festival TTS的建议Adobe AIR应用程序

下面是启动记事本

<?xml version="1.0" encoding="utf-8"?> 
<s:WindowedApplication xmlns:fx="http://ns.adobe.com/mxml/2009" 
         xmlns:s="library://ns.adobe.com/flex/spark" 
         xmlns:mx="library://ns.adobe.com/flex/mx" width="1024" height="768"> 

    <fx:Script> 
     <![CDATA[ 
      protected function button1_clickHandler(event:MouseEvent):void 
      { 
       var exe:File = new File("c:/Windows/notepad.exe"); 
       var nativeProcess:NativeProcess = new NativeProcess(); 
       var nativeProcessStartupInfo:NativeProcessStartupInfo = new NativeProcessStartupInfo(); 
       nativeProcessStartupInfo.executable = exe; 
       var args:Vector.<String> = new Vector.<String>(); 
       args.push("e:/temp/Hello.txt"); 
       nativeProcessStartupInfo.arguments = args; 
       nativeProcess.start(nativeProcessStartupInfo); 
      } 
     ]]> 
    </fx:Script> 

    <fx:Declarations> 
     <!-- Place non-visual elements (e.g., services, value objects) here --> 
    </fx:Declarations> 
    <s:Button x="265" y="236" label="Hello Button" width="465" height="131" fontSize="30" click="button1_clickHandler(event)"/> 
</s:WindowedApplication> 

,我想在按钮上点击运行该命令的样本代码是在这里:

c:\FestivalTTS>echo "Hello world" | festival --tts 

或类似这样的启动节:

c:\FestivalTTS>festival.exe --pipe 

然后在节日命令提示符下键入以下内容

(SayText "Hello world.") 

回答

0

阅读文档,他们的规则。您可以使用NativeProcess'standardInput和standardOutput与流程进行通信。请参阅sample

+0

如何将NativeProcessStartupInfo中的命令作为c:\ FestivalTTS> echo“Hello world”|节日--tts – iceman 2010-11-18 11:47:33

相关问题