Ticket #1012 (assigned Module Submissions)

Opened 4 years ago

Last modified 5 months ago

Text To Speech

Reported by: _xo_ Assigned to: _xo_ (accepted)
Priority: minor Milestone: Cut Line
Component: Other Module Version:
Keywords: Cc:
Confirmation: Unreviewed SVN Revision (if applicable):
Backend Engine: All Backend Engine Version:

Description

This module supports Festival / Flite and Cepstral text to speech engines (autodetect and let the user choose which engine he wants to use).

A TTS record can be used as a destination and can be linked to another destination after being played.

Attachments

tts-1.0.tgz (6.5 kB) - added by _xo_ on 07/06/06 14:22:48.
TTS Module
tts-1.1.tgz (7.3 kB) - added by JakFrost on 11/04/09 22:06:52.
Text To Speech Module - Version 1.1
texttospeech-1.2.0.0.tgz (10.3 kB) - added by JakFrost on 11/09/09 02:34:31.
Text To Speech Module for FreePBX - Version 1.2.0.0
texttospeech-1.2.0.1.tgz (11.1 kB) - added by JakFrost on 11/15/09 20:14:06.
Text To Speech Module for FreePBX - Version 1.2.0.1
texttospeech-1.3.0.0.tgz (14.1 kB) - added by JakFrost on 11/18/09 18:48:55.
Text To Speech Module for FreePBX - Version 1.3.0.0
texttospeech-1.3.1.0.tgz (15.9 kB) - added by JakFrost on 11/19/09 13:32:51.
Text To Speech Module for FreePBX - Version 1.3.1.0
texttospeech-1.3.1.1.tgz (16.0 kB) - added by JakFrost on 11/20/09 09:44:55.
Text To Speech Module for FreePBX - Version 1.3.1.1
texttospeech-1.3.1.2.tgz (16.2 kB) - added by JakFrost on 11/23/09 21:25:13.
Text To Speech Module for FreePBX - Version 1.3.1.2
texttospeech-1.3.1.3.tgz (17.2 kB) - added by JakFrost on 11/24/09 21:50:12.
Text To Speech Module for FreePBX - Version 1.3.1.3

Change History

07/06/06 14:22:48 changed by _xo_

  • attachment tts-1.0.tgz added.

TTS Module

07/18/06 15:31:33 changed by ddwyer

great module , but how do you get it to play dynamic content , i am interested in getting a system status over the telephone. ie ping times , routes that are down etc ?

07/24/06 22:00:17 changed by _xo_

There is no way to play dynamic content with this module at this moment.

It is provided only as proof of concept.

07/27/06 15:35:31 changed by gregmac

See TextToSpeech for what this module should do

10/23/06 08:45:57 changed by versodom

Allthough I have Cepstral compiled and working properly, this module only detected Flite engine. Is there a way to make this module detect Cepstral?

10/26/06 06:32:03 changed by _xo_

  • owner set to _xo_.
  • status changed from new to assigned.

Could you post the cepstral binaries location ?

01/28/07 19:57:15 changed by versodom

/opt/swift

03/22/07 10:14:27 changed by daimion

you have to symlink the binaries to /usr/bin to get tts to find the binaries correctly. this will resolve your issue.

07/25/08 07:53:22 changed by ryppn

  • confirmation set to Unreviewed.
  • engine_version changed.
  • svn_rev changed.
  • milestone set to Cut Line.

03/31/09 09:21:11 changed by jpe_

Can this be modified to allow Punctuation with Cepstral? It's a great module but kinda sucks with the run on sentences.

(follow-up: ↓ 11 ) 04/03/09 14:14:24 changed by clampron

Hi jpe - I just ran into the same thing with allowing Punctuation. Here's a quick fix. Save a copy of the module on your local computer and extract tts-1.0.tgz One of the PHP files is page.tts.php Open this file with a text editor and drop off one of the last IF statements. It is the one that looks like:

if (!isAlphanumeric(theForm.text.value))

return warnInvalid(theForm.text, msgInvalidTTSText);

