[asterisk-users] AGI script that uses google's text to speech engine

2011-12-13 Thread Lefteris Zafiris
Hello,

version 0.3 of the asterisk-googletts AGI script just got released,
most noticeable changes are:
The script can now be used to easily build IVRs.  
Fixed compatibility with asterisk 1.4 and older.
Fixed compatibility with older perl versions(5.8.8).
Better input handling.

The latest release, documentation and dialplan examples can be found
here: http://zaf.github.com/asterisk-googletts/

A big thank you to all the users that contributed with feedback,
bug reports and suggestions.


Lefteris Zafiris

--
_
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
New to Asterisk? Join us for a live introductory webinar every Thurs:
   http://www.asterisk.org/hello

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users


Re: [asterisk-users] AGI script that uses google's text to speech engine

2011-12-01 Thread bakko
Hello,

when I use the Agi, sometimes not play the phrase:

WARNING[30391]: file.c:650 ast_openstream_full: File ggl_U0sBo0 does not exist 
in any format

Regards
  - Original Message - 
  From: Lefteris Zafiris 
  To: asterisk-users@lists.digium.com 
  Sent: Wednesday, November 30, 2011 7:42 PM
  Subject: [asterisk-users] AGI script that uses google's text to speech engine


  Hello,
  I have written an AGI script for asterisk that uses google translate for text 
to speech synthesis.
  It supports a variety of different languages, local caching for the voice 
data and wideband audio.
  The voice in most languages is female and the quality of the synthesized 
speech is very high.
  More info about the script can be found here: 
http://zaf.github.com/asterisk-googletts/
  the first public release ca be obtained here: 
https://github.com/downloads/zaf/asterisk-googletts/asterisk-googletts-0.2.tar.gz

  To get a sample of the speech synthesis quality try this link:
  
http://translate.google.com/translate_tts?tl=enq=this+is+a+test+for+google+text+to+speech+engine

  The code is still very young so suggestions, comments and bug reports are 
more than welcome.

  --
  Lefteris Zafiris



--


  --
  _
  -- Bandwidth and Colocation Provided by http://www.api-digital.com --
  New to Asterisk? Join us for a live introductory webinar every Thurs:
 http://www.asterisk.org/hello

  asterisk-users mailing list
  To UNSUBSCRIBE or update options visit:
 http://lists.digium.com/mailman/listinfo/asterisk-users--
_
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
New to Asterisk? Join us for a live introductory webinar every Thurs:
   http://www.asterisk.org/hello

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users

Re: [asterisk-users] AGI script that uses google's text to speech engine

2011-12-01 Thread Kingsley Tart
Hi. Aside from converting spaces to plus signs, you don't encode any
special characters before putting them in the URL. It might be safer to
run $line through some sort of encoding before calling Google with it,
even if most special characters probably don't result in any sound.
Google say and if you give it an ampersand, but unescaped you couldn't
include that in the string.

You may decide to have an option to locally cache pre-produced sound
files in case that phrase is used again.

Cheers,
Kingsley.

On Thu, 2011-12-01 at 02:42 +0200, Lefteris Zafiris wrote:
 Hello,
 I have written an AGI script for asterisk that uses google translate
 for text to speech synthesis.
 It supports a variety of different languages, local caching for the
 voice data and wideband audio.
 The voice in most languages is female and the quality of the
 synthesized speech is very high.
 More info about the script can be found here:
 http://zaf.github.com/asterisk-googletts/
 the first public release ca be obtained here:
 https://github.com/downloads/zaf/asterisk-googletts/asterisk-googletts-0.2.tar.gz
 
 To get a sample of the speech synthesis quality try this link:
 http://translate.google.com/translate_tts?tl=enq=this+is+a+test+for
 +google+text+to+speech+engine
 
 The code is still very young so suggestions, comments and bug reports
 are more than welcome.
 
 --
 Lefteris Zafiris
 --
 _
 -- Bandwidth and Colocation Provided by http://www.api-digital.com --
 New to Asterisk? Join us for a live introductory webinar every Thurs:
http://www.asterisk.org/hello
 
 asterisk-users mailing list
 To UNSUBSCRIBE or update options visit:
http://lists.digium.com/mailman/listinfo/asterisk-users


