Re: [Asterisk-java-users] Asterisk-java and Text to Speech
Brought to you by:
srt
From: David R. <da...@re...> - 2006-10-16 18:00:49
|
I have not used the Cepstral TTS with Asterisk, but it will almost definitely work using the same strategy as with Festival. I do this: private char playText (String text) throws AgiException { String soundsDir = "/var/lib/asterisks/sounds/tts/"; String text2wavePath = "/usr/bin/text2wave"; String waveName = "TTS_"+System.currentTimeMillis(); exec("System", "echo '"+text+"'|"+text2wavePath+" -F 8000 -o "+soundsDir+waveName+".wav"); char digit = streamFile("tts/"+waveName, "0123456789*#"); exec("System", "rm "+soundsDir+waveName+".wav"); return digit; } Basically, I use the System command to run the text2wave program on the command-line. Then, I use streamFile to play the new wave file that festival created. Finally, I delete the created file. If Cepstral has a command-line application, you can do the same thing. If the Cepstral integration has a new AGI command with it, that allows you to run the TTS without an intermediate wave file, it would be nice to be able to use that. You may be able to use the Exec command. -Dave |