Developer's Guide to KTTS
Prev
Next

Chapter 4. Developer's Guide to KTTS

KTTS has two Application Programmer Interfaces (APIs):

The following section gives a short description of the KDE Text-to-Speech API DCOP Interface. Full documentation for both APIs is available online at the KDE Accessibility web site (http://accessibility.kde.org).

The KTTS DCOP Interface

Applications communicate requests for Text-to-Speech services via the KDE DCOP interface to program kttsd object KSpeech.

Enter the following commands in a Konsole.

If KTTSD is not already running

kttsd

To queue a text job to be spoken

dcop kttsd KSpeech setText "text" "talker"

where text is the text to be spoken, and talker is a language code such as en, cy, etc. This command does not speak the text; instead it queues a text job for speaking.

Example.

dcop kttsd KSpeech setText "This is a test." "en"

To speak the last queued text job

dcop kttsd KSpeech startText 0

In this case, 0 refers to the last text job queued. You may also specify a specific job number. (If no job number is given, a 0 is required.)

To stop the currently speaking text job

dcop kttsd KSpeech stopText 0

Depending upon the speech plugin used, speaking may not immediately stop.

There are many more commands that can be sent. To see a list of possible commands,

dcop kttsd KSpeech

or read the KDE Text-to-Speech API online.

Prev
Next
Home


Would you like to comment or contribute an update to this page?
Send feedback to the TDE Development Team