--
_
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
New to Asterisk? Join us for a live introductory webinar every Thurs:
   http://www.asterisk.org/hello

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users


Re: [asterisk-users] AGI script that uses google's text to speech engine

2011-12-01 Thread Lefteris Zafiris
On Thu, 1 Dec 2011 09:43:29 -0500
bakko asannu...@gmail.com wrote:

 Hello,
 
 when I use the Agi, sometimes not play the phrase:
 
 WARNING[30391]: file.c:650 ast_openstream_full: File ggl_U0sBo0 does
 not exist in any format
 
 Regards

Seems like the script failed to convert the mp3 data that gets from
google to raw slinear. In that case mpg123 or sox
failed to run. It would be very helpful if you could send the full
console output with verbosity set to 3. Please reply to my mail address
so we don't pollute the list.

Thanks for the feedback


Lefteris Zafiris
  


--
_
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
New to Asterisk? Join us for a live introductory webinar every Thurs:
   http://www.asterisk.org/hello

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users


Re: [asterisk-users] AGI script that uses google's text to speech engine

2011-12-01 Thread Danny Nicholas
I personally don't like the use of mpg123 for playback - would prefer use of
the internal Playback/background functions.  Still seems to be a nice
effort though.

-Original Message-
From: asterisk-users-boun...@lists.digium.com
[mailto:asterisk-users-boun...@lists.digium.com] On Behalf Of Kingsley Tart
Sent: Thursday, December 01, 2011 11:24 AM
To: Asterisk Users Mailing List - Non-Commercial Discussion
Subject: Re: [asterisk-users] AGI script that uses google's text to speech
engine

Hi. Aside from converting spaces to plus signs, you don't encode any special
characters before putting them in the URL. It might be safer to run $line
through some sort of encoding before calling Google with it, even if most
special characters probably don't result in any sound.
Google say and if you give it an ampersand, but unescaped you couldn't
include that in the string.

You may decide to have an option to locally cache pre-produced sound files
in case that phrase is used again.

Cheers,
Kingsley.

On Thu, 2011-12-01 at 02:42 +0200, Lefteris Zafiris wrote:
 Hello,
 I have written an AGI script for asterisk that uses google translate 
 for text to speech synthesis.
 It supports a variety of different languages, local caching for the 
 voice data and wideband audio.
 The voice in most languages is female and the quality of the 
 synthesized speech is very high.
 More info about the script can be found here:
 http://zaf.github.com/asterisk-googletts/
 the first public release ca be obtained here:
 https://github.com/downloads/zaf/asterisk-googletts/asterisk-googletts
 -0.2.tar.gz
 
 To get a sample of the speech synthesis quality try this link:
 http://translate.google.com/translate_tts?tl=enq=this+is+a+test+for
 +google+text+to+speech+engine
 
 The code is still very young so suggestions, comments and bug reports 
 are more than welcome.
 
 --
 Lefteris Zafiris
 --
 _
 -- Bandwidth and Colocation Provided by http://www.api-digital.com -- 
 New to Asterisk? Join us for a live introductory webinar every Thurs:
http://www.asterisk.org/hello
 
 asterisk-users mailing list
 To UNSUBSCRIBE or update options visit:
http://lists.digium.com/mailman/listinfo/asterisk-users


--
_
-- Bandwidth and Colocation Provided by http://www.api-digital.com -- New to
Asterisk? Join us for a live introductory webinar every Thurs:
   http://www.asterisk.org/hello

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users


--
_
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
New to Asterisk? Join us for a live introductory webinar every Thurs:
   http://www.asterisk.org/hello

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users


Re: [asterisk-users] AGI script that uses google's text to speech engine

2011-12-01 Thread Lefteris Zafiris
On Thu, 01 Dec 2011 17:23:59 +
Kingsley Tart kings...@skymarket.co.uk wrote:

 Hi. Aside from converting spaces to plus signs, you don't encode any
 special characters before putting them in the URL. It might be safer
 to run $line through some sort of encoding before calling Google with
 it, even if most special characters probably don't result in any
 sound. Google say and if you give it an ampersand, but unescaped
 you couldn't include that in the string.
 
 You may decide to have an option to locally cache pre-produced sound
 files in case that phrase is used again.
 
 Cheers,
 Kingsley.
 

Thanks for the suggestion. Ther's already some sort of input sanitation:
 $AGI{arg_1} =~ s/[\\\/|*~^\(\)\[\]\{\}\n\r]/ /g;
that strips most special characters but i guess it needs some more work.
As for the caching the script supports it already, its enabled by
default and controlled by these 2 variables in the script:
 $usecache   = 1;
 $cachedir   = /tmp;
Voice data gets stored in the cachedir for future use so we don't have
to fetch it from google each time.


Lefteris Zafiris

--
_
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
New to Asterisk? Join us for a live introductory webinar every Thurs:
   http://www.asterisk.org/hello

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users


Re: [asterisk-users] AGI script that uses google's text to speech engine

2011-12-01 Thread Lefteris Zafiris
On Thu, 1 Dec 2011 11:35:21 -0600
Danny Nicholas da...@debsinc.com wrote:

 I personally don't like the use of mpg123 for playback - would prefer
 use of the internal Playback/background functions.  Still seems to
 be a nice effort though.

mpg123 used to convert the mp3 data that we get from google to wav. The
wav file is passed to sox that converts it to raw slinear and then its
played back by asterisk using the 'stream file' agi command.

I don't really like calling all these system commands but I thought it
would be better for the users to have the voice data in sln than mp3
since format_mp3 module isn't available in many installations.


Lefteris Zafiris 

--
_
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
New to Asterisk? Join us for a live introductory webinar every Thurs:
   http://www.asterisk.org/hello

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users


Re: [asterisk-users] AGI script that uses google's text to speech engine

2011-12-01 Thread Torbjörn Abrahamsson
This is because you need to add /tmp to the STREAM command, ie:

print STREAM FILE /tmp/$tmpname \$intkey\\n;

$tmpname seems to not contain the path, so it will look in
/var/lib/asterisk/sounds for the file...

This at least made it work for me... (After fixing some other things to make
it work with asterisk 1.2...)

BR,
Torbjörn Abrahamsson



-Original Message-
From: asterisk-users-boun...@lists.digium.com
[mailto:asterisk-users-boun...@lists.digium.com] On Behalf Of Lefteris
Zafiris
Sent: den 1 december 2011 18:34
To: asterisk-users@lists.digium.com
Subject: Re: [asterisk-users] AGI script that uses google's text to speech
engine

On Thu, 1 Dec 2011 09:43:29 -0500
bakko asannu...@gmail.com wrote:

 Hello,
 
 when I use the Agi, sometimes not play the phrase:
 
 WARNING[30391]: file.c:650 ast_openstream_full: File ggl_U0sBo0 does
 not exist in any format
 
 Regards

Seems like the script failed to convert the mp3 data that gets from
google to raw slinear. In that case mpg123 or sox
failed to run. It would be very helpful if you could send the full
console output with verbosity set to 3. Please reply to my mail address
so we don't pollute the list.

Thanks for the feedback


Lefteris Zafiris
  


--
_
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
New to Asterisk? Join us for a live introductory webinar every Thurs:
   http://www.asterisk.org/hello

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users


--
_
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
New to Asterisk? Join us for a live introductory webinar every Thurs:
   http://www.asterisk.org/hello

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users


Re: [asterisk-users] AGI script that uses google's text to speech engine

2011-12-01 Thread Lefteris Zafiris
On Thu, 1 Dec 2011 21:51:21 +0100
Torbjörn Abrahamsson torbjorn.abrahams...@gmail.com wrote:

 This is because you need to add /tmp to the STREAM command, ie:
 
 print STREAM FILE /tmp/$tmpname \$intkey\\n;
 
 $tmpname seems to not contain the path, so it will look in
 /var/lib/asterisk/sounds for the file...
 
 This at least made it work for me... (After fixing some other things
 to make it work with asterisk 1.2...)
 
 BR,
 Torbjörn Abrahamsson
 

$tmpname is supposed to include the full path together with the temp
dir since its created with the option 'TMPDIR = 1' during the call of
tempfile() and it does so in my system that runs perl 5.14.2. I guess
that might not be true for older versions of perl(?)
Can you please tell me what version of perl you are using?
The oldest perl I can get my hands on is 5.8.8 on RHEL 5.x machines.
I will try to test there and see whats going on.

