5 function __construct() {
6 $this->mode = 'rhvoice';
9 $this->display = ":99";
12 function text2Wav($string,$lang = "ru")
17 if ($this->mode == 'festival') {
19 $prolog="/etc/festival/$lang.scm";
20 if (!file_exists($prolog)) {
21 $prolog="/etc/festival/default.scm";
24 //make sure that your environment is set to find the festival binaries!
25 $cmd = "festival_client --prolog $prolog --ttw | lame -f - -";
26 } elseif ($this->mode == 'rhvoice') {
27 $cmd = "DISPLAY=".$this->display." RHVoice-client -s Anna+CLB -r ".$this->speed." -p ".$this->pitch." | lame -f - -";
33 $descriptorspec = array(
34 0 => array("pipe", "r"), // stdin is a pipe that the child will read from
35 1 => array("pipe", "w"), // stdout is a pipe that the child will write to
36 2 => array("pipe", "w") // stderr is a file to write to
40 $process = proc_open($cmd, $descriptorspec, $pipes, $cwd, $env);
41 if (is_resource($process)) {
42 fwrite($pipes[0],$string);
44 $data = stream_get_contents($pipes[1]);
47 $proc_result = proc_close($process);