Darren,
it looks like you are always using TTS to generate the voice files for
your application even if they are rathe static. I would only run the TTS
once (outside of your AGI scripts) and then use the generated voice
files. If you have dynamic parts (like greeting the user with his name)
I would only render those parts at run time. This should eliminate the
delay and take away some load from your Asterisk server.
=Stefan
Darren Hartford wrote:
> Hey all,
> Continuing my mad plan for using asterisk-java & fastAGI...taking text,
> convert to voice, and then gathering data back.
>
> The below works, but there is a 3-sec delay for the conversion (which
> could be cached for future use, but focusing on the one-offs for now):
>
> ======[code]=====
> String texttospeech = "Please enter your favorite number between
> 10 and 100 followed by pound sign.";
> int soundhash = texttospeech.hashCode();
> String sounddir = "/var/lib/asterisk/sounds/tts";
> String textfile = sounddir + "/ttsTEST-" + soundhash + ".txt";
> String wavefile = sounddir + "/ttsTEST-" + soundhash + ".wav";
> String gsmfile = sounddir + "/ttsTEST-" + soundhash + ".gsm";
> result = exec("System","echo '" + texttospeech + "' > " +
> textfile);
> System.out.println("text save result: " + result);
> result = exec("System","text2wave -F 8000 -o " + wavefile + " " +
> textfile);
> System.out.println("text2wave result: " + result);
> // result = exec("System","sox " + wavefile + " -r 8000 -c1 " +
> textfile);
> result = exec("System","sox " + wavefile + " " + gsmfile);
> System.out.println("sox result: " + result);
>
> String captureddata = "";
> captureddata = getData("tts/ttsTEST-" + soundhash);
> =====[/code]======
>
> Any recommendations to get this streamlined for one-off text
> conversions, or any pitfalls?
>
> TIA,
> -D
|