Jump to content

Problem with festival tts in php


daisycmyk

Recommended Posts

Im having a problem with embedding/executing 'text2wave'  command inside php script. 

I want to read one text file (in this case text1.txt)  , covert it into (wav/mp3) format and play that file. (automatically on page load or on form button click)

Im using somewhat modified version of php script located here  http://www.xenocafe.com/tutorials/php/festival_text_to_speech/index.php

 

My code snippet

<?php 
if(isset($response)){
  //echo $response;
    echo "<br/>"; 
     // if(!empty($response)){   
            $wave_file='test1.wav';
            $speech_file='test1.txt';
            $volume_scale=50;
            
            $fh = fopen($speech_file, "w+");
                
                if ($fh) {
                    fwrite($fh, $response);
                    fclose($fh);
                }
       if (file_exists($speech_file)) {
      // create the text2wave command and execute it
[b]        $cmd = "text2wave $speech_file -o $wave_file";[/b]
        echo $cmd;
[b]        exec($cmd);[/b]  // this is not working 
        echo exec('date');// this is working 
       //unlink($wave_file);
        }
        
    echo '<embed height="19" width="185" src="test1.wav" visibility="true"></embed>';}
  }

 

Sorry about this scrappy code , im not very good at php .. yet.

exec($cmd) part is not working , text1.wav file is not being generated(which it must)

Does  it has to with ENVIRONMENTAL VARIABLES or PATH?

But $text2wave $speech_file -o $wave_file from shell is working without a problem.

 

Thanks in advance.Any help would be greatly appreciated. :D

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.