从 Flex4 Adob​​e AIR 应用程序运行 Festival TTS 的建议

发布于 2024-10-03 02:55:32 字数 1769 浏览 4 评论 0原文

我正在尝试从 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

残龙傲雪 2024-10-10 02:55:32

阅读文档,它们是规则。您可以使用 NativeProcess 与进程进行通信' 标准输入和标准输出。请参阅示例

Read docs, they rule. You can communicate with process using NativeProcess' standardInput and standardOutput. See sample.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文