#### Preface Chapter 1 Chapter 2 Chapter 3 Chapter 4 Chapter 5

# Chapter 3:
DECtalk Software Sample Programs

This chapter provides instructions on how to build the sample programs. Topics include:

- DECtalk Software Sample Programs

- Building DECtalk Software Sample Programs

## Sample Programs

Some applications are included with DECtalk Software. These sample applications have been included to demonstrate the use of DECtalk Software APIs. These sources can be used as templates for other applications that you might want to develop. Sources to these programs can be found in:

/usr/examples/dtk/dtsamples

The samples and a brief description are listed below.

- xmsay.c and xmsay and its companion uil file xmsay.uil demonstrate the use of DECtalk Software APIs in the Motif windows environment.

- say.c This is a command line program that speaks out the text typed on the command line.

- mailtalk.c -- mailtalk announces the arrival of mail when new mail is received. The file mailtalk.ini in /usr/lib/dtk/ contains default announcement messages that mailtalk uses. To have mailtalk speak your own custom messages copy the mailtalk.ini file into your login directory and edit the strings.

- aclock.c -- Announces the time at specified intervals.

- dtmemory.c -- In dtmemory DECtalk Software passes back synthesized speech in buffers. These buffers are written out into a wave file.

## Building the Sample Programs

Sample programs can be created from the sources provided in /usr/examples/dtk/dtsamples. This section describes the procedure for building the sample programs. Before proceeding make sure that the DECtalk Software development kit has been installed. See the DECtalk Software Users Guide for more information on different components of DECtalk Software.

1. Create a local directory that you want to build he sample programs in.

2. Copy all the files in /usr/examples/dtk/dtsamples into the directory that you just created.

3. Generate a Makefile from the Imakefile by typing:

   `/usr/bin/X11/xmkmf`

4. Compile and link the sample application programs by typing the following while still in the directory that you just created:

   `make all`

5. After the make program completes successfully, the sample programs are ready to run.

In addition to the sample programs you will also find some demo text files in your directory. These files demonstrate some of the DECtalk Software capabilities.

###

Programming

This section describes the DECtalk API programming environment. Topics include:

1. Header files

2. Shareable libraries

3. Compiling and linking applications

### Header Files

DECtalk provides three header files that contain all the public data-structure definitions that the DECtalk Software API references. They are ttsapi.h, dtmmedefs.h, and engphon.h. When DECtalk Software is installed, these files are in /usr/include/dtk.

- ttsapi.h contains definitions of constants used in the DECtalk Software API calls, data structures that define the buffers that DECtalk Software returns, and the API function prototype definitions.

- dtmmedefs.h contains the basic data structure definitions used by DECtalk Software. It also contains definitions of error codes and audio formats. This file enables you to compile, link, and run certain DECtalk programs even if Multimedia Services for DIGITAL UNIX is not installed. Specifically, if you are writing an application program that does not use the audio drivers but want to use DECtalk Software to produce synthesized speech buffers (via the TextToSpeechInMemory calls), then using dtmmedefs.h circumvents the requirement for Multimedia Services for DIGITAL UNIX .

- engphon.h contains a list of American English Phoneme Codes.

### Shareable Libraries

DECtalk Software APIs are available to programmers in two shareable libraries.

- libtts.so contains device independent DECtalk Software routines.

- libttsmme.so contains the DECtalk Software library that requires Multimedia Services for DIGITAL UNIX .

As in the case of the header files, if you want to use DECtalk Software to write an application that produces buffers of synthesized speech, then the program is linked with libtts.so. If, on the other hand, you want to use the Multimedia Services for DIGITAL UNIX to communicate with the audio subsystem then the application has to be linked with libttsmme.so.