Seth Grover schreef:
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'
Maybe:
line := 'hello' + LineEnding;
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.
Vincent
_______________________________________________
fpc-pascal maillist - fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal