Google text to speech and speech to text

Status
Not open for further replies.
Hello Achilles,

i think it will be great to bind it with A2Billing callplane, for some resone sometimes you will be needed for thous who dont have DTMF Signal in there telephone for the calling card .. so if you could bend it with the calling card it will be very usfull. Has anybody an idea how this should work?

cheers,
 
I've tried to implement googletts in elastix 2.2.0.
When I dial the extension nothing happens and this is the result in console:

Executing [98@from-internal:2] AGI("SIP/10-00000025", "googletts.agi,"prova di testo",it") in new stack
-- Launched AGI Script /var/lib/asterisk/agi-bin/googletts.agi
-- <SIP/10-00000025>AGI Script googletts.agi completed, returning 0

If I try to run the script direclty using perl this is the result:

perl google.pl -t "prova di testo" -l it
ALSA lib pcm.c:2184:(snd_pcm_open_noupdate) Unknown PCM tempo
/usr/bin/sox: Failed reading tempo: cannot open audio device
sox failed to process sound file. at google.pl line 120.


Maybe is there any problem regarding sox or my audio device? Any suggestion?

Thanks
 
do you have mpg123? The agi does some audioconversions, so i think the problem occurs when converting.
Check: which mpg123 sox
and see if you get two lines where these programs are located.
mine is:
/usr/local/bin/mpg123
/usr/bin/sox
 
achilles said:
do you have mpg123? The agi does some audioconversions, so i think the problem occurs when converting.
Check: which mpg123 sox
and see if you get two lines where these programs are located.
mine is:
/usr/local/bin/mpg123
/usr/bin/sox

sox and mpg123 are correctly installed, but I've found both in /usr/bin/ dir and not in /usr/local/bin

Do you think it can be a problem?

Thanks
 
no...should not be the problem then...
When you do: mpg123 -?
do you see the help. If yes, mpg123 should be working.

Try this basic dialplan:

[from-internal-custom]
.
..
...
include => ttstest

[ttstest]
exten => 1235,1,agi(googletts.agi,"prova di testo",it)
exten => 1235,2,Hangup()

Then dial to 1235 and see what happens.
 
achilles said:
no...should not be the problem then...
When you do: mpg123 -?
do you see the help. If yes, mpg123 should be working.

Try this basic dialplan:

[from-internal-custom]
.
..
...
include => ttstest

[ttstest]
exten => 1235,1,agi(googletts.agi,"prova di testo",it)
exten => 1235,2,Hangup()

Then dial to 1235 and see what happens.

yes, I see help with -? option. I've also tried to make a basic dialplan but when I compose the number nothing happens. Script executed directly from perl return an error ALSA o audio device, it can be a problem linked to my audio card or configuration?

thanks again for support
 
Hello
Elastix Newbie and First Time Posting :)

Need some pointers please
Installed Google TTS everything is working fine for the samples from extension-custom.conf.
Cant figure this out though
How do I replace Festival for the Agenda Module and the Sample Text to Wav with the google tts thats now installed?

Any pointers would be appreciated!
Thanks
 
yair_pc said:
i install all rpm

when i dial 1235 or 1236 i hear the message "Say something in English, when done press the pound key" and the system do not wait for my answer
the asterisk say "failed to get speech data"

Hi ,
I know its too late to ans lol, but i found that it happens when u call from a SIP phone, use a real-phone and it will work..

i hope it will help the new readers :P
 
Someone maybe explain why I would want to use the google to text thing?

Remember I'm an old fart (63) so try to put it into something I can understand. Afterall, I just got my first smart phone and I think I may have taken on too much learning. Old school days sure were nice and simple (lol). It sounds like something interesting, just trying to figure out where or how it would benefit using it.

Maybe one day I learn as much as you guys.....


Thanks guys,

amphibian
 
A simple function to use google text to speech in PHP.

FILE : /var/lib/asterisk/agi-bin/googleTTS.php

Code:
<?php
if(!isset($argv[1])){
   $string = "Parameter string missing. Please solve this issue."; 
}else{
   $string = trim($argv[1]);
}
if(!isset($argv[2])){
   $string = "Parameter language missing. Please solve this issue."; 
   $lang = 'en';
}else{
    $lang = trim($argv[2]);
}
$ttsFile = tts($string,$lang);
return $ttsFile;

function tts($string, $lang){
	$string = urlencode($string);
        if(strlen($string > 100)){
            echo("Google limit text2speech to 100 caracters. Please cut your string ...");
            return false;
        }
	$id = uniqid("ivr_");
	exec('curl -A "Mozilla" "http://translate.google.com/translate_tts?ie=UTF-8&tl='.$lang.'&q='.$string.'" > /tmp/'.$id.'.mp3');
	exec('/usr/bin/mpg123 -w /tmp/'.$id.'.wav /tmp/'.$id.'.mp3');
	exec('/usr/bin/sox /tmp/'.$id.'.wav -t raw -r 8000 -s -c 1 /tmp/'.$id.'.sln');
	return('/tmp/'.$id);
}
?>


And use in Dialplan :

exten => 1000,1,Answer()
same => n, Set(SOUNDFILE=${SHELL(/usr/bin/php /var/lib/asterisk/agi-bin/googleTTS.php ${CALLERID(num)})})
same => n, Playback(${SOUNDFILE})
same => n,Hangup()


Be sure to install curl, sox and mpg123 (yum install .....)
 
Status
Not open for further replies.

Forum statistics

Threads
111,858
Messages
589,427
Members
164,698
Latest member
RRusev