[fpc-pascal] Re: TProcess with festival
Seth Grover
sethdgrover at gmail.com
Fri May 15 22:45:31 CEST 2009
Okay, I figured it out...
Turns out I was using festival wrong, though I'm still not sure how.
It wasn't a problem with how I was using TProcess.
If I run festival like this (not using --tts mode)
FestivalProc.CommandLine := '/usr/bin/festival --pipe';
And pass "SayText" commands like this, rather than just passing it the
text I want read:
line := '(SayText "hello")';
FestivalProc.Input.WriteBuffer(line[1], length(line));
It works fine.
Thanks for your help!
-SG
--
This email is fiction. Any resemblance to actual events
or persons living or dead is purely coincidental.
Seth Grover
sethdgrover[at]gmail[dot]com
On Fri, May 15, 2009 at 12:48 PM, Seth Grover <sethdgrover at gmail.com> wrote:
> Maybe I'm just dumb, but I cannot figure out why this isn't working.
>
> I wanted to write a simple program which uses TProcess to send input
> to festival (the text-to-speech engine). On the command line I can do
> something simple like this:
> echo hello | /usr/bin/festival --tts --pipe
> and festival will say "hello". Pretty easy...
>
> So why won't this work?
>
> program talkie;
>
> {$mode objfpc}{$H+}
>
> uses
> Classes, SysUtils, Process;
>
> var
> festival : TProcess;
> line : string;
> begin
> try
> festival := TProcess.Create(nil);
> try
> festival.Options := [poUsePipes, poStderrToOutput, poNoConsole,
> poDefaultErrorMode];
> festival.CommandLine := '/usr/bin/festival --pipe --tts';
> line := 'hello'
> festival.Execute;
> festival.Input.WriteBuffer(line[1], length(line));
> finally
> festival.Terminate(0);
> FreeAndNil(festival);
> end;
> except
> on E : Exception do begin
> writeln('Exception: ' + E.Message);
> end;
> end;
> end.
>
> I've googled TProcess for about 2 hours and I'm not seeing what I'm
> missing. Can someone smarter than me please illuminate me?
>
> Thanks,
>
> Seth
>
>
> --
> This email is fiction. Any resemblance to actual events
> or persons living or dead is purely coincidental.
>
> Seth Grover
> sethdgrover[at]gmail[dot]com
>
More information about the fpc-pascal
mailing list