Thanks for the feedback.


Lefteris Zafiris

--
_
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
New to Asterisk? Join us for a live introductory webinar every Thurs:
   http://www.asterisk.org/hello

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users

Re: [asterisk-users] AGI script that uses google's text to speech engine

2011-12-01 Thread Torbjörn Abrahamsson
This was run on an Fedora 8 machine, with perl 5.8.8. I also found it odd that 
the path was not included...

// T


-Original Message-
From: asterisk-users-boun...@lists.digium.com 
[mailto:asterisk-users-boun...@lists.digium.com] On Behalf Of Lefteris Zafiris
Sent: den 1 december 2011 22:48
To: asterisk-users@lists.digium.com
Subject: Re: [asterisk-users] AGI script that uses google's text to speech 
engine

On Thu, 1 Dec 2011 21:51:21 +0100
Torbjörn Abrahamsson torbjorn.abrahams...@gmail.com wrote:

 This is because you need to add /tmp to the STREAM command, ie:
 
 print STREAM FILE /tmp/$tmpname \$intkey\\n;
 
 $tmpname seems to not contain the path, so it will look in
 /var/lib/asterisk/sounds for the file...
 
 This at least made it work for me... (After fixing some other things
 to make it work with asterisk 1.2...)
 
 BR,
 Torbjörn Abrahamsson
 

$tmpname is supposed to include the full path together with the temp
dir since its created with the option 'TMPDIR = 1' during the call of
tempfile() and it does so in my system that runs perl 5.14.2. I guess
that might not be true for older versions of perl(?)
Can you please tell me what version of perl you are using?
The oldest perl I can get my hands on is 5.8.8 on RHEL 5.x machines.
I will try to test there and see whats going on.

Thanks for the feedback.


Lefteris Zafiris

--
_
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
New to Asterisk? Join us for a live introductory webinar every Thurs:
   http://www.asterisk.org/hello

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users


--
_
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
New to Asterisk? Join us for a live introductory webinar every Thurs:
   http://www.asterisk.org/hello

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users

Re: [asterisk-users] AGI script that uses google's text to speech engine

2011-12-01 Thread Lefteris Zafiris
On Thu, 1 Dec 2011 23:23:56 +0100
Torbjörn Abrahamsson torbjorn.abrahams...@gmail.com wrote:

 This was run on an Fedora 8 machine, with perl 5.8.8. I also found it
 odd that the path was not included...
 
 // T
 
It seems this is an issue with older versions of perl or at least with
5.8.8. Since this version is used in RHEL/CentOS 5.x that many people
run on their servers, this is a serious problem.

Changing the way tempfile() is called from: 
tempfile(ggl_XX, TMPDIR = 1, UNLINK = 1)
to:
tempfile(ggl_XX, DIR = $tmpdir, UNLINK = 1)
seems to address this issue.

An updated version including this fix can be obtained here:
http://github.com/zaf/asterisk-googletts/tarball/master


Lefteris Zafiris

--
_
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
New to Asterisk? Join us for a live introductory webinar every Thurs:
   http://www.asterisk.org/hello

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users

[asterisk-users] AGI script that uses google's text to speech engine

2011-11-30 Thread Lefteris Zafiris
Hello,
I have written an AGI script for asterisk that uses google translate for
text to speech synthesis.
It supports a variety of different languages, local caching for the voice
data and wideband audio.
The voice in most languages is female and the quality of the synthesized
speech is very high.
More info about the script can be found here:
http://zaf.github.com/asterisk-googletts/
the first public release ca be obtained here:
https://github.com/downloads/zaf/asterisk-googletts/asterisk-googletts-0.2.tar.gz

To get a sample of the speech synthesis quality try this link:
http://translate.google.com/translate_tts?tl=enq=this+is+a+test+for+google+text+to+speech+engine

The code is still very young so suggestions, comments and bug reports are
more than welcome.

--
Lefteris Zafiris
--
_
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
New to Asterisk? Join us for a live introductory webinar every Thurs:
   http://www.asterisk.org/hello

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users