1

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.")
ketan
  • 19,129
  • 42
  • 60
  • 98
iceman
  • 4,211
  • 13
  • 65
  • 92

1 Answers1

0

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

alxx
  • 9,897
  • 4
  • 26
  • 41
  • how can I pipe commands in the NativeProcessStartupInfo as c:\FestivalTTS>echo "Hello world" | festival --tts – iceman Nov 18 '10 at 11:47