Uninstall your first module and reinstall with the edited version. I did notice that if you use a comma it will NOT work correctly, BUT you can use a period instead with a similar effect. Hope this helps - I just spend all day working on this!

(in reply to: ↑ 10 ) 04/11/09 16:37:11 changed by jpe_

Thanks clampron for the fix and the time you spent on it. It's working fine for me now so far. This is a very useful module that I have been using for a while. Ideas for enhancement would be to allow voice selection, speed and pitch settings.

11/04/09 22:06:52 changed by JakFrost

  • attachment tts-1.1.tgz added.

Text To Speech Module - Version 1.1

11/04/09 22:09:31 changed by JakFrost

Author: JakFrost?

Modified: 2009-11-04

Version: 1.1

Change: Disabled AlphaNum? Check on TTSText in "page.tts.php".

Note: Disabled alphanumeric content check for TextToSpeech input box text in "page.tts.php". The variable TTSText (aka $ttstext) is now Quoted Printable escaped as per RFC2045 to allow safe transfer of all special meta characters for XML and especially "," and "|". This allows safe transfer of text through Asterisk Gateway Interface and safe inclusion into the Asterisk Dialplan (/etc/asterisk/extensions_additional.conf) file to allow usage of XML formatted Speech Synthesis Markup Language (SSML) tags that are supported by Cepstral swift voice engine to control the emphasis, pitch, break time, and type of voice used for the text to be pronounced from the input box. Read the reference links below on how to change and improve the sounds of the Cepstral voices with SSML XML tags.

W3C SSML: http://www.w3.org/TR/speech-synthesis/ Cepstral SSML: http://cepstral.com/cgi-bin/support?page=ssml

Change: Changed the order of $argv[1] and [2] for $engine and $text in "functions.inc.php" and "agi/propolys.php.agi" to make it easier to locate the engine name in the debug log "/var/log/asterisk/full".

Change: Changed the order of TTS engine discovery and enumeration to sort by the best sounding engine first on the web page drop down menu. Before: "text2wave", "flite", "swift"; After: "swift", "flite", "text2wave".

11/04/09 22:11:42 changed by JakFrost

Long story short... You can now use any type of punctuation and markup you wish inside the Text box for your Text To Speech entries.

Check out the SSML tags now available for usage with Cepstral by visiting the links above.

11/08/09 17:21:52 changed by JakFrost

[b]Version 1.2 is on the way with a almost complete update of the module removing a lot of the limitations on 250-bytes and also providing management of sound files on update or delete. Wait a few days and check back again./b

11/09/09 02:34:31 changed by JakFrost

  • attachment texttospeech-1.2.0.0.tgz added.

Text To Speech Module for FreePBX - Version 1.2.0.0

11/09/09 02:37:46 changed by JakFrost


1.2.0.0 - Major Update


Readme: /var/www/html/admin/modules/texttospeech/README

Modder: JakFrost?

Modified: 2009-11-07

Add: Deletion old of sound files when Text To Speech entries are deleted or updated.

Add: Addition of the espeak voice engine.

Add: README file in "/var/www/html/admin/modules/texttospeech/" with detailed descriptions, changelog, and instructions on how to install all the available sound engines.

Change: Changed all external "tts" acronyms to legible "texttospeech".

Change: Legible filenames on sound files instead of illegible MD5 sum hash names.

Change: Text stored singly in text file of unlimited size supporting plain text and XML with all punctuation and markup.

Change: Passing of Name and Engine through AGI calls in "extensions_addition.conf" and not the actual Text removing limits on size and punctuation usage.

Change: Major code clean-up and re-write, addition of comments to the code and updates to all function and variable names to create consistency.

Remove: No more base64 text encoding necessary for AGI pass-through that was added in quicky version 1.1.

Remove: Hash information is no longer useful when sound and text files are deleted on entry updates and deletions.

Limit: Name for TextToSpeech entry is still limited to AlphaNum? (a-z A-Z 0-9) and Underscore (_) and Dash (-) with no spaces due to problems with spaces or special characters in "$AGI->stream_file( $soundfile )" and "$AGI->exec( Playback, $soundfile )" calls and the inability of these AGI calls to accept single or double quoted file names or PHP "escapeshellarg" or "escapeshellcmd" encoded filenames. Nothing I can do about this limitation in Asterisk 1.4.

11/09/09 06:43:17 changed by JakFrost

11/15/09 20:01:16 changed by JakFrost

1.2.0.1 - 2009-11-15 - JakFrost?

Fix: Fixed the README file instructions for installation of the engines, some lines were missing, some were mistyped.

Fix: Fixed a CRITICAL error in README with installation instructions for Flite speech engine that had a typo in the command for appending the "usr/local/lib" library path to the ld.so.conf file for usage by the "ldconfig" command. The correct command includes append ">>" redirect instead of create ">" redirect. This bad command caused the removal of all the "/etc/ld.so.conf.d/*" files from "ldconfig" command. The result was system wide error messages such as "PHP Warning: PHP Startup: Unable to load dynamic library >> '/usr/lib/php/modules/mysql.so' - /usr/lib/libmysqlclient.so.15". The correct command is: "echo /usr/local/lib/>> /etc/ld.so.conf" with double ">>".

Change: Changed Cepstral "./install.sh" line to add "agree" to license and "/opt/swift" as default path to install to without prompt.

11/15/09 20:14:06 changed by JakFrost

  • attachment texttospeech-1.2.0.1.tgz added.

Text To Speech Module for FreePBX - Version 1.2.0.1

11/15/09 20:14:53 changed by JakFrost

If you experienced problems or error messages due to this bad command you can easily fix the situation by adding the line "include ld.so.conf.d/*.conf" to the top of the "/etc/ld.so.conf" file and executing "ldconfig" again to re-add all the shared library paths.

11/18/09 18:48:55 changed by JakFrost

  • attachment texttospeech-1.3.0.0.tgz added.

Text To Speech Module for FreePBX - Version 1.3.0.0

11/18/09 18:49:33 changed by JakFrost


1.3.0.0 - 2009-11-18 - JakFrost?


Note: The usage of this module has improved in this version. The recommended usage of this module is to create Text To Speech entries to create the sound files in the "sounds/texttospeech/" folder, then to create System Recordings from those sound files, and then to create Announcements from the System Recordings. After that create the IVR menus with the Announcements. You can then change the content of the Text To Speech entries while keeping the Names the same and creating new sound files, thus updating the rest of the Sound Recordings -> Announcements -> IVR menus without having to re-create the menu structure again. The module can still be used as a generic destination.

Add: Added the "Arguments" field to allow passing of extra arguments to the voice synthesis engine for the creation of the sound file. The arguments are "escapeshellcmd()" escaped to prevent security problems with execution of commands.

Add: Added the "Allow Skip" and "Don't Answer Channel" options for the destination.

Add: Added "$debug" variable and code on per-function basis to allow return of extra information into the "/tmp/freepbx_debug.log" file when diagnosing module problems.

Add: Added "die_freepbx()" code for all database accesses to allow verbose output for any database related errors to make diagnosis of problems easier.

Change: Removed the "agi-bin/texttospeech.agi.php" file since it is no longer necessary since the sound file playback is done directly with the Asterisk Playback() or Background() functions depending if "Allow Skip" is enabled.

Change: The removal of the AGI script now makes the "functions.inc.php" script do the creation of the text and sound files directly after the users presses the Submit button. The output is fairly quick with only a very slight delay for short and medium length messages.

Change: Rewrote the "page.texttospeech.php" file to make it cleaner and also to add the additional features.

Change: Changed the database structure to include new columns for the extra features.

Change: Changed the name of the text and sound files to only include the Name of the entry without the engine name, since the Name value is unique and also because it makes the creation of System Recordings out of the Text To Speech recorded files in the "texttospeech/" folder structure easier.

Change: Quoted all database field names and escaped values with "sql_formattext()" that calls PEAR DB "DB::simpleEscape()" method to prevent database injection security issues.

Limit: The previous version of the module must be uninstalled before installing this version since there is no upgrade code yet to update the SQL database to the new version from the previous version. The text and sound filenames have also changed so the previous entries and files should be deleted also.

11/19/09 13:32:51 changed by JakFrost

  • attachment texttospeech-1.3.1.0.tgz added.

Text To Speech Module for FreePBX - Version 1.3.1.0

11/19/09 13:33:09 changed by JakFrost


1.3.1.0 - 2009-11-19 - JakFrost?


Note: This version improves the usage even more. You can now use Text To Speech to say the options of an IVR menu and allow Direct Dialing to those options. Text To Speech can also be used as a destination from an IVR to an option to say a message. In this case the Text To Speech entry should set the Destination back to the Text To Speech entry that says the menu options. It should not use the Return to IVR option otherwise the menu options will not be played to the user because the system will jump directly to the IVR to await a key press without saying the options. Just remember to chain Text To Speech menu options, to IVR, to Text To Speech message, to Text To Speech menu options.

Add: Added the Wait Before and After options to allow adding a pause in the speech for the number of seconds required.

Add: Added the Direct Dial to allow direct access to destination IVR extension.

Add: Added the Return to IVR option to allow return to a calling IVR when finished.

Limit: Previous version uninstall required since database schema is changed again. I didn't code the upgrade code yet since these are Work-In-Progress versions.

11/20/09 09:44:55 changed by JakFrost

  • attachment texttospeech-1.3.1.1.tgz added.

Text To Speech Module for FreePBX - Version 1.3.1.1

11/20/09 09:45:11 changed by JakFrost


1.3.1.1 - 2009-11-20 - JakFrost?


Fix: Direct Dial now works dialing multiple digit phone extensions, not just single digit IVR menu options.

11/23/09 21:25:13 changed by JakFrost

  • attachment texttospeech-1.3.1.2.tgz added.

Text To Speech Module for FreePBX - Version 1.3.1.2

11/23/09 21:25:40 changed by JakFrost

1.3.1.2 - 2009-11-24 - JakFrost?

Fix: Fix for the previous fix since it allowed multiple-digit extension Direct Dialing but it broke single-digit extensions previously used the dial pattern "_X." that requires multiple-digits and now using the correct pattern "_[*#0-9]!" for one or more digits and "*" and "#" signs.

11/24/09 21:50:12 changed by JakFrost

  • attachment texttospeech-1.3.1.3.tgz added.

Text To Speech Module for FreePBX - Version 1.3.1.3

11/24/09 21:50:34 changed by JakFrost


1.3.1.3 - 2009-11-25 - JakFrost?


Fix: Fixed Timeout 't' extenstion events and set proper gotos for extensions. The logic was not thought out properly so it was broken.

Fix: Fixed the previous fix and removed the "_[*#0-9]!" pattern since it short-circuits on single-digit entry and replaced it with the general "_." pattern to match everything, single-digit, multiple-digit, "*" and "#" and special "h" and "i" events. However the "." pattern does not seem to match timeout "t" events that it is supposed to so there is a separate Timeout event goto also afterwards.

Note: I read that the "_." pattern is not recommended and there are warnings produced when using it but it is absolutely the most appropriate usage for correct and forward-compatible pass-though of pressed keys and extensions from Text To Speech to IVR like destinations. The "!" pattern cannot be used for single or multiple matches because it short-circuits to the shortest match, not the longest match. Using multiple patterns such as "_[*#0-9]" and "_[*#0-9]." is possible that it doesn't pass through special extensions such as "i" or "h" that are not handled internally by Text To Speech module but are handled correctly by IVR. If there are complaints then the "_." pattern can be switched to the two patters I mentioned before, but for now it is the proper pass-through solution since it is the shortest and neatest one.

04/08/10 06:27:16 changed by brk

Module works great. There is a minor cosmetic problem - I am seeing that the module.xml file has html tags in the description section that is putting errors in the apache log as well as nightly from cron:

[Thu Apr 08 08:21:59 2010] [error] [client 192.168.1.101] PHP Notice: Array to string conversion in /var/www/html/admin/functions.inc.php on line 3310, referer:

I added a debug line in functions.inc.php to confirm it was the texttospeech/module.xml file and when I removed the paragraph tags the warning message went away.

I am running freepbx core 2.7.0.5.