Unbelievable! Thank you!
I was expecting openwrt developer might recompile it with 8k sample rate, removing that 16k flag yesterday.
Tested the 8k flite, it works fine. The output wave file can be playback directly by *.
flite application seems have some problem, but I dont know what it was.
flite(some_words) just didn't work.
Asterisk debug message didn't help much, only line was parsing flite config file as below,
...
-- Executing [220@internal:1] Ringing("SIP/PAP101-00629848", "") in new stack
-- Executing [220@internal:2] Answer("SIP/PAP101-00629848", "") in new stack
-- Executing [220@internal:3] Flite("SIP/PAP101-00629848", "girl") in new stack
== Parsing '/etc/asterisk/flite.conf': Found
And it stops there forever, no sound produced.
Zero byte temp file created under /tmp without .wav extension.
-rw------- 1 root root 0 Dec 27 17:22 flite_buf_gnZKty
-rw------- 1 root root 0 Dec 27 17:25 flite_buf_vI1fEQ
-rw------- 1 root root 0 Dec 27 17:26 flite_buf_2SH25S
-rw------- 1 root root 0 Dec 27 17:26 flite_buf_5Kb8rl
-rw------- 1 root root 0 Dec 27 17:44 flite_buf_NIBPhg
-rw------- 1 root root 0 Dec 27 17:48 flite_buf_jBy5hu
-rw------- 1 root root 0 Dec 27 17:49 flite_buf_65PXge
From source app_flite.c, it was appending .wav extension name. But under /tmp/flite_buf_*, the wav extension was missing from file names.
...
sprintf(filename, "/tmp/flite_buf_XXXXXX");
mkstemp(filename);
strcpy(wavFilename, filename);
strcat(wavFilename, ".wav");
/* Invoke Flite */
flite_init();
v = register_cmu_us_kal();
flite_text_to_speech((char *) data, v, wavFilename);
if (chan->_state != AST_STATE_UP)
{
/* Answer the channel if it is down */
ast_answer(chan);
}
...
I guess flite_init probably was fine since it was parsing config file.
But somewhere inside flite_text_to_speech, something got wrong. Since the temp file got created, so I guess it passed the point ergister_cmu_us_kal.
If I remove the Answer before flite() in extension.ael setup, the channel never got answered, so I think the function flite_text_to_speech was never return. Thus the ast_answer didn't work. So was the rest app_flite module and no sound stream into channel.
Not sure how to fix it, not much debug msg from flite to asterisk console.
The work around I can think of is, might be add app_mp3.so into asterisk package and create a dummy mpg123 script that calls flite to create wave file and stream to stdout. So something like MP3Player(some_words) would play the speech sound of "some_words".