I'm trying to set up a text-to-speech server on my Mac (Mavericks) using PHP and Python. When I execute the Python script via the terminal, it works fine. However, when I execute it through my browser via PHP, the TTS audio file is generated, but LAME fails to convert the file.
This is what I have in my Python script:
from os import system
import sys
word=sys.argv[1].strip()
system('say -v Allison -o audio/'+word+'.aiff '+word)
system('lame audio/'+word+'.aiff audio/'+word+'.mp3')
And this is my PHP:
<html>
<?php
error_reporting(E_ALL);
if (isset($_GET['word'])){$word=$_GET['word'];}
else {$word="test";}
echo $word;
exec('python tts.py '.$word);
echo "<audio controls><source src='audio/".$word.".mp3'></audio>";
?>
</html>
Any suggestions on what might be going wrong would be very much appreciated.