This is the code i used ..every thing is working except the EXCE part ...help pls
<?php
//create a random number filename so that simultaneous users don't overwrite each other
$filename = 'test.txt';
$text = 'This text will be converted to audio recording';
$outputfile = basename($filename, ".txt");
$outputfile = $outputfile . '.wav';
if (!$handle = fopen($filename, "w+"))
{
//we cannot open the file handle!
echo "Cannot open";
return false;
}
// Write $text to our opened file.
if (fwrite($handle, $text) === FALSE)
{
//couldn't write the file...Check permissions
echo "Cannot write";
return false;
}
fclose($handle);
//initialise and execute the festival C engine
//make sure that your environment is set to find the festival binaries!
exec("text2wave hello.txt -o hello1.wav");
$cmd = "text2wave $outputfile -o $filename ";
//execute the command
exec($cmd);
//unlink($filename);
echo "Recording is successful. \nRecording File: " . $outputfile;
//finally return the uptput file path and filename
return $outputfile;
?>
Trouble using festival in PHP
Moderator: General Moderators
-
martinfreefall
- Forum Newbie
- Posts: 1
- Joined: Thu Jan 12, 2012 10:45 am
- Christopher
- Site Administrator
- Posts: 13596
- Joined: Wed Aug 25, 2004 7:54 pm
- Location: New York, NY, US
Re: Trouble using festival in PHP
You need to be sure that the text2wave program is executable by the web server user. I also would recommend using absolute paths for $outputfile and $filename to directories that are readable/writable by the web server user.
(#10850)