从 Flex4 Adobe AIR 应用程序运行 Festival TTS 的建议
我正在尝试从 AIR 2 应用运行Festival 文本转语音 。
这是启动记事本的示例代码
<?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
或像这样启动 Festival:
c:\FestivalTTS>festival.exe --pipe
然后在 Festival 命令提示符中键入以下内容
(SayText "Hello world.")
I'm trying to run Festival text to speech from a AIR 2 app.
Here's a sample code for starting notepad
<?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>
The command that I want to run on the button click is here :
c:\FestivalTTS>echo "Hello world" | festival --tts
or start Festival like this:
c:\FestivalTTS>festival.exe --pipe
and then type the following in the Festival command prompt
(SayText "Hello world.")
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
阅读文档,它们是规则。您可以使用 NativeProcess 与进程进行通信' 标准输入和标准输出。请参阅示例。
Read docs, they rule. You can communicate with process using NativeProcess' standardInput and standardOutput. See sample.