# The &kmouth; Handbook

Gunnar
Schmi Dt

    gunnar@schmi-dt.de

2002
2003
Gunnar Schmi Dt
&FDLNotice;
2006-05-20
1.1.1

&kmouth; is an application that enables persons that cannot speak to let their computers speak.

KDE
kdeutils
KMouth
text-to-speech conversion
mutual persons

## Introduction

&kmouth; is a program that enables persons that cannot speak to let their computers speak. It includes a history of spoken sentences from which the user can select sentences to be re-spoken.

Note that &kmouth; does not include speech synthesizer. Instead it requires a speech synthesizer installed in the system.

Please report any problems and feature requests to the author of &kmouth;.

## Using &kmouth;

### The first start

During the first start of &kmouth;, a wizard is displayed into which you can enter some basic configuration.

The wizard The wizard

With the first page of the wizard (the left screen shot) you specify the command that shall later be used for the text-to-speech conversion. For more details look into the description of the configuration dialog.

With the second page you select which standard phrase books you need. From the phrase books you later can select often used phrases so that you do not need to type them in. Of course &kmouth; also has an edit dialog for the case that you later want to edit your phrase books.

With the third page (the right screen shot) you define the dictionary for a word completion. &kmouth; will parse the &kde; documentation of the chosen language in order to detect the frequentness of individual words. Optionally you can compare the word list to an OpenOffice.org dictionary in order to only add correctly spelled words to the word completion.

### The Main Window

The main window of &kmouth; is fairly simple. It consists basically of an edit field into which you type your sentences (the lower white field in the screen shot) and a history of spoken sentences (the upper white field in the screen shot).

The main window of &kmouth; Screen shot

Assuming that you have correctly configured &kmouth; you can use the edit field for entering sentences you want to hear. Once a sentence got spoken it will be appended to the history. From the history you can select sentences to be re-spoken.

From the phrase books (located in the line below the tool bar) you can select often used phrases.

### The Configuration Dialog

By using the menu entry Settings Configure &kmouth;... you open the configuration dialog of &kmouth;. This dialog consists of the pages General Options with the two tabs Text-to-Speech and Preferences, the page Word Completion and the page KTTSD Speech Service

#### The Text-to-Speech tab

The Text-to-Speech tab Screen shot

Into the edit field of the Text-to-Speech tab you enter the command for calling the speech synthesizer. With the combo box below the edit field you specify the character encoding that is used for passing the text to the speech synthesizer.

&kmouth; knows two ways of passing the text: If the command expects the text as standard input you select the check box.

The other way is to pass the text as a parameter: Before calling the command &kmouth; replaces certain placeholders with actual content:

Placeholder | Replaced with
--- | ---
%t | The actual text that should be spoken
%f | The name of a temporary file that contains the text that should be spoken
%l | The language code associated with the current word completion dictionary
%% | A percent sign

Off course the command for speaking texts is dependent on which speech synthesizer you use. Please look into the documentation of your speech synthesizer for the command for speaking texts. You can find examples for the command in the appendix.

By selecting Use KTTSD speech service if possible you tell &kmouth; first to try to send the text to the KTTSD speech service. If this succeeds the other configuration entries on this tab are ignored. The KTTSD speech service is a &kde; daemon which gives &kde; applications a standardized interface for speech synthesis and is currently developed in SVN. It is safe to select this option even if KTTSD is not installed.

#### The Preferences tab

The Preferences tab Screen shot

The Preferences tab contains options that alter the behavior of &kmouth; in certain situations.

With the first combo box, Selection of phrases in the phrase book:, you specify which action is triggered by typing the shortcut of a phrase or by selecting a phrase in the Phrase Book menu or in the phrase book bar.

By selecting Speak Immediately the selected phrase gets immediately spoken and is entered into the history. If you select Insert Into Edit Field the selected phrase is just inserted into the edit field.

With the second combo box, Closing the phrase book edit window:, you specify whether the phrase book gets saved if you just close the phrase book edit window.

By selecting Save Phrase Book the phrase book gets saved. If you select Discard changes the changes are discarded and the phrase book is not saved. If you select Ask Whether to Save &kmouth; will ask you whether it shall save the phrase book.

#### The Word Completion page

The Word Completion page Screen shot

The Word Completion page contains a list of dictionaries used for the word completion. (&kmouth; will display a combo box next to the edit field in the main window if this list contains more than one dictionary. You can use this combo box in order to select the dictionary that actually gets used for the word completion.)

With the buttons on the right side of the page you can add and delete dictionaries, change the order of the dictionaries or export dictionaries to a file. With the edit field and the combo box below the list you can change the name and the language associated with the dictionary.

When you add a new dictionary you may choose between several sources:

- Create a new dictionary from the &kde; documentation

  If you use this source &kmouth; will ask you for the intended language and afterwards parse the &kde; documentation. The frequentness of the individual words is detect by simply counting the occurrences of each word. Optionally you can compare the word list to an OpenOffice.org dictionary in order to only add correctly spelled words to the new dictionary.

- Create a new dictionary from a file

  If you use this source &kmouth; will ask you for the intended file. You may either select an &XML; file, a standard text file or a file containing a word completion dictionary created by either &kmouth; or GOK (the GNOME On-screen Keyboard). If you select a standard text file or an &XML; file the frequentness of the individual words is detected by simply counting the occurrences of each word. Optionally you can compare the word list to an OpenOffice.org dictionary in order to only add correctly spelled words to the new dictionary.

- Create a new dictionary from a folder

  If you use this source &kmouth; will ask you for the intended folder. &kmouth; will open all files in that folder and its subdirectories. Each file is either loaded as a completion dictionary, as an &XML; file or as a standard text file. In the latter two cases the occurrences of each individual word in the file is counted. Optionally you can compare the word list to an OpenOffice.org dictionary in order to only add correctly spelled words to the new dictionary.

- Merge dictionaries

  You can use this option in order to merge the available dictionaries. &kmouth; will ask you which dictionaries should be merged and how the individual dictionaries should be weighted.

- Create an empty word list

  You can use this option in order to create a blank dictionary without any entries. As &kmouth; automatically adds newly typed words to the dictionaries it will learn your vocabulary with the time.

#### The KTTSD Speech Service page

The configuration of the &kde; Speech Service is described in detail in the KTTS Handbook.

### The Phrase Book Edit Window

By using the menu entry Phrase Books Edit... you open the phrase book edit window.

The phrase book edit window Screens hot

The main area of the phrase book edit window is divided into two parts. Within the upper part the phrase books are displayed in some tree structure.

Within the lower part you may modify a selected item. If you have selected a phrase you can modify the contents of the phrase as well as its shortcut. If you have selected a phrase book you can only change its name.

Actions like adding new phrases and phrase books and deleting selected phrases and phrase books can be done by selecting them in either the menu bar, the toolbar or a pop up menu.

You can change the order of the phrase books and phrases by dragging them to their new places or by using the arrow keys while the &Alt; key is pressed.

## Command Reference

### Commands Within The Main Window

#### The File Menu

&Ctrl;O File Open as History...

  Opens a text file into as history of spoken sentences.

&Ctrl;S File Save History As...

  Saves the history into a text file.

&Ctrl;P File Print History...

  Prints the history.

&Ctrl;Q File Quit

  Quits &kmouth;

#### The Edit Menu

&Ctrl;X Edit Cut

  Cuts the selected section and puts it to the clipboard. If there is some text selected in the edit field it is placed it on the clipboard. Otherwise the selected sentences in the history (if any) are placed on the clipboard.

&Ctrl;C Edit Copy

  Copies the selected section to the clipboard. If there is some text selected in the edit field it is copied to the clipboard. Otherwise the selected sentences in the history (if any) are copied to the clipboard.

&Ctrl;V Edit Paste

  Pastes the clipboard contents at the current cursor position into the edit field.

Edit Speak

  Speaks the currently active sentence(s). If there is some text in the edit field it is spoken. Otherwise the selected sentences in the history (if any) are spoken.

#### The Phrase Books Menu

Phrase Books Edit...

  Opens the phrase book edit window.

#### The Settings Menu

&Ctrl;M Settings Show Menubar

  When checked, this displays the menubar. When unchecked the menubar is hidden.

Settings Show Toolbar

  When checked, this displays a movable toolbar containing buttons used to initiate frequently used commands. The toolbar is most commonly located at the top of the editor just under the menu. When unchecked the toolbar is hidden. Clicking on the striated grip and dragging allows the user to move the bar.

Settings Show Statusbar

  When checked, this displays a small bar at the bottom of the main window containing information about the status of &kmouth;. When unchecked the status bar is hidden.

Settings Show Phrasebook Bar

  When checked, this displays a movable phrasebook bar containing buttons for the phrasebook entries. The phrasebook bar is most commonly located at the top of the editor just under the toolbar. When unchecked the phrasebook bar is hidden. Clicking on the striated grip and dragging allows the user to move the bar.

Settings Configure KMouth...

  Opens the configuration dialog for the speech synthesizer and other &kmouth; settings.

#### The Help Menu

&help.menu.documentation;

#### The pop up menu of history entries

Speak

  The selected sentences are spoken.

Delete

  The selected sentences are removed from the history.

Cut

  The selected sentences are deleted and placed on the clipboard.

Copy

  The selected sentences are copied to the clipboard.

Select All Entries

  All history entries are selected.

Deselect All Entries

  All history entries are deselected.

&Ctrl;O Open as History...

  Opens a text file into as history of spoken sentences.

&Ctrl;S Save History As...

  Saves the history into a text file.

### Commands within the phrase book edit window

#### The File Menu

File New Phrase

  Adds a new phrase.

File New Phrase Book

  Adds a new phrase book.

&Ctrl;S File Save

  Saves the phrase book.

File Import...

  Imports a file and adds its contents to the phrase book

File Import Standard Phrase Book

  Imports a standard phrase book and adds its contents to the phrase book

File Export...

  Exports the currently selected phrase(s) or phrase book(s) to a file

&Ctrl;P File Print...

  Prints the currently selected phrase(s) or phrase book(s)

&Ctrl;W File Close

  Closes the window

#### The Edit Menu

&Ctrl;X Edit Cut

  Cuts the selected items and puts it to the clipboard.

&Ctrl;C Edit Copy

  Copies the selected items to the clipboard.

&Ctrl;V Edit Paste

  Pastes the clipboard contents into the phrase book.

Edit Delete

  Deletes the selected items.

#### The Help Menu

&help.menu.documentation;

#### The Pop up Menu

New Phrase

  Adds a new phrase.

New Phrase Book

  Adds a new phrase book.

Import...

  Imports a file and adds its contents to the phrase book

Import Standard Phrase Book

  Imports a standard phrase book and adds its contents to the phrase book

Export...

  Exports the currently selected phrase(s) or phrase book(s) to a file

&Ctrl;X Cut

  Cuts the selected items and puts it to the clipboard.

&Ctrl;C Copy

  Copies the selected items to the clipboard.

&Ctrl;V Paste

  Pastes the clipboard contents at this position into the phrase book.

Delete

  Deletes the selected items.

## Questions and Answers

&reporting.bugs; &updating.documentation;

I do not hear anything.

Most likely you did not configure correctly (or not at all?) the text-to-speech command. Use Settings Configure &kmouth;... , open the page General Options and enter the command for speaking texts on the tab Text-to-Speech. (See section about the configuration dialog for the speech synthesizer for more details.)

## Credits and License

&kappname;

Program copyright 2002-2004 Gunnar Schmi Dtgunnar@schmi-dt.de

Documentation copyright 2002-2004 Gunnar Schmi Dt gunnar@schmi-dt.de

&underFDL; &underGPL;

## Examples for the text-to-speech configuration

Festival

Festival is a text-to-speech system written from the University of Edinburgh. It currently supports English, Spanish and Welsh speech. Its license allows to use and distribute Festival free of charge without restrictions.

In order to create the command line example for the text-to-speech configuration we assume that Festival is installed in the directory `/usr/local/festival/`. The command for speaking texts then is as follows:

    /usr/local/festival/bin/festival --tts

The option Send the data as standard input must be enabled.

FreeTTS

FreeTTS is a speech synthesizer written entirely in the &Java;™ programming language. It currently only has support for English pronounciation. Its license allows to use and distribute FreeTTS free of charge without restrictions.

In order to create the command line example for the text-to-speech configuration we assume that FreeTTS is installed in the directory `/usr/local/freetts/`. The command for speaking texts then one of the following three examples:

    java -jar /usr/local/freetts/lib/freetts.jar -text %t

    java -jar /usr/local/freetts/lib/freetts.jar -file %f

    java -jar /usr/local/freetts/lib/freetts.jar

For the third example the option Send the data as standard input must be enabled. (This one is the preferred example for the use with FreeTTS.)

MBROLA

MBROLA is a speech synthesizer for a large number of languages. It converts a list of phonemes to a wave file, so you need some other tool to convert the text into a list of phonemes. The license of MBROLA allows to use and MBROLA free of charge for non-commercial, non-military applications.

For our example we will use Hadifax in order to convert German texts into a list of phonemes suitable for MBROLA. We will assume that Hadifax and MBROLA are installed to `/usr/local/hadifax/` and `/usr/local/mbrola/`.

Unfortunately Hadifax tends to swallow the last character of the text, so we may want to add an additional character to the text. The complete command is therefore more complex than the previous examples:

    (cat -; echo " ") | /usr/local/hadifax/txt2pho -f
              | /usr/local/mbrola/mbrola -e
              /usr/local/mbrola/de1/de1 - /tmp/tmp.wav;
              artsplay /tmp/tmp.wav; rm /tmp/tmp.wav

All parts of this command need to be written into one line. The option Send the data as standard input must be enabled.

The &kde; Text-to-Speech Daemon

The &kde; Text-to-Speech Daemon (KTTSD) is a &kde; wide text-to-speech service which gives &kde; applications a standardized interface for speech synthesis and is currently developed in SVN. It uses plug-ins in order to support various text-to-speech systems.

As the configuration of the speech synthesizer is done in KTTSD the only &kmouth;-specific option you need to activate is Use KTTSD speech service if possible.

Of course you need to configure KTTSD. You may do this with the configuration page KTTSD Speech Service that is added to the configuration dialog of &kmouth; if KTTSD is installed.

## Installation

### How to obtain &kmouth;

&install.intro.documentation;

### Requirements

In order to successfully use &kmouth;, you need a speech synthesizer (and of course &kde; 3.x). &kmouth; uses about 15 MB of memory to run (plus the amount of memory needed by your speech synthesizer), but this may vary depending on your platform and configuration.

### Compilation and Installation

&install.compile.documentation;