KTTSD

Gary Cramblitt

KTTSD is a non-GUI component of KTTS that handles requests from applications. It performs queuing and prioritization and feeds messages to other components for filtering, synthesis, and audio playback. KTTSD endeavors to keep the synths busy by working ahead, keeping up to 3 sentences in the output queue ready for playback.


1 DCOP

Applications communicate with KTTSD via DCOP.

Example command-line dcop call:

dcop kttsd KSpeech sayText "Hello World" "gender='female'"

An example from KMouth (manual marshalling):

bool kttsdSay (const QString &text, const QString &language) {

DCOPClient *client = kapp->dcopClient();

QByteArray data;

QCString replyType;

QByteArray replyData;

QDataStream arg(data, IO_WriteOnly);

arg << text << language;

return client->call("kttsd", "KSpeech", "sayWarning(QString,QString)",

data, replyType, replyData, true);

}

An example from KTTSMgr (using kspeech_stub to do the marshalling):

void KttsJobMgrPart::slot_speak_clipboard()

{

// Get the clipboard object.

QClipboard *cb = kapp->clipboard();

// Copy text from the clipboard.

QString text;

QMimeSource* data = cb->data();

if (data)

{

if (data->provides("text/html"))

{

if (supportsMarkup(NULL, KSpeech::mtHtml))

{

QByteArray d = data->encodedData("text/html");

text = QString(d);

}

}

if (data->provides("text/ssml"))

{

if (supportsMarkup(NULL, KSpeech::mtSsml))

{

QByteArray d = data->encodedData("text/ssml");

text = QString(d);

}

}

}

if (text.isEmpty())

text = cb->text();

// Speak it.

if ( !text.isEmpty() )

{

uint jobNum = setText(text, NULL);

startText(jobNum);

}

}

1.1 KDE Apps

1.1.1 KTTSMgr

KTTSMgr is a GUI for controlling speech output and setting configuration options. From the viewpoint of KTTSD, KTTSMgr is just another application. The only difference is that it writes settings to the kttsdrc file and then tells KTTSD to reread the settings. KTTSMgr is a KCModule and therefore also available in the KDE Control Center under Accessibility. It provides a systray icon for easy access. It also has an option to automatically start KTTSMgr in the systray whenever speaking.

1.1.2 Konqi

From Konqueror, one can speak all or any selected portion of a web page. If you have an XHTML-to-SSML filter configured, it will "rich speak" the page, using a variety of genders, volumes, and speaking rates.

1.1.3 Kate

1.1.4 KMouth

1.1.5 KPDF

From KPDF, you can select any text and send it to KTTSD. Unfortunately, this means you can speak at most one page at a time. I believe the KPDF team plans to migrate to the Poppler engine, which should make it possible to speak all the text from an entire pdf file.

1.1.6 amaroK + tts.py

amaroK has a neat little plugin available on kde-apps.org that speaks the artist and title of tracks as each begins playing. In effect, adds a "Disc Jockey" to amaroK. Nice.

TTS amarok script

1.1.7 KAlarm

1.1.8 Other KDE Apps

1.2 KNotify

In KTTSMgr, you can configure KTTS to speak events sent by applications via KNotify. For example, I have my system configured to speak messages from Konversation whenever someone mentions my nickname. Filters take care of removing markup and convert chat emoticons and abbreviations to speakable words. For example, the following message in Konvi

<wheels> Hi PhantomsDad. :)

is spoken as

wheels says Hi PhantomsDad smiles