Out of curiosity, are you using version 1 or 2 of Program O? I’m wondering because I’m on the dev team for version 2, and may consider writing a TTS addon, if I can find a good way to integrate it.
Also, is the TTS script generating any errors that you’ve noticed? If so, it may help to know what they are, but I’m well aware that many of PHP’s “shell command functions” don’t generate errors when there’s a problem. I see that you’ve used exec(), but have you tried replacing exec() with any of the other CLI/system functions (e.g.system(), passthru(), escapeshellcmd(), or the backtick operator)? Some of these functions/statements work differently on different OS’s, and they also have different outputs, depending on the function used, and any available options that might be implemented.
For example, the exec() function takes an optional variable that is filled with the “output” of every CLI command passed into it. This can prove to be very useful in determining where something might have gone wrong. In contrast, the system() function also takes an optional variable, but only status codes are stored within the optional variable. I suppose that this can be useful for basing script execution after the system calls are made, based on the returned codes, but I find that the actual text output to be more useful in the vast majority of cases.
You might also want to check the PHP configuration to see if system calls are even allowed, as some web hosts disable this functionality to reduce security threats. Sadly, this isn’t something that can be changed from within a script by calling ini_set(), or even creating a php.ini file in your document root. If a remote host is running PHP in Safe Mode, or has otherwise disabled the use of system calls, then there isn’t much that you can do about it, other than asking the hosting provider to change it (which I seriously doubt they will). If it’s a box that YOU administer, then this can be “fixed”, though it’s not always an easy, straight-forward thing to do.
As to other alternatives to Festival TTS, I can’t help you there, but perhaps someone else can.