Google TTS not generating wav files

Running Freepbx 6.12
I recently installed google TTS by following the steps on github but for some reasons it is not creating wav files on /var/lib/asterisk/sounds/tts just *.txt. I added the proper permissions to /var/lib/asterisk/agi-bin/googletts.agi and /usr/bin/googleTTS/, I also modify the /var/lib/asterisk/agi-bin/propolys-tts.agi to include on engine on the code:

case ‘googleTTS’:
exec($enginebin." -l en -f $textfile -r 8000 -o $wavefile");

Am I missing something?

Thanks in advance

You might want to check your propoly-tts.agi files, there’s two.


You should be able to edit the second one listed then disable and re-enable the tts module.

File: /var/www/html/admin/modules/tts/agi/propolys-tts.agi

 58         case 'swift':
 59                 exec($enginebin." -p audio/channels=1,audio/sampling-rate=8000 -o $wavefile -f $textfile");
 60                 break;
 61         case 'googleTTS':
 62                 exec($enginebin." -f $textfile -l en -r 8000 -o $wavefile");
 63                 break;

Also, for debugging you can run though the command line.

/file/path/ -t ‘Hello World’ -l en -r 8000 -o /var/www/html/hello_world.wav
The file should then be available at http://[pbx_server]/hello_world.wav

Another thing that I did while debugging was add a debug line before executing the exec function. This will show up in your asterisk/full log file

debug(“Command: “.$enginebin.” -f $textfile -l en -r 8000 -o $wavefile”,1);

tts sound files are saved in: /var/lib/asterisk/sounds/tts by default so i kept deleting the files in that folder each time I ran a test.

Another thing is to make sure tts engines is installed from the commercial modules. you have to add the engine name googleTTS with the absolute path and filename of the googletts-cli-pl file.

Since figuring out how to get this working I’ve since developed another script for an engine that I can use instead of googleTTS. I modified the googleTTS but it’s not ready yet though.

1 Like