[Kde-accessibility] KTTS News

Gary Cramblitt garycramblitt at comcast.net
Tue Jan 25 00:59:56 CET 2005

There have been some recent changes to KTTS -- the KDE Text-to-Speech System 
that may interest you.  I would appreciate feedback and testing of these 
features prior to the Feb 2 Feature Freeze deadline.  If the features are too 
buggy or there are other objections to them, they will be removed before the 
KDE 3.4 release.

KTTSMgr now has a "Filters" tab.  On this tab you can configure a variety of 
filters which are applied to text jobs and KNotify messages before they are 
spoken.  The available filter plugins are:

1.  String Replacer -- used to replace words or regular expressions.  This is 
useful for replacing commonly-mispoken words or abbreviations.  There are 
several prebuilt word lists available, including abbreviations, chat, and 

2.  XML Transformer -- uses XSLT to transform any well-formed XML file into 
another format.  There is an XHTML to SSML xslt file available which should 
be considered highly experimental.  You must have the xsltproc program 

3.  Talker Chooser -- used to automatically choose a Talker based on text 
content or the application it comes from.  With this filter you can do things 
like: have all knotify messages spoken in a female voice, while all other 
text is spoken in a default, male, voice.

You may configure more than one instance of each of these filters.  Each 
filter offers options for when it is applied.  For example, the XML 
Transformer permits you specify that the filter should be applied when the 
root element is "html", or the doctype is "xhtml", or when the text comes 
from one or more specific applications.

I have not yet updated the KTTS Handbook to explain filters.  The following 
tips will be of help:

1.  In the String Replacer, a "word" is matched using the regular expression 

2.  In the String Replacer, regular expressions are case insensitive.

3.  For those filters that permit it, you may enter more than one Application 
ID, separated by commas.  App IDs are always lowercase.  Example: 

4.  Filters are applied in the order specified on the "Filters" tab of 
KTTSMgr, i.e., top to bottom.

5.  Filters are applied only to regular text jobs and to KNotify messages.  
Other messages (from KMouth for example), warnings, and screen reader outputs 
are not filtered.

6.  If a filter is unchecked in the "Filters" tab, it is "inactive" and will 
not be applied.

7.  The Talker Chooser works by changing the Talker Code of the text job.  The 
normal algorithm is then applied to choose the closest matching Talker from 
those you have configured on the "Talkers" tab.

In addition, you will see a "Standard Sentence Boundary Detector" filter at 
the bottom of the "Filters" tab.  This filter splits long text into 
individual sentences so that you can rewind/advance and improves performance.  
I don't advise messing with its settings.  (In the future, we will be able to 
support languages with non-latin punctuation by adding additional SBD 

Sentence Boundary Detection (SBD) filters are always run after all other 
filters.  If there is more than one SBD filter, the first instance of an SBD 
filter that changes the text stops any further filtering.

The Standard SBD works with SSML, as well as plain text.  Prior to 
implementation of the Standard SBD filter, SSML was treated as one giant 
"sentence", which caused long delays, memory problems, and even crashes.

Filters and SBDs can be useful for solving certain synthesizer problems.  For 
example, the Polish Festival voice has the annoying habit of speaking 
sentence punctuation.  To fix this, do the following:  In the "Filters" tab, 
click the "Configure" button to the right of the SBD list and choose Add.  In 
the filter configuration dialog that appears, make the following entries:

  Name: Polish Festival Sentence Detector
  Sentence boundary regular expression: ([\.\?\!\:\;])(\s|$|(\n *\n))
  Replacement sentence boundary: \t
  Language is: Polish

Note the absence of the "\1" capture in the Replacement sentence boundary.  
Click OK.  Click the Configure button and choose Up so that the Polish SBD is 
listed before the Standard SBD.  Click Apply to save the settings.

The Polish Festival voice also chokes on {}() characters.  You can fix this by 
adding a String Replacer filter.  In the "Filters" tab, click the Add button 
and choose "String Replacer".  Click the Clear button.  Click the Add button 
and enter the following:

  Type: Regular expression
  Match: \{\}\(\)

Leave "Replace with" blank and click OK.  Set the Language to Polish, click OK 
and then Apply to save the settings.

There should be many useful things you can do with these filters.  If you come 
up with word lists or xslt files of your own and think they ought to be 
distributed with KTTS, please email them to me.  (You can save word lists in 
the String Replacer filter configuration dialog by clicking the Save button.)

In order to play with these new features you'll need to download the latest 
code from CVS (kdeaccessibility/kttsd) and build.  If you have not updated 
kdelibs recently, first "cvs up" kdelibs/interfaces/kspeech and "make 
install", or just copy kspeech.h to $KDEDIR/include.  (See my earlier message 
concerning change of class name from kspeech to KSpeech.)

Gary Cramblitt (aka PhantomsDad)
KDE Text-to-Speech Maintainer

More information about the kde-accessibility mailing list