aa spfy speechify - avaya support · the information in this document is subject to change without...

149
User’s Guide S P E E C H I F Y 2.1.5

Upload: dangtuyen

Post on 01-Sep-2018

213 views

Category:

Documents


0 download

TRANSCRIPT

User’s Guide

S P E E C H I F Y 2 .1 .5

Speechify User’s Guide

Document History

Date Release Name

January 2003 Fifth Edition, update for Speechify 2.1.5 September 2002 Fifth Edition, update for Speechify 2.1.3 May 2002 Fifth Edition, Speechify 2.1January 2002 Fourth Edition, update for Speechify 2.0December 2001 Fourth Edition, Speechify 2.0 May 2001 Third Edition, Speechify 1.2March 2001 Second Edition, Speechify 1.1 November 2000 First Edition, Speechify 1.0

Fifth Edition, Update 2 SpeechWorks Proprietaryii

Notice

Copyright © 2000–2003 by SpeechWorks International, Inc. All rights reserved.

The information in this document is subject to change without notice.

Use of this document is subject to certain restrictions and limitations set forth in a license agreement entered into betweenSpeechWorks International, Inc. and purchaser of the Speechify software. Please refer to the SpeechWorks license agreementfor license use rights and restrictions.

SpeechWorks is a registered trademark, and OpenSpeech, DialogModules, SMARTRecognizer, Speechify, SpeechSecure,SpeechSite, SpeechWorks Here, the SpeechWorks logo and the SpeechWorks Here logo are trademarks or registered trade-marks of SpeechWorks International, Inc. in the United States and other countries. All other trademarks are property of theirrespective owners. Windows NT is a registered trademark of Microsoft Corporation.

Published by:

SpeechWorks International, Inc.695 Atlantic AvenueBoston, MA 02111 USA

Speechify User’s Guide

SpeechWorks Proprietary

Table of Contents

Preface ............................................................................................................................................. ix

1. Installing and Configuring Speechify

Hardware and software requirements...................................................................... 1-2

Installation on Windows NT/2000 ........................................................................ 1-4

Uninstalling on Windows/NT 2000 ................................................................... 1-5

Installation on Red Hat Linux................................................................................ 1-6

Installing the Speechify server ............................................................................. 1-6Installing the Speechify client.............................................................................. 1-6Installed file locations ......................................................................................... 1-7Uninstalling the Speechify server......................................................................... 1-7Uninstalling the Speechify client ......................................................................... 1-8

Installation on Solaris ............................................................................................. 1-9

Installing the Speechify server ............................................................................. 1-9Installing the Speechify client............................................................................ 1-10Installed file locations ....................................................................................... 1-10Configuring shared memory ............................................................................. 1-11Uninstalling the Speechify server....................................................................... 1-11Uninstalling the Speechify client ....................................................................... 1-12

Running the Speechify server from the console..................................................... 1-13

Starting Speechify ............................................................................................. 1-13Stopping Speechify ........................................................................................... 1-16

Running Speechify as a Windows Service ............................................................. 1-17

Configuring the server ...................................................................................... 1-17Running and stopping the server ...................................................................... 1-19

2. Programming Guide

Features ................................................................................................................ 2-22

Order of API functions......................................................................................... 2-23

Callback function ................................................................................................. 2-24

Sample time lines ................................................................................................. 2-26

Overview of user dictionaries................................................................................ 2-30

Fifth Edition, Update 2iii

Dynamic parameter configuration ....................................................................... 2-30

Character set support .......................................................................................... 2-31

Operational aids .................................................................................................. 2-31

Implementation guidelines .................................................................................. 2-31

3. Standard Text Normalization

Numbers ............................................................................................................. 3-34

Numeric expressions ............................................................................................ 3-35

Mixed alphanumeric tokens ................................................................................. 3-35

Abbreviations ...................................................................................................... 3-36Ambiguous abbreviations.................................................................................. 3-36Periods after abbreviations................................................................................. 3-36Measurement abbreviations............................................................................... 3-37

E-mail addresses .................................................................................................. 3-37

URLs ................................................................................................................... 3-38

Pathnames and filenames ..................................................................................... 3-39

Punctuation ......................................................................................................... 3-40

Parentheses .......................................................................................................... 3-41

Hyphen ............................................................................................................... 3-41

Slash .................................................................................................................... 3-42

4. Embedded Tags

Speechify tag format ............................................................................................. 3-44

Creating pauses ................................................................................................... 3-44

Indicating the end of a sentence .......................................................................... 3-45

Customizing pronunciations ............................................................................... 3-46Language-specific customizations...................................................................... 3-46Character spellout modes.................................................................................. 3-47Pronouncing numbers and years ....................................................................... 3-49Customizing word pronunciations .................................................................... 3-50

Inserting bookmarks ............................................................................................ 3-50

Controlling the audio characteristics .................................................................... 3-51Volume control ................................................................................................. 3-52Speaking rate control ........................................................................................ 3-53

Fifth Edition, Update 2 SpeechWorks Proprietaryiv

5. Symbolic Phonetic Representations

SPR format........................................................................................................... 4-56

Syllable boundaries .............................................................................................. 4-56

Syllable-level information .................................................................................... 4-56

Speech sound symbols ......................................................................................... 4-57

6. User Dictionaries

Overview of dictionaries ...................................................................................... 5-60

Main dictionary ................................................................................................... 5-60Additional notes on main dictionary entries...................................................... 5-61

Abbreviation dictionary ....................................................................................... 5-61Interpretation of trailing periods in the abbreviation dictionary ........................ 5-61

Root dictionary ................................................................................................... 5-62

Choosing a dictionary ......................................................................................... 5-63Main and abbreviation dictionaries vs. root dictionary...................................... 5-64Main dictionary vs. abbreviation dictionary ...................................................... 5-64Dictionary interactions ..................................................................................... 5-65

File-based dictionaries ......................................................................................... 5-66Dictionary loading............................................................................................ 5-67File names and locations ................................................................................... 5-68File format ........................................................................................................ 5-68

7. API Reference

Calling convention ............................................................................................... 6-70

Server’s preferred character set ............................................................................. 6-70

Result codes.......................................................................................................... 6-71

SWIttsAddDictionaryEntry( ) ............................................................................. 6-73

SWIttsCallback( )................................................................................................ 6-75

SWIttsClosePort( ) .............................................................................................. 6-80

SWIttsDeleteDictionaryEntry( ).......................................................................... 6-81

SWIttsGetDictionaryKeys( ) ............................................................................... 6-83

SWIttsGetParameter( ) ........................................................................................ 6-86

SWIttsInit( )........................................................................................................ 6-88

SWIttsLookupDictionaryEntry( )........................................................................ 6-89

SpeechWorks Proprietary Fifth Edition, Update 2v

SWIttsOpenPort( ) .............................................................................................. 6-91

SWIttsPing( ) ...................................................................................................... 6-92

SWIttsResetDictionary( ) .................................................................................... 6-93

SWIttsSetParameter( ) ......................................................................................... 6-94

SWIttsSpeak( ) .................................................................................................... 6-96

SWIttsStop( ) ...................................................................................................... 6-98

SWIttsTerm( ) ..................................................................................................... 6-99

8. Performance and Sizing

Test scenario and application .............................................................................. 7-102

Performance statistics ......................................................................................... 7-103

Latency (time-to-first-audio)........................................................................... 7-103Real-time factor .............................................................................................. 7-103Audio buffer underflow................................................................................... 7-104

Resource consumption ....................................................................................... 7-105

Server CPU utilization.................................................................................... 7-105Memory use.................................................................................................... 7-105Measuring server memory use on Windows NT/2000 .................................... 7-106

Performance thresholds ...................................................................................... 7-107

Appendix A: Speechify Logging

Overview of logs ................................................................................................A-109Error log .........................................................................................................A-109Diagnostic log.................................................................................................A-110Event log (server only) ....................................................................................A-110

Client logging ....................................................................................................A-110Overview of client logs....................................................................................A-110Enabling diagnostic logging ............................................................................A-111Logging to stdout/stderr .................................................................................A-111

Server logging ....................................................................................................A-112Default logging behavior.................................................................................A-112Controlling logging with command-line options ............................................A-112Log file size and roll-over ................................................................................A-113Error message format ......................................................................................A-114Event logging..................................................................................................A-114

Fifth Edition, Update 2 SpeechWorks Proprietaryvi

Appendix B: SSML

Appendix C: SAPI 5

Compliance .......................................................................................................C-123

SAPI voice properties ........................................................................................C-125

Appendix D: Frequently Asked Questions

Question types ................................................................................................. D-128

Changing rate or volume .................................................................................. D-128

Rewinding and fast-forwarding ......................................................................... D-129

Java interface .................................................................................................... D-129

E-mail pre-processor and SAPI 5 ...................................................................... D-129

SSML and SAPI 5 ............................................................................................ D-129

Error codes 107 and 108 .................................................................................. D-130

Speechify 2.1 and Speechify 2.0 voices ............................................................. D-131

Connecting to the server .................................................................................. D-131

Finding voices .................................................................................................. D-132

Port types ......................................................................................................... D-132

Index

SpeechWorks Proprietary Fifth Edition, Update 2vii

Fifth Edition, Update 2 SpeechWorks Proprietaryviii

Preface

Welcome to SpeechWorks

Speechify™ is SpeechWorks International, Inc.’s state of the art Text-To-Speech (TTS) system. This guide is written for application developers who want to add Speechify’s high-quality text-to-speech functionality to their applications.

New and changed information

Changes in 2.1.5

Installation changes

❏ There are updates to various installation commands in Chapter 1.

❏ The supported Red Hat version has changed. See page 1-3 and page 1-6.

New conceptual overviews

❏ Chapter 3 is new. It explains the automatic normalization performed by Speechify on your input text.

SpeechWorks Proprietary Fifth Edition, Update 2ix

Speechify User’s Guide

❏ Appendix D contains elaborations on “Frequently Asked Questions”.

Embedded tags

❏ A new tag is added for end of sentence. See page 4-45.

Symbolic phonetic representations (SPRs)

❏ There are brief additions to the sections on syllable boundaries and marking syllable-level stress (page 5-56).

User dictionaries

❏ A new section compares each of the dictionaries and explains which dictionary to use for which situations. See page 6-63.

❏ The ability to create dictionary files, in addition to defining them at runtime with API functions, is described on page 6-66.

API functions

❏ Details are added to the description of the character set parameters for various functions:

“SWIttsAddDictionaryEntry( )” on page 7-73“SWIttsDeleteDictionaryEntry( )” on page 7-81“SWIttsLookupDictionaryEntry( )” on page 7-89

❏ Small clarifications are added to the SWIttsSpeak( ) function. See page 7-96.

SAPI

❏ Added text and new supported output formats. See step 3 on page C-124.

Changes in 2.1.3

Changes in this release are not indicated with change bars.

This release has the following documentation changes:

Fifth Edition, Update 2 SpeechWorks Proprietaryx

Speechify User’s Guide

❏ Chapter 1 now lists the installation directories and the files installed in each for Red Hat Linux and Sun Solaris.

❏ A new command option (default_contenttype) when running Speechify from a console. See page 1-13.

❏ Speechify now provides tags to set output audio characteristics for volume and speaking rate. The section “Controlling the audio characteristics” on page 4-51 describes this new feature.

❏ File-based dictionaries are described in “User Dictionaries” on page 6-59.

❏ Dictionary keys in the root dictionary must contain at least one vowel. See “Beware of keys without vowels” on page 6-63.

❏ To support the volume/rate control feature, these parameters are now available via SWIttsSetParameter( ) and SWIttsGetParameter( ): tts.audio.rate and tts.audio.volume.

❏ You can now query the current Speechify version number via the SWIttsGetParameter( ) function with the tts.client.version parameter.

❏ The SSML element “prosody” is now partially supported. See “SSML” on page B-119.

❏ In the SPR chapter, information about “Syllable Stress” has been moved to each language version of the Speechify Language Supplement. This was done because SPRs can handle stress, tone, and accent differently in each language.

❏ Event logging tokens have been added to Appendix A.

❏ You can now log diagnostic messages to a file. See “Enabling diagnostic logging” on page A-111.

Roadmap

Recommended reading (available documentation)

The following documents are available for developers using Speechify™ TTS applications:

SpeechWorks Proprietary Fifth Edition, Update 2xi

Speechify User’s Guide

❏ The Speechify User’s Guide provides installation, programming, and reference information about the Speechify product.

❏ The E-mail Pre-processor Developer’s Guide covers the types of input that the SpeechWorks E-mail Pre-processor handles, how it processes the messages, the modes that the application can take advantage of at run time, the layout and use of the E-mail substitution dictionary, and the API functions.

❏ There is a Speechify Language Supplement for each supported language. These supplements contain language-specific reference information for application developers.

❏ Review the release notes distributed with this product for the latest information, restrictions, and known problems.

SpeechWorks Institute

See the SpeechWorks Institute page at http://www.speechworks.com or send e-mail to [email protected] for details about available training courses.

Support services

To receive technical support from SpeechWorks International, Inc.:

❏ Visit the Knowledge Base or ask a question at:

http://www.speechworks.com/training/tech_support.cfm

❏ Ask for “technical support” at +1 617 428-4444

See Appendix A “Speechify Logging” for information on how to collect diagnostics that SpeechWorks may use to diagnose your problem.

How this guide is organized

The chapters of this document cover these topics:

Fifth Edition, Update 2 SpeechWorks Proprietaryxii

Speechify User’s Guide

Chapter 1 “Installing and Configuring Speechify” describes the installation requirements and installation packages.

Chapter 2 “Programming Guide” contains an overview of features, and high-level information on groups of API functions.

Chapter 4 “Embedded Tags” describes tags that users can insert into input text to customize the speech output in a variety of ways.

Chapter 5 “Symbolic Phonetic Representations” describes the phonetic spelling the user can enter to explicitly specify word pronunciations.

Chapter 6 “User Dictionaries” describes the user dictionaries available for customizing the pronunciations of words, abbreviations, acronyms, and other sequences.

Chapter 7 “API Reference” describes the API functions.

Chapter 8 “Performance and Sizing” summarizes the current performance numbers and how SpeechWorks arrives at those numbers.

Appendix A “Speechify Logging” describes how to enable and use the error log, diagnostic log, and event log.

Appendix B “SSML” describes Speechify’s compliance with the SSML specification.

Appendix C “SAPI 5” describes Speechify’s compliance with the SAPI 5 interface.

SpeechWorks Proprietary Fifth Edition, Update 2xiii

Speechify User’s Guide

Fifth Edition, Update 2 SpeechWorks Proprietaryxiv

CHAPTER 1

Installing and Configuring Speechify

This chapter describes the installation requirements and the installation packages for the Speechify client and server on the following platforms:

❏ Windows NT or 2000❏ Red Hat Linux❏ Sun Solaris

In this chapter

• Hardware and software requirements on page 1-2

• Installation on Windows NT/2000 on page 1-4

• Installation on Red Hat Linux on page 1-6

• Installation on Solaris on page 1-9

• Running the Speechify server from the console on page 1-13

• Running Speechify as a Windows Service on page 1-17

SpeechWorks Proprietary Fifth Edition, Update 21–1

Installing and Configuring SpeechifySpeechify User’s Guide

Hardware and software requirements

Server run-time hardware and software requirements

Speechify requires the following minimum hardware and software to run:

1. 500 MHz Intel Pentium III-based computer.

2. Memory requirements vary from one Speechify voice to another because each uses a different amount to start. See the readme file for each voice for details. Readme files are named readme-language-voice.html, e.g., readme-en-US-Mara.html. The readme files are stored in the root directory on the CD-ROM. In general, for a box that supports 72 ports, we recommend a minimum of 512 MB of RAM for Unix systems and 768 MB of RAM for Windows systems.

3. The Speechify server run-time software requires 15 MB of free disk space. Each Speechify voice has disk space requirements beyond that which vary from voice to voice. See the readme file for each voice for disk space requirements for voices.

4. Your system paging file size must be at least 300 MB.

5. CD-ROM drive to install the software.

6. Network Interface Card.

7. One of the following operating systems, configured for TCP/IP networking:

a. Microsoft Windows NT Workstation or Server 4.0 U.S. version with Service Pack 6a

b. Microsoft Windows 2000 Server or Professional U.S. version with Service Pack 1

c. Red Hat Linux 7.2.

d. Sun Solaris 2.7 for SPARC or Intel i386

8. Microsoft Windows users must have Internet Explorer 5.0 or later installed on their machine. To download Internet Explorer, go to:

http://www.microsoft.com/windows/ie/

9. Adobe Acrobat Reader 3.01 or later for reading the full Speechify documentation set.

Fifth Edition, Update 2 SpeechWorks Proprietary1–2

Speechify User’s Guide

Client SDK run-time hardware and software requirements

The following minimum hardware and software requirements for the application development tools within the Speechify SDK are:

1. 300 MHz Intel Pentium III-based computer.

2. 64 MB of RAM.

3. 10 MB of free disk space for the Speechify Software Development Kit (SDK).

4. CD-ROM drive to install the software.

5. Network Interface Card.

6. One of the following operating systems, configured for TCP/IP networking:

a. Microsoft Windows NT Workstation or Server 4.0 U.S. version with Service Pack 6

b. Microsoft Windows 2000 Server or Professional U.S. version with Service Pack 1

c. Red Hat Linux 7.2

d. Sun Solaris 2.7 for SPARC or Intel i386

7. Microsoft Windows users must have Internet Explorer 5.0 or later installed on their machine. To download Internet Explorer, go to:

http://www.microsoft.com/windows/ie/

8. A C/C++ compiler:

a. On Windows systems, SpeechWorks builds and tests with Microsoft Visual C++ 6 with Service Pack 3. Sample applications are provided with Visual C++ project files.

b. On Unix systems, SpeechWorks builds and tests with GNU GCC 2.95.2 which you download from:

http://www.gnu.org/software/gcc/gcc-2.95/gcc-2.95.2.html

9. Adobe Acrobat Reader 3.01 or later for reading the full Speechify documentation set.

SpeechWorks Proprietary Fifth Edition, Update 21–3

Installing and Configuring SpeechifySpeechify User’s Guide

Installation on Windows NT/2000

Internet Explorer 5.0 or later must be installed before installing Speechify.

1. Log into Windows NT/2000 as the Administrator.

2. Insert the Speechify CD into the CD-ROM drive.

3. The installer should run automatically; if not, open the CD-ROM drive in Windows Explorer and run setup.exe.

4. Follow the on-screen instructions, reading the Welcome screen and the Software License Agreement.

If you choose a “Typical” installation, the Speechify installer asks no further questions and installs the following components to C:\Program Files\Speechify:

• Speechify server run-time

• Speechify client run-time

• Speechify client SDK

To override these defaults and choose a different install location or different components, choose “Custom.” A dialog box appears for customizing the install.

5. When prompted, you should read the Speechify Release Notes to familiarize yourself with any special programming considerations and known bugs.

6. You must install a Speechify voice before you can run the server. All voice installations are described in the Speechify Language Supplement that corresponds to the language being spoken. See the appropriate supplement for more information.

In addition, the Speechify installation does the following:

❏ Installing the client SDK creates an environment variable named SWITTSSDK which points to the path where the SDK is installed.

❏ The Speechify installation uses Windows Installer technology and updates the copy on your machine if necessary before proceeding with the install.

❏ Speechify uses the Microsoft Management Console (MMC) for server configuration. The MMC comes with Windows 2000 by default but not with Windows NT. If your NT system does not have the MMC, Speechify installs it.

Fifth Edition, Update 2 SpeechWorks Proprietary1–4

Speechify User’s Guide

❏ If you choose to install the SAPI interface component, the Speechify installer only installs the SAPI 5 run-time components. It does not contain the SAPI 5 SDK that you can download from here: http://www.microsoft.com/speech/speechsdk/sdk5.asp. You need to download the SDK to have access to SAPI 5 documentation and sample code.

❏ The Speechify server is automatically configured to start at each reboot.

Uninstalling on Windows/NT 2000

To uninstall Speechify:

1. Go to Start >> Settings >> Control Panel >> Add/Remove Programs.

2. On the Install/Uninstall tab, locate Speechify 2.1 for Windows in the list of installed applications and click the Add/Remove button.

3. Follow the instructions to uninstall Speechify.

SpeechWorks Proprietary Fifth Edition, Update 21–5

Installing and Configuring SpeechifySpeechify User’s Guide

Installation on Red Hat Linux

Installing the Speechify server

1. Log into Linux as root.

2. Insert the Speechify CD into the CD-ROM drive.

3. Open a shell window and mount the CD-ROM. Then change directory to the directory that the CD-ROM device resides on. (This directory is usually /mnt/cdrom/.)

4. Copy the server files onto the machine:

rpm --install Speechify-Engine-2.1-5.i386.rpm

5. You must install a Speechify voice before you can run the server. All voice installations are described in a Speechify Language Supplement that corresponds to the language being spoken. See the appropriate supplement for more information.

Installing the Speechify client

1. Log into Linux as root.

2. Insert the Speechify CD into the CD-ROM drive.

3. Open a shell window and mount the CD-ROM. Then change directory to the directory that the CD-ROM device resides on. (This directory is usually /mnt/cdrom/.)

4. Copy the client files onto the machine:

rpm --install Speechify-Client-2.1-5.i386.rpm

Fifth Edition, Update 2 SpeechWorks Proprietary1–6

Speechify User’s Guide

NOTE

By default, the above packages install to /usr/local/bin and /usr/local/Speechify. To relocate the packages, specify the --prefix option to install to another directory, e.g., rpm --install --prefix /home/Speechify Speechify-Engine-2.1-5.i386.rpm.

Installed file locations

This table shows where certain files are located after installing various packages:

Uninstalling the Speechify server

1. Log into Linux as root.

2. First, uninstall any voices you have installed. See the appropriate Speechify Language Supplement for details.

Directory Description

/usr/local/bin/ engine/server binary

/usr/local/Speechify/Voices/ voice data

/usr/local/Speechify/doc/ documentation files

/usr/local/Speechify/lib/ e-mail preprocessor dictionary

/usr/local/Speechify/include/ header files for SWI libraries

/usr/local/Speechify/bin/ pre-built sample applications

/usr/local/Speechify/samples/ source for sample applications

/usr/lib/ library files for Speechify client, e-mail

SpeechWorks Proprietary Fifth Edition, Update 21–7

Installing and Configuring SpeechifySpeechify User’s Guide

3. Next, uninstall the Speechify server/engine files:

rpm --erase Speechify-Engine-2.1-5

Uninstalling the Speechify client

1. Log into Linux as root.

2. Next, uninstall the Speechify client files:

rpm --erase Speechify-Client-2.1-5

Fifth Edition, Update 2 SpeechWorks Proprietary1–8

Speechify User’s Guide

Installation on Solaris

By default, the packages below install in /opt/Speechify/bin. To relocate the packages, specify the –R option to install to another directory, e.g.:

pkgadd -R /home/Speechify Speechify.Engine.2.1.5.i386.pkg.

When installing these packages on a Sparc machine, replace the “i386” in the example filename with “sparc”. Also, if you logged in as root using gunzip, you may have to explicitly set the path to where the gunzip executable is located. For example:

/usr/local/bin/gunzip Speechify.Engine.2.1.5.i386.pkg.tar.gz

Installing the Speechify server

1. Log into Solaris as root.

2. Insert the Speechify CD into the CD-ROM drive and mount the CD-ROM.

3. Copy the packages to an intermediate directory which is large enough to accommodate them.

4. Change to the directory you just created.

5. Unpack the server software:

gunzip Speechify.Engine.2.1.5.i386.pkg.tar.gztar xvf Speechify.Engine.2.1.5.i386.pkg.tar

Add the package:

pkgadd -d . ttsEngine

6. You must install a Speechify voice before you can run the server. All voice installations are described in a Speechify Language Supplement that corresponds to the language being spoken. See the appropriate supplement for more information.

SpeechWorks Proprietary Fifth Edition, Update 21–9

Installing and Configuring SpeechifySpeechify User’s Guide

Installing the Speechify client

1. Log into Solaris as root.

2. Insert the Speechify CD into the CD-ROM drive and mount the CD-ROM.

3. Copy the packages to an intermediate directory which is large enough to accommodate them.

4. Change to the directory you just created.

5. Unpack the client software:

gunzip Speechify.Client.2.1.5.i386.pkg.tar.gztar xvf Speechify.Client.2.1.5.i386.pkg.tar

Add the package:

pkgadd -d . ttsClient

Installed file locations

This table shows where certain files are located after installing various packages:

Directory Description

/opt/Speechify/bin/ engine/server binary

/opt/Speechify/doc/ documentation files

/opt/Speechify/Voices/ voice data

/opt/Speechify/SDK/lib/ e-mail preprocessor dictionary

/opt/Speechify/SDK/include/ header files for SWI libraries

/opt/Speechify/SDK/bin/ pre-built sample applications

/opt/Speechify/SDK/samples/ source for sample applications

/usr/lib/ library files for Speechify client, e-mail

Fifth Edition, Update 2 SpeechWorks Proprietary1–10

Speechify User’s Guide

Configuring shared memory

If you run the Speechify server on Solaris without configuring a large enough shared memory segment, the server prints an error and exits. Typically, Solaris machines default to allowing only 1 MB of shared memory per segment whereas Speechify requires a much larger segment.

To set the maximum shared memory segment size on Solaris 2.7 and 2.8, you can alter the value of the shmmax kernel parameter. The parameter is an upper limit which is checked by the system to see if it has enough resources to create the memory segment.

Increasing the size of the shared memory

Edit /etc/system (save a backup copy). Read the comments located near the bottom of the file to find the appropriate point for setting an integer variable or module and add the following line:

set shmsys:shminfo_shmmax=196608000

Save, then reboot the machine to execute the setting. To check the setting, issue the “sysdef” command and grep for SHMMAX or “max shared memory segment.” The Speechify server was tested with a setting of 196608000 which yielded good results.

Uninstalling the Speechify server

1. Log into Solaris as root.

2. First, uninstall any voices you have installed. See the appropriate Speechify Language Supplement for details.

3. Next, uninstall the Speechify server/engine files:

pkgrm ttsEngine

SpeechWorks Proprietary Fifth Edition, Update 21–11

Installing and Configuring SpeechifySpeechify User’s Guide

Uninstalling the Speechify client

1. Log into Solaris as root.

2. Next, uninstall the Speechify client files:

pkgrm ttsClient

Fifth Edition, Update 2 SpeechWorks Proprietary1–12

Speechify User’s Guide

Running the Speechify server from the console

Starting Speechify

The Speechify server can be started from the command line on all platforms. (It can also run as a service, or daemon, on Windows. See Running Speechify as a Windows Service on page 1-17.)

The Speechify binary is located in the /bin directory of the Speechify install directory. On UNIX platforms the binary is named Speechify and on Windows, Speechify.exe.

Speechify <options>

The following table lists the command-line options and their descriptions. Some switches are required and are noted as such. Most switches require additional arguments.

Switch Description

--default_contenttype <MIME content type>

Specifies a MIME content type to use for speak requests when the content_type parameter to SWIttsSpeak( ) is NULL. See “SWIttsSpeak( )” on page 7-96 for a list of supported content types.

Because most shells treat a semicolon as a special character, use a backslash to escape; for example:

--default_contenttype text/plain\;charset=us-ascii

--name <voice name> (Required.) Specifies the name of the voice that Speechify loads. For example: “--name mara” or “--name rick”.

--format <format> (Required.) Specifies the audio format of the voice database that Speechify loads. ❏ 8: 8 kHz, 8-bit µ-law ❏ 16: 16 kHz, 16-bit linear

For example: “--format 8”.

--language <language ID> (Required.) Specifies the language of the voice database that Speechify loads. The argument consists of a 2-letter language identifier, a hyphen, and a 2-letter country code. For example:❏ US English: “--language en-US” ❏ Parisian French: “--language fr-FR”

SpeechWorks Proprietary Fifth Edition, Update 21–13

Installing and Configuring SpeechifySpeechify User’s Guide

Example:

To start the 8 kHz version of the US English female voice (“mara”) on port 5555, use the following command from the command line:

Speechify --language en-US --name mara --format 8 --port 5555

The following group of options controls the logging functionality built into the server. For more information, see “Speechify Logging” on page A-109.

--port <number> (Required.) Specifies the sockets port where the Speechify server should listen for incoming connections. If you are running multiple instances of Speechify on one server machine, this number should be different for each instance. Here the term “port” refers to a sockets (networking) port, not to a single connection created between the client and the server by the SWIttsOpenPort( ) function; you can have multiple client connections to the same sockets port. This affects the parameters you pass to the SWIttsOpenPort( ): any change to the port number must be reflected in the connectionPort parameter you pass to SWIttsOpenPort( ). (See “SWIttsOpenPort( )” on page 7-91 for more details about this function.)

--voice_dir <path> Specifies the directory where Speechify can find the voice database. This defaults to the value of the SWITTSSDK environment variable which is set during installation.

--help Prints a short summary of these switches and then exits.

--version Prints a short banner and then exits. The banner displays the Speechify release, the client/server protocol version, and the build date and time.

Option Description

--verbose <number> Specify a number greater than 0 to turn on detailed diagnostics. By default, diagnostics are disabled.

--diagnostic_file <filename> Send diagnostic and error information to a text file as well as stdout. By default, diagnostics only go to stdout.

--event_file <filename> Create an event log file which can be used for reporting system usage. By default, event reporting is disabled.

--system_log Send error messages to the system logging service as well as stdout or a text file. On Unix this is syslog. On Windows, this is the event log.

Switch Description

Fifth Edition, Update 2 SpeechWorks Proprietary1–14

Speechify User’s Guide

The following group of options controls the process management and health monitoring functionality built into the server.

On UNIX, Speechify creates a new server process to handle each connection from a client and destroys that process when the connection closes. On Windows, before any connection occurs, Speechify starts a pool of server processes to service connection requests from clients and retains those processes when the connections close. Some options in the pool are configurable, and described below.

Option Description

--max_clients <number> Specify the maximum size of the pool. Speechify never creates more child server processes than specified. Any attempts to connect when at maximum capacity are rejected by sending an error to the client. Default: 32.

--prestart <number> (Windows only.) Specify the minimum size of the pool. When you launch Speechify, this is the number of server processes started. If the number of simultaneous connection requests from clients exceeds this number, the connection succeeds but Speechify has to start a new server process for it which may delay the connection time. When a client connection closes, Speechify checks to see if the number of servers exceeds the minimum and, if it does, closes that client’s corresponding server process. Default: value of max_clients.

--health_interval <number> (Windows only.) Speechify performs a periodic status check of the pool of Speechify processes to make sure they are healthy. This option sets the amount of time in seconds between each status check. Default: 10 seconds.

A value of 0 disables this check and the next four options.

--processing_timeout <number> (Windows only.) Speechify shuts down a server if it exceeds the amount of specified time for processing a request without sending any data over the network to the client. This option sets the amount of time in seconds. Default: 120 seconds.

--write_timeout <number> (Windows only.) Speechify shuts down a server if it exceeds the specified amount of time while trying to write to a socket without success. This usually indicates a hung client that isn’t reading from its end of the socket. This option sets the amount of time in seconds. Default: 100 seconds.

SpeechWorks Proprietary Fifth Edition, Update 21–15

Installing and Configuring SpeechifySpeechify User’s Guide

Stopping Speechify

Use Ctrl–c to stop the server on UNIX or Windows. If you started the server as a background process, use ps and kill on UNIX or Task Manager on Windows to stop the server.

--idle_timeout <number> (Windows only.) Speechify shuts down a server if the server has seen no network activity from the child connected to it within a certain amount of time. This option sets the amount of time in seconds. Default: 0 seconds (deactivated).

--excess_fallback_timeout <number>

(Windows only.) When Speechify decides to shut down a server process to keep the number of processes down to the minimum, it can be instructed to wait in case another client request comes in quickly. This option sets the amount of time to wait in seconds. A zero means Speechify won’t wait at all. Default: 600 seconds.

Option Description

Fifth Edition, Update 2 SpeechWorks Proprietary1–16

Speechify User’s Guide

Running Speechify as a Windows Service

Configuring the server

On Windows NT or 2000 systems you can run Speechify as a Windows Service. You configure the command-line switches listed above via the Microsoft Management Console (MMC). (If the Speechify installer doesn’t detect MMC on your NT system, it installs it for you. Windows 2000 machines already have MMC installed.) Speechify provides an MMC applet that allows you to edit and save configurations for the Speechify server. These configurations are created when you install a Speechify voice and are removed when you uninstall one.

NOTE

You can disable each Speechify port configuration by accessing the General property page via the Speechify MMC console. Right-click on the desired configuration, then choose Disable. When the Speechify NT Service is started, the disabled configuration is not launched.

Starting the Speechify MMC applet

To access the Speechify Server Management MMC applet, use this path:

Start >> Programs >> Speechify >> Speechify Server Management

A Speechify Server Management applet window opens with a list of Speechify port configurations for the machine on the left and the parameters for the currently selected configuration on the right.

Editing a port configuration

All port configurations appear in the left side of the window. Edit the configuration parameters using one of these methods:

❏ right-click the port name and choose Properties❏ double-click any property listed on the right

SpeechWorks Proprietary Fifth Edition, Update 21–17

Installing and Configuring SpeechifySpeechify User’s Guide

A dialog box appears containing four tabs:

❏ General❏ Voice❏ Health❏ Log

The editable parameters in this dialog box directly correlate to the command-line options listed in the section “Running the Speechify server from the console” on page 1-13.

Configuring for high channel density

If you need to start more than 185 Speechify processes as a service, you may run into a Windows limitation. To work around this limitation, you can edit the registry key:

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\SubSystems\Windows

Tab Description

General The General tab of the configuration dialog box contains several editable fields:❏ Port: see “--port <number>” on page 1-14.❏ Minimum number of child processes: see “--prestart <number>” on page 1-15.❏ Maximum number of child processes: see “--max_clients <number>” on page 1-15.❏ Drop excess child processes after X seconds: see “--excess_fallback_timeout <number>” on page

1-16.

Voice Four fields control how Speechify starts a voice for this configuration:❏ Voice: see “--name <voice name>” on page 1-13.❏ Voice directory: see “--voice_dir <path>” on page 1-14❏ Language: see “--language <language ID>” on page 1-13❏ Format: see “--format <format>” on page 1-13

Health Speechify monitors the status of the server processes it starts. If a problem is detected, Speechify shuts down the server process then restarts it. The settings are configurable on this tab:❏ Health Monitoring Interval: see “--health_interval <number>” on page 1-15.

Speechify uses three metrics to detect problems. Entering a zero for the value can disable each of these. The metrics are:❏ Drop idle connection after X seconds: see “--idle_timeout <number>” on page 1-16.❏ Drop connection if processing any packet for X seconds: see “--processing_timeout <number>”

on page 1-15.❏ Drop connection if trying to write a packet for X seconds: see “--write_timeout <number>” on

page 1-15.

Log There are two options to control diagnostic logging for Speechify. (Note that Speechifyalways logs errors and alarms to NT’s event log when run as an NT service.)❏ Detail Level: see “--verbose <number>” on page 1-14.❏ Diagnostic Message file: see “--diagnostic_file <filename>” on page 1-14.

There is one option to set which controls the event logging for Speechify.❏ Event log: See “--event_file <filename>” on page 1-14.

Fifth Edition, Update 2 SpeechWorks Proprietary1–18

Speechify User’s Guide

In this key, the substring SharedSection is probably set to 1024,3072,512. Change it to:

SharedSection=1024,3072

Running and stopping the server

On Windows 2000 systems, use the Speechify MMC to start and stop the Speechify service. On Windows NT systems, use the Services applet in the Control Panel to start and stop the Speechify service.

Starting or stopping the Speechify server on Windows 2000

1. In the SpeechifyMMC window, right-click Speechify Server Management.

2. Select Start Speechify Service.

The server does not start instantaneously; the initialization time depends on your system’s speed and RAM. You may notice multiple new processes named Speechify.exe listed in the Task Manager. This is normal because Speechify is not multi-threaded within one process. Instead, it launches a process to handle each concurrent connection.

3. To stop all running configurations, right-click Speechify Server Management and select Stop Speechify Service.

Starting or stopping the Speechify server on Windows NT

1. Go to Start >> Settings >> Control Panel.2. Open the Services applet.3. Scroll down the list of services to the Speechify entry and select Start or Stop to

start or stop the server.

SpeechWorks Proprietary Fifth Edition, Update 21–19

Installing and Configuring SpeechifySpeechify User’s Guide

Fifth Edition, Update 2 SpeechWorks Proprietary1–20

CHAPTER 2

Programming Guide

This chapter contains an overview of features, and high-level information on groups of API functions.

For a detailed explanation of the API functions, see “API Reference” on page 7-69.

In this chapter

• Features on page 2-22

• Order of API functions on page 2-23

• Callback function on page 2-24

• Sample time lines on page 2-26

• Overview of user dictionaries on page 2-30

• Dynamic parameter configuration on page 2-30

• Character set support on page 2-31

• Operational aids on page 2-31

• Implementation guidelines on page 2-31

SpeechWorks Proprietary Fifth Edition, Update 22–21

Programming GuideSpeechify User’s Guide

Features

Speechify offers the following features:

❏ A client with a C language interface.

❏ A flexible threading model so that you can call the API functions from any thread in your process.

❏ Support for a variety of character sets.

❏ A variety of tags to be embedded in text to customize the speech output.

❏ Bookmark, wordmark, and phoneme-mark support, for synchronizing external events with the speech output.

❏ A set of dynamic user dictionaries for customizing pronunciations, which can be modified at run time.

❏ Support for file-based dictionaries, to be loaded at initialization.

Fifth Edition, Update 2 SpeechWorks Proprietary2–22

Speechify User’s Guide

Order of API functions

This section describes an outline for your Speechify application:

1. First, call the SWIttsInit( ) function to initialize the client library. This is done once per application process no matter how many TTS ports are opened so that the library can allocate resources and initialize data structures.

You must call this function before calling any other; the other functions return an error if it has not been called.

2. Call SWIttsOpenPort( ) to open a TTS port on the server. This establishes a connection to the server. SWIttsOpenPort( ) registers an application-defined callback function with the Speechify client library. This callback function is invoked to receive all audio, supporting information, and errors generated by the server.

3. Call SWIttsSpeak( ) to start synthesizing the specified text on the server.

After receiving this call, the server begins sending audio packets to the callback function defined above. The SWIttsSpeak( ) call itself returns without waiting for synthesis to complete or even begin.

4. Call SWIttsClosePort( ) after you finish making speak requests, to close down the TTS port. The client tells the server to shutdown this port and then closes the connection to the server.

5. Call SWIttsTerm( ) when your process is ready to shutdown. This tells the client to shut itself down and clean up any resources.

Pseudo-code for a simple Speechify application looks like this:

SWIttsInit()SWIttsOpenPort()while (more TTS requests to make) {SWIttsSpeak()wait for SWItts_cbEnd to be received by the callback

}SWIttsClosePort()wait for SWItts_cbPortClosed to be received by the callbackSWIttsTerm()

Call SWIttsStop( ) to stop a TTS request before it has completed. Once this is called, the client sends no further information to your callback except a confirmation that the server has stopped acting on the request.

SpeechWorks Proprietary Fifth Edition, Update 22–23

Programming GuideSpeechify User’s Guide

Callback function

Of the functions mentioned above, all operate synchronously except for SWIttsSpeak( ), SWIttsStop( ), and SWIttsClosePort( ). When one of these three functions is called, it returns immediately before the operation is complete. A return code indicating success only indicates that the message was communicated to the server successfully. In order to capture the output produced and returned by the server, you must provide a function for the client library to call. This function is called a callback function and you pass a pointer to it when you call SWIttsOpenPort( ). Your callback function’s behavior must conform to the description of the SWIttsCallback( ) function specified in “SWIttsCallback( )” on page 7-75.

When the client library receives data from the server, it calls your callback and passes a message and any data relevant to that message. The set of possible messages is defined in the SWItts.h header file in the enumeration SWItts_cbStatus and listed below along with the type of data that is sent to the callback in each case:

The SWIttsAudioPacket, SWIttsBookMark, SWIttsWordMark, SWIttsPhonemeMark, and SWIttsMessagePacket structures are defined and further explained in “SWIttsCallback( )” on page 7-75.

For a speak request that proceeds normally, message codes occur in the following manner:

❏ A SWItts_cbStart message arrives indicating that SWItts_cbAudio messages are about to arrive.

SWItts_cbStatus Data type

SWItts_cbAudio SWIttsAudioPacket

SWItts_cbBookmark SWIttsBookMark

SWItts_cbDiagnostic SWIttsMessagePacket

SWItts_cbEnd NULL

SWItts_cbError SWIttsMessagePacket

SWItts_cbLogError SWIttsMessagePacket

SWItts_cbPhonememark SWIttsPhonemeMark

SWItts_cbPing NULL

SWItts_cbPortClosed NULL

SWItts_cbStart NULL

SWItts_cbStopped NULL

SWItts_cbWordmark SWIttsWordMark

Fifth Edition, Update 2 SpeechWorks Proprietary2–24

Speechify User’s Guide

❏ One or more SWItts_cbAudio messages arrive along with their SWIttsAudioPacket structures. The SWIttsAudioPacket contains a pointer to a buffer of audio samples.

❏ A SWItts_cbEnd message arrives indicating that all speech has been sent.

For example, to write the synthesized speech to a file, the pseudo-code for your callback might look like this:

if message == SWItts_cbStartopen file

else if message == SWItts_cbAudiowrite buffer to file

else if message == SWItts_cbEndclose file

You must copy audio from the SWIttsAudioPacket structure to your own buffers before the callback returns. Once the callback returns, the client library may free the SWIttsAudioPacket structure.

Sometimes a speak request does not proceed normally, such as when you call SWIttsStop( ) to stop a speak request before it completes. (You might want to do this to support barge-in.) In this case, no more audio messages are sent to your callback, and instead of receiving the SWItts_cbEnd message, your callback receives the SWItts_cbStopped message, indicating that the speak request was stopped before proper completion.

There are other ways that messages can proceed if you use the bookmark, wordmark, and phoneme-mark features. These are shown in the sample time lines below.

SpeechWorks Proprietary Fifth Edition, Update 22–25

Programming GuideSpeechify User’s Guide

Sample time lines

Given a high-level knowledge of the order of API functions required and the order in which the client calls your callback, here are some sample time lines to illustrate the complete order of messages.

Simple interaction time line

Figure 2-1 shows a simple interaction where a speak request proceeds from start to finish with no other messages such as errors or stop requests.

Figure 2-1 Speak request from start to finish

SWIttsInit()

SWIttsOpenPort()

SWIttsSpeak()

SWItts_cbStart

SWItts_cbAudio

SWItts_cbEnd

SWIttsClosePort()

SWItts_cbPortClosed

SWIttsTerm()

SWItts_cbAudio

SWItts_cbAudio

...

Application

time

Client

time

Fifth Edition, Update 2 SpeechWorks Proprietary2–26

Speechify User’s Guide

Time line with bookmarks

Figure 2-2 illustrates the application/client communication when bookmarks have been embedded in the input text and therefore bookmark messages are being returned with audio messages.

Figure 2-2 Application/client communication with bookmarks

For example, if your input text is “This is \!bmbookmark1 a test.” you may expect the callback would receive audio messages containing samples for the words “This is,” then a bookmark message, then audio messages for the words “a test.” Instead, Speechify only guarantees that a bookmark message is sent before any audio messages that contain the bookmark’s corresponding audio sample (indicated by the bookmark’s timestamp). That is, a bookmark never arrives “late” but it may and usually does arrive “early.”

Application

time

SWIttsInit()

SWIttsOpenPort()

SWIttsSpeak()

SWItts_cbStart

SWItts_cbWordmark

SWItts_cbPhonememark

SWItts_cbBookmark (x times)

SWItts_cbAudio (y times)

SWItts_cbEnd

SWIttsClosePort()

SWItts_cbPortClosed

SWIttsTerm()

...

...

Client

time

SpeechWorks Proprietary Fifth Edition, Update 22–27

Programming GuideSpeechify User’s Guide

Speechify server calculates and sends bookmark locations every time it sees the beginning of a “phrase.” A phrase can be loosely understood as some period of speech that is followed by a pause. Phrases are often delimited by the punctuation marks such as periods, commas, colons, semicolons, exclamation points, question marks, and parentheses, but there is not an exact correspondence between punctuation and phrase boundaries.

For simple input texts you can figure out when bookmarks are sent to your callback. For example, the text “This is a \!bmbookmark1 test,” is a single phrase, so the bookmark message arrives before any of the audio messages. The time line shown in Figure 2-2 illustrates that scenario. If your text is “Hello, this is a \!bmbookmark1 test.” then your callback receives the audio messages for the phrase “Hello,” a bookmark message, then the audio messages for the phrase “this is a test.”

NOTE

Any mark messages you use (e.g., bookmark, wordmark, phoneme mark) are always sent to the callback function before the corresponding audio messages.

For more complex input text, it may be difficult to predict when your bookmark messages will be returned, since there is not an exact correlation between punctuation and phrase boundaries. Speechify’s standard text processing inserts phrase boundaries at locations where there is no punctuation, in order to enhance understandability. Conversely, some punctuation marks do not correspond to a phrase boundary.

Fifth Edition, Update 2 SpeechWorks Proprietary2–28

Speechify User’s Guide

Time line with SWIttsStop( )

Figure 2-3 illustrates the communication between the application and the client when the SWIttsStop( ) function is called. Note that the SWItts_cbEnd message is not generated when this function is called. Instead you receive the SWItts_cbStopped message. You always receive either SWItts_cbEnd or SWItts_cbStopped, but never both.

Figure 2-3 SWIttsStop( ) function

SWIttsInit()

SWIttsOpenPort()

SWIttsSpeak()

SWItts_cbStart

SWItts_cbStopped

SWIttsClosePort()

SWItts_cbPortClosed

SWIttsTerm()

SWItts_cbAudio (n times)

...

Application

time

Client

time

SWIttsStop()

SpeechWorks Proprietary Fifth Edition, Update 22–29

Programming GuideSpeechify User’s Guide

Overview of user dictionaries

Speechify provides a set of dynamic user dictionaries that allow you to customize the pronunciation of words, abbreviations, acronyms, and other text strings. These dictionaries are described in detail in “User Dictionaries” on page 6-59. (Some languages do not have all types of dictionaries; see the appropriate language supplement for details.)

❏ The main dictionary is an all-purpose exception dictionary used to replace a single token in input text with almost any other input sequence.

❏ The abbreviation dictionary is used to expand abbreviations, and provides for special treatment of period-delimited tokens.

❏ The root dictionary is used to specify pronunciations, orthographically or via phonetic representations, of words or morphological word roots. Details of the root dictionary vary by language.

Any changes made to the dictionaries are reflected in the synthesis of subsequent text. You can make changes at any time during a connection (i.e., any time between SWIttsOpenPort( ) and SWIttsClosePort( )) except while synthesis is taking place. Dictionary changes only apply for the duration of the connection. If a connection is terminated and reestablished, all dictionary changes must be reapplied.

For more information on the dictionary functions, see “API Reference” on page 7-69.

Dynamic parameter configuration

Use SWIttsSetParameter( ) to configure the Speechify server while it is running. Certain parameters are read-only; if you try to set them, the function returns an error. Other parameters’ valid values depend on the command line options passed to the server at startup.

Retrieve the value of individual parameters with SWIttsGetParameter( ).

Both SWIttsSetParameter( ) and SWIttsGetParameter( ) are synchronous calls that cannot be made while synthesis is taking place.

For the list of valid parameters, see “SWIttsSetParameter( )” on page 7-94.

Fifth Edition, Update 2 SpeechWorks Proprietary2–30

Character set supportSpeechify User’s Guide

Character set support

Speechify supports strings in multiple character sets as input to SWIttsSpeak( ), SWIttsAddDictionaryEntry( ), SWIttsDeleteDictionaryEntry( ), and SWIttsLookupDictionaryEntry( ). For a list of supported character sets, see “SWIttsSpeak( )” on page 7-96.

Functions which return strings to the user, such as SWIttsGetDictionaryKeys( ) and SWIttsLookupDictionaryEntry( ), as well as bookmarks, return strings in the server’s preferred character set. See “Server’s preferred character set” on page 7-70 for more information.

Operational aids

To verify your connection to the TTS port on the server, call SWIttsPing( ). Besides verifying the low-level network connection, this confirms that a particular TTS port is alive and processing requests. It is an asynchronous function and the client sends the SWItts_cbPing event to your callback after it receives a reply from the server.

Implementation guidelines

To support multiple simultaneous TTS ports, you can employ a multi-threaded process model that opens multiple ports in one process or a multi-process model that opens one port per process.

The current implementation of the client spawns a thread for each open port. This thread is created in the SWIttsOpenPort( ) function and destroyed in the SWIttsClosePort( ) function, no matter which model you choose for your application code. The spawned threads receive the asynchronous network events for that port, and then call your callback function. You must be efficient in your callback code; blocking or waiting for an event may cause networking errors.

SpeechWorks Proprietary Fifth Edition, Update 22–31

Programming GuideSpeechify User’s Guide

The threads created by SWIttsOpenPort( ) have their stack sizes set to reasonable default values, which typically do not need to be changed. However, you can override the default by setting the SWITTSTHREADSTACKSIZE environment variable to a desired value (in bytes).

Opening and closing a TTS port for every speak request is costly. The act of opening and closing a port requires some processing and resource management overhead on the server, as does creating or tearing down the networking sockets on both the client and server. Thus, we recommend that you open a port for the duration of a “session” (defined by you). This session could be for the length of a phone call or indefinitely.

Fifth Edition, Update 2 SpeechWorks Proprietary2–32

CHAPTER 3

Standard Text Normalization

Speechify’s text normalization interprets the input text and converts it into a sequence of fully spelled-out words. This process is primarily responsible for an intelligent reading of text, and includes:

❏ converting digits❏ expanding abbreviations and acronyms❏ handling punctuation❏ interpreting special characters such as currency symbols

Relevant languages

This chapter covers the major features of Speechify’s default text normalization, which applies unless overridden by a main or abbreviation dictionary entry (see “User Dictionaries” on page 6-59) or an embedded tag (see “Embedded Tags” on page 4-43). The discussion in this chapter applies to de-DE, en-AU, en-GB, en-US, es-MX, fr-CA, fr-FR, and pt-BR, but not to ja-JP, illustrated with en-US examples where relevant.

Neutral expansions

In general, the default normalization expands expressions neutrally unless there is a disambiguating context. For example, the expression “1/2” can be interpreted in a variety of ways: “one half,” “one over two,” “January second,” “February first,” and so on. In special cases it is possible to disambiguate the expression; for example, in “3 1/2” it is a fraction and should be read “one half.”

When a disambiguating context cannot be identified, Speechify supplies a neutral reading, such as “one slash two,” on the theory that it is preferable to provide a reading that is intelligible in all circumstances instead of a specialized reading which is wrong for the context (e.g., reading “one half” when “January first” was intended).

SpeechWorks Proprietary Fifth Edition, Update 23–33

Standard Text NormalizationSpeechify User’s Guide

Level of detail provided for normalization

In this chapter and in the language supplements, processing is described in general terms, to help application developers construct main and abbreviation dictionaries, custom pre-processors, and marked-up text. It is beyond the scope of this chapter to provide an exhaustive description of the entire set of sophisticated, context-sensitive text normalization rules used in Speechify, and you may therefore observe deviations from the generalizations provided here in specific instances.

In this chapter

• “Numbers” on page 3-34

• “Numeric expressions” on page 3-35

• “Mixed alphanumeric tokens” on page 3-35

• “Abbreviations” on page 3-36

• “E-mail addresses” on page 3-37

• “URLs” on page 3-38

• “Pathnames and filenames” on page 3-39

• “Punctuation” on page 3-40

• “Parentheses” on page 3-41

• “Hyphen” on page 3-41

• “Slash” on page 3-42

Numbers

Speechify handles cardinal and ordinal numbers in standard formats, floating point digits, negative numbers, and fractions where these are unambiguous. See the appropriate language supplement for language-specific details on formats and interpretation.

Fifth Edition, Update 2 SpeechWorks Proprietary3–34

Numeric expressionsSpeechify User’s Guide

Numeric expressions

Speechify handles dates, times, and monetary expressions in a variety of currencies and formats. Individual languages also handle phone numbers and social security numbers. See the appropriate language supplement for language-specific details on formats and interpretation.

Mixed alphanumeric tokens

This table shows en-US examples of Speechify’s expansion of strings that mix alphabetic and numeric characters.

See the appropriate language supplement for language-specific exceptions.

Format Handling Examples Expansion

Combination of uppercase letters and numbers

Spell out letters.Default number processing.

32XCJ2EEVOS34

thirty-two eks ceejay two ee eevee oh ess thirty-four

Combination of lowercase or mixed case letters and numbers

Break into separate words at letter/digit boundaries.

Group1224hour12min

group twelve twenty-four hourtwelve minutes

Special cases: language-specific exceptions

Single word. 55th1930s3RD

fifty-fifthnineteen thirtiesthird

SpeechWorks Proprietary Fifth Edition, Update 23–35

Standard Text NormalizationSpeechify User’s Guide

Abbreviations

Ambiguous abbreviations

There are two types of ambiguity in abbreviations.

❏ More than one possible expansion; for example, “St.” means either “street” or “saint.” Speechify employs a set of context-sensitive rules to disambiguate this type of ambiguous abbreviation.

❏ The “abbreviation” can be either a whole word or an abbreviated form: e.g., “in.” is either the word “in” or the abbreviation for “inches.”

A token of the second type is interpreted as an abbreviation only in specific disambiguating contexts. For instance, when the abbreviation ends in a period, and the following word begins with a lowercase letter, it is interpreted as an abbreviation. For example:

Note that abbreviations do not necessarily end in a period:

Periods after abbreviations

Once the abbreviation is expanded, if it ended in a final period it must be determined whether or not the period also indicates a sentence end:

Input Expansion

There are 5 in. of snow on the ground. there are five inches of snow on the ground.

Put 5 in. Then take 3 out. put five in. then take three out.

Input Expansion

We met Mr Smith yesterday. we met mister smith yesterday.

Input Expansion

There are 5 ft. of snow on the ground. there are five feet of snow on the ground.

It snowed 5 ft. The next day it all melted. it snowed five feet. the next day it all melted.

Fifth Edition, Update 2 SpeechWorks Proprietary3–36

E-mail addressesSpeechify User’s Guide

Measurement abbreviations

Measurement abbreviations are expanded to singular or plural depending on the value of a preceding number or other disambiguating context. In the absence of a disambiguating context, they default to a plural expansion. For example:

E-mail addresses

An e-mail address is divided into two portions, a username and a domain name, separated by an at sign (@). A phrase break is inserted following the username. Symbols in the e-mail address are read by name. The following table illustrates with en-US expansions.

Input Expansion

There are 5 in. of snow on the ground. there are five inches of snow on the ground.

There is 1 in. of snow on the ground. there is one inch of snow on the ground.

There are 1.1 in. of snow on the ground. there are one point one inches of snow on the ground.

How many cm. are in a km? how many centimeters are in a kilometer?

cm. centimeters

Symbol Expansion

@ at

. dot

- dash

_ underscore

SpeechWorks Proprietary Fifth Edition, Update 23–37

Standard Text NormalizationSpeechify User’s Guide

Username

The username is spelled out character by character, unless word boundaries are indicated unambiguously. Sequences of two and three letters are always spelled out. Digit sequences are read digit by digit. Examples (commas are used to indicate phrasing):

Domain name

Two- and three-letter domain and country extensions are either read as words or spelled out, following standard convention. The host name is read as a single word, unless word boundaries are indicated unambiguously. English examples:

URLs

A token beginning with “www.” or “http://” or “ftp://” is interpreted as a URL. A phrase break is inserted following “http://” or “ftp://,” and the “://” piece is not pronounced.

Username Expansion

bruce_smith bruce underscore smith,

john.jones john dot jones,

star-chaser star dash chaser,

steve5050 steve five zero five zero,

red ar ee dee,

rfrmac ar eff ar emm ay cee,

Host name Expansion

access1.net access one dot net

hawaii.rr.com hawaii dot ar ar dot com

cornell.edu cornell dot ee dee you

amazon.co.uk amazon dot cee oh dot you kay

Fifth Edition, Update 2 SpeechWorks Proprietary3–38

Pathnames and filenamesSpeechify User’s Guide

Symbols in a URL are expanded as follows in US English:

Each slash-delimited segment of the URL is expanded as follows: Two- and three-letter domain and country extensions are either read as words or spelled out, following standard conventions. Each remaining segment is read as a single word, unless word boundaries are indicated unambiguously. Examples:

Pathnames and filenames

Forward and backward slashes are not expanded at the end of a pathname. In other contexts, they are expanded by name. Symbols in pathnames are expanded by name. The following table illustrates the en-US expansions.

Symbol Expansion

/ URL-final: not expandedotherwise: slash

. dot

- dash

_ underscore

URL Expansion

http://www.lobin.freeserve.co.uk aitch tee tee pee, double you double you double you dot lobin dot freeserve dot cee oh dot you kay

sarahs-price/page001.html sarahs dash price slash page zero zero one dot aitch tee em ell

www.serbia-info.com/news/ double you double you double you dot serbia dash info dot com slash news

Symbol Expansion

/ URL-final: not expandedotherwise: slash

\ URL-final: not expandedotherwise: backslash

. dot

- dash

_ underscore

SpeechWorks Proprietary Fifth Edition, Update 23–39

Standard Text NormalizationSpeechify User’s Guide

Each slash-delimited segment of a pathname is read as a single word, unless word boundaries are unambiguously indicated. Common filename extensions are read as a word or spelled out, following standard conventions.

Punctuation

Punctuation generally triggers a phrase break, except in a limited set of special cases that are determined on a language-specific basis. Some English examples of commas that don't produce phrase breaks:

Pathname Expansion

C:\docs\my_book\chapter12.doc cee backslash docs backslash my underscore book backslash chapter twelve dot doc

/product/release/speechify-2-1-5/release-notes.txt

slash product slash release slash speechify dash two dash one dash five slash release dash notes dot tee eks tee

Input Expansion

He lives in Boston, Massachusetts. he lives in boston massachusetts.

That is a very, very old building. that is a very very old building.

John won’t come, either. john won’t come either.

SpeechWorks International, Inc. speechworks international incorporated.

Drive D: is full. drive dee is full.

Fifth Edition, Update 2 SpeechWorks Proprietary3–40

ParenthesesSpeechify User’s Guide

Parentheses

Parentheses generally trigger a phrase break, except in a very limited set of special cases which vary from language to language. See the appropriate language supplement for relevant examples. Some English examples (commas used to indicate phrasing).

Hyphen

The hyphen is read neutrally as “dash” (or the equivalent) unless it can be disambiguated with a high degree of confidence. See the appropriate language supplement for language-specific examples.

Input Expansion

Tom (my son) and Susan (my daughter) Tom, my son, and Susan, my daughter

book(s) books

getText() get text

Input Expansion

mid-90s mid nineties

A-1 ay one

32-bit thirty-two bit

-7 minus seven

April 3-4 April third to fourth

pp. 35-40 pages thirty-five to forty

1974-1975 nineteen seventy-four to nineteen seventy-five

2-3 inches two to three inches

3-2 three dash two (since the desired expansion could be “three to two,” “three minus two,” “three two,” etc.)

SpeechWorks Proprietary Fifth Edition, Update 23–41

Standard Text NormalizationSpeechify User’s Guide

Slash

A slash is read as “slash” (or the equivalent) unless one of the following is true:

a. The following word is a unit of measure, when the slash is read as per (or the equivalent),

b. When the entire token is a familiar expression.

See the appropriate language supplement for language-specific examples.

Input Expansion

Seattle/Boston seattle slash boston

cm/sec centimeters per second

he/she he or she

Fifth Edition, Update 2 SpeechWorks Proprietary3–42

CHAPTER 4

Embedded Tags

Embedded tags are special codes that can be inserted into input text to customize Speechify’s behavior in a variety of ways. You can use embedded tags to:

❏ Create pauses at specified points in the speech output.❏ Customize word pronunciations.❏ Spell out sequences of characters by name.❏ Specify the interpretation of certain numeric expressions.❏ Insert bookmarks in the text so your application receives notification when a

specific point in the synthesis job has been reached.

In this chapter

• “Speechify tag format” on page 4-44

• “Creating pauses” on page 4-44

• “Indicating the end of a sentence” on page 4-45

• “Customizing pronunciations” on page 4-46

• “Inserting bookmarks” on page 4-50

• “Controlling the audio characteristics” on page 4-51

SpeechWorks Proprietary Fifth Edition, Update 24–43

Embedded TagsSpeechify User’s Guide

Speechify tag format

A Speechify tag begins with the sequence \! followed immediately by a string of alphanumeric characters. For example:

Separate a tag from any preceding input by at least one unit of white space. A tag cannot be followed immediately by an alphanumeric character, though most tags may be followed immediately by punctuation, parentheses, and similar symbols. (The bookmark tag is an exception, since it must end in white space; see “Inserting bookmarks” on page 4-50.)

Any sequence of non-white-space characters beginning with the prefix \! that is not a recognizable Speechify tag is ignored in the speech output.

Creating pauses

Use a pause tag to create a pause of a particular duration at a specified point in the speech output.

The maximum value of the integer argument in a pause tag is 32767. To create a longer pause, use a series of consecutive pause tags.

The behavior produced by the pause tag varies depending on its location in the text. When a pause tag is placed immediately before a punctuation mark, the standard pause duration triggered by the punctuation is replaced by the pause duration specified in the tag. In other locations, the tag creates an additional pause.

\!p300 Synthesize a pause of 300 ms.

\!tsc Pronounce all characters individually by name.

Pause tag Description

\!pN Create a pause N milliseconds long.

\!p0 This is ignored since it cannot be used to remove a rule-generated pause. The smallest possible value of the pause tag is 1.

Fifth Edition, Update 2 SpeechWorks Proprietary4–44

Indicating the end of a sentenceSpeechify User’s Guide

For example, sentence (a) has a default 150 ms pause at the comma. Sentences (b) and (c) replace the default pause with a longer and shorter pause, respectively, while sentence (d) inserts an additional pause of 300 ms, resulting in a total pause duration of 450 ms. In sentence (e) a 25 ms pause is inserted in a location where no pause would otherwise occur.

Indicating the end of a sentence

Use an end-of-sentence tag to trigger an end of sentence at the preceding word, whether or not that word is followed by punctuation.

This tag is useful for forcing a sentence end in unpunctuated text, such as lists, or after a period-final abbreviation when the context does not unambiguously determine a sentence end. Here are some examples. (Periods in the Pronunciation column indicate sentence ends.)

Input Pronunciation

(a) Tom is a good swimmer, because he took lessons as a child.

Tom is a good swimmer (150 ms pause), because he took lessons as a child.

(b) Tom is a good swimmer \!p300, because he took lessons as a child.

Tom is a good swimmer (300 ms pause), because he took lessons as a child.

(c) Tom is a good swimmer \!p100, because he took lessons as a child.

Tom is a good swimmer (100 ms pause), because he took lessons as a child.

(d) Tom is a good swimmer, \!p300 because he took lessons as a child.

Tom is a good swimmer (150 ms pause), (300 ms pause) because he took lessons as a child.

(e) Tom is a good swimmer, because he took lessons \!p25 as a child.

Tom is a good swimmer (150 ms pause), because he took lessons (25 ms pause) as a child.

End of sentence tag Description

\!eos Treat the preceding word as the end of sentence.

Input Pronunciation

applespearsbananas

apples pears bananas

apples \!eospears \!eosbananas \!eos

apples. pears. bananas.

SpeechWorks Proprietary Fifth Edition, Update 24–45

Embedded TagsSpeechify User’s Guide

Customizing pronunciations

In certain cases, you may want to specify a pronunciation that differs from the one generated by Speechify’s internal text analysis rules. The tags described in this section are used to modify Speechify’s default text processing behavior in a variety of ways:

❏ “Language-specific customizations” on page 4-46❏ “Character spellout modes” on page 4-47❏ “Pronouncing numbers and years” on page 4-49❏ “Customizing word pronunciations” on page 4-50

Language-specific customizations

Some languages have tags that solve problems specific to those languages. For example:

❏ Mexican Spanish (es-MX) has tags for pronouncing the dollar sign ($) as “pesos” or “dollars” depending on the needs of the application.

❏ United States English (en-US) has a tag for pronouncing postal addresses.

Such tags are described per language in the corresponding Speechify Language Supplement.

The Dow industrials were down 15.50 at 4,585.90 at 1:59 p.m. NYSE decliners led advancers…

the dow industrials were down fifteen point five zero at four thousand five hundred eighty-five point nine zero at one fifty-nine pea emm new york stock exchange decliners led advancers…

The Dow industrials were down 15.50 at 4,585.90 at 1:59 p.m. \!eos NYSE decliners led advancers…

the dow industrials were down fifteen point five zero at four thousand five hundred eighty-five at one fifty-nine pea emm. new york stock exchange decliners led advancers…

Input Pronunciation

Fifth Edition, Update 2 SpeechWorks Proprietary4–46

Customizing pronunciationsSpeechify User’s Guide

Character spellout modes

The following tags are used to trigger character-by-character spellout of subsequent text.

For example:

Spellout modes remain in effect until they are turned off by the tag \!ts0, which restores the engine to its default processing mode. For example:

Spellout mode tag Description

\!ts0 Default mode.

\!tsc All-character spellout mode: pronounce all characters individually by name.

\!tsa Alphanumeric spellout mode: pronounce only alphanumeric characters by name.

\!tsr Radio spellout mode: like alphanumeric mode, but alphabetic characters are spelled out according to the International Radio Alphabet. Supported in English only.

Input Pronunciation

My account number is \!tsa 487-B12.

My account number is four eight seven bee one two.

My account number is \!tsc 487-B12.

My account number is four eight seven dash bee one two.

The last name is spelled \!tsr Dvorak.

The last name is spelled delta victor oscar romeo alpha kilo.

Input Pronunciation

The composer’s name is spelled \!tsa Franz Liszt \!ts0 and pronounced “Franz Liszt.”

The composer’s name is spelled eff ar ay en zee ell aye ess zee tee and pronounced Franz Liszt.

SpeechWorks Proprietary Fifth Edition, Update 24–47

Embedded TagsSpeechify User’s Guide

There are many words which are spelled out as a result of Speechify’s default text processing behavior. In such cases, the use of a spellout mode tag may have no additional effect. For example:

In alphanumeric and radio spellout modes, punctuation is interpreted exactly as it is in the default (non-spellout) mode; i.e., in most contexts it triggers a phrase break. In all-character spellout mode, punctuation is spelled out like any other character, rather than being interpreted as punctuation. Speech output continues without pause until the mode is turned off. For example:

Input Pronunciation

He works for either the CIA or the FBI.

He works for either the cee aye ay or the eff bee aye.

He works for either the \!tsa CIA \!ts0 or the \!tsa FBI \!ts0.

He works for either the cee aye ay or the eff bee aye.

Input Pronunciation

\!tsa 3, 2, 1 \!ts0 blastoff. three, two, one, blastoff

\!tsc 3, 2, 1 \!ts0, blastoff. three comma two comma one, blastoff

Fifth Edition, Update 2 SpeechWorks Proprietary4–48

Customizing pronunciationsSpeechify User’s Guide

Pronouncing numbers and years

In some languages (for example, English and German), a four digit numeric sequence with no internal commas or trailing decimal digits, like 1984, can be interpreted either as a year (nineteen eighty four) or as a quantity (one thousand nine hundred eighty four). Speechify applies the year interpretation by default, as in:

To override or restore the default year interpretation, use the following tags:

For example:

Each tag remains in effect until the interpretation is toggled by the use of the other tag. For example:

NOTE

These tags have no effect in French or Spanish, where there is no difference in pronunciation between the year and quantity interpretations.

Input Pronunciation

He was born in May 1945. He was born in May nineteen forty five.

Year mode tag Description

\!ny0 Quantity interpretation.

\!ny1 Year interpretation (default).

Input Pronunciation

In May \!ny0 1945 people emigrated.

In May one thousand nine hundred forty five people emigrated.

Input Pronunciation

\!ny0 1945 \!ny1 people emigrated in 1945.

One thousand nine hundred forty five people emigrated in nineteen forty five.

SpeechWorks Proprietary Fifth Edition, Update 24–49

Embedded TagsSpeechify User’s Guide

Customizing word pronunciations

You can use a Symbolic Phonetic Representation (SPR) to specify the exact pronunciation of a word using Speechify’s special phonetic symbols. The SPR tag takes the following form:

NOTE

Unlike other tags, the \![SPR] tag does not modify the pronunciation of following text. Instead, it is used in place of the word for which it specifies a pronunciation.

“Symbolic Phonetic Representations” on page 5-55 provides detailed information on formatting SPRs.

Inserting bookmarks

A bookmark tag inserted into the text triggers notification when that point in the synthesis job is reached. Bookmarks are useful for timing other events with the speech output. For example, you may want to insert additional audio between specific points in the speech data, or log that the user heard a certain portion of the text before you stop the speech. Bookmark tags have the following format:

SPR tag Description

\![SPR] Pronounce the word phonetically as specified inside the square brackets.

Bookmark tag Description

\!bmstr Insert a user bookmark with identifier str, which is any string ending in white space and containing no internal white space.

Fifth Edition, Update 2 SpeechWorks Proprietary4–50

Controlling the audio characteristicsSpeechify User’s Guide

When you insert a bookmark, the client sends a data structure to your callback function. This data structure contains a bookmark identifier and a timestamp indicating where in the audio data the bookmark occurs. (See “SWIttsCallback( )” on page 7-75.) The timestamps in the bookmark structures ensure that the bookmarks are resolved to the correct point in the audio data. For example:

Bookmark \!bmCL triggers a bookmark data structure containing the identifier CL and the timestamp of the sample just after clarinet. Bookmark \!bmVL1 triggers a data structure containing the identifier VL1, and the timestamp at the end of the audio data for this sentence.

See the sample “Time line with bookmarks” on page 2-27 and its description for more information about bookmark notifications.

NOTE

The bookmark identifier is a string of any non-white-space characters, and it must be delimited by final white space. It is returned as a 0-terminated wide character string. (See “SWIttsCallback( )” on page 7-75.)

Controlling the audio characteristics

Each voice has a default volume and speaking rate, known as the baseline (default) values. An application can adjust these values for each open port individually. You can also use tags to adjust these settings within the text. Thus, there are three possible settings for rate and volume, in order of precedence:

1. Embedded tags – set relative to port-specific or baseline default, described below. Separate embedded tags control volume and speaking rate.

2. Port-specific settings – use SWIttsSetParameter( ) to set tts.audio.volume and tts.audio.rate as percentages of the baseline values. These port-specific values are used if there are no overriding embedded tags.

Input Output

The clarinet \!bmCL came in just before the first violins. \!bmVL1

The clarinet came in just before the first violins.

SpeechWorks Proprietary Fifth Edition, Update 24–51

Embedded TagsSpeechify User’s Guide

3. Baseline – the default values for the voice when you install it; you cannot change these values, only override them.

For example, you can set a port-specific value for volume if the baseline value is too loud for your application. Set tts.audio.volume to a value less than 100 (percent) to make the volume quieter than the default. To adjust the volume within the text, use the embedded tags.

There are embedded tags to adjust volume and rate relative to the port-specific values and relative to the baseline values. For example, if you want a particular word or phrase to be spoken more quickly than the rest of the text, you can use the embedded tag to change the rate relative to the port-specific rate. If you want a particular word or phrase spoken at the baseline volume, no matter what volume the rest of the text is, use an embedded tag to set the volume to 100 percent of the baseline volume.

Setting a parameter relative to the port-specific value is useful if the port-specific value is unknown at the time that the source text is composed. For example, setting the volume of a word or phrase to 50 percent of the port-specific value guarantees that the corresponding audio is half as loud as the surrounding text. Conversely, setting the volume to 50 percent of the baseline default has the same effect only if the port-specific value is set to 100; if the port-specific value is already 50 percent of baseline, there is no difference for the tagged piece of text.

Volume control

The server produces audio output at the default volume, which is the maximum amplitude that may be obtained for all utterances without causing distortion (clipping). This setting minimizes quantization noise in the digital waveform that is delivered to the application by using all of the available numerical range. The application can override this on any given port by using the SWIttsSetParameter( ) function to set the port-specific volume (tts.audio.volume) to a lower value.

The port-specific volume applies to all text spoken on that port, i.e., in that conversation. To adjust the volume for a particular word or phrase, use these tags to vary volume:

Volume control tags Description

\!vpN Set volume to the given percentage of the port-specific value. (N is an integer greater or equal to 0.)

\!vpr Reset volume to the port-specific value.

Fifth Edition, Update 2 SpeechWorks Proprietary4–52

Controlling the audio characteristicsSpeechify User’s Guide

Note that the tags allow the effective volume to be set above 100, for example, \!vd120. The server attempts to scale its audio output accordingly, and may produce clipped and distorted output.

These examples assume port-specific volume has been set to 50 with SWIttsSetParameter( ) prior to each SWIttsSpeak( ) call:

Speaking rate control

The baseline speaking rate of the synthesized speech is chosen to result in the highest audio quality. Departures from this rate are generally detrimental to audio quality and should be employed with care. Extreme variations may result in unintelligible or unnatural-sounding speech. To improve the match between the desired and obtained rates, include at least a few words in the scope of a rate change tag.

Server performance generally decreases when rate change is requested, because increased computation is necessary to implement rate variation. The exact performance impact depends on the given text and the magnitude of the requested rate change.

Note that changes in speaking rate do not translate precisely into duration changes. So an utterance spoken at half the default rate is not exactly twice as long as the same utterance spoken as the default rate, although it is close. Also, rate changes affect the duration of any pauses in the output – including pauses that are specified explicitly with a \!p tag.

\!vdN Set volume to the given percentage of the baseline default value. (N is an integer greater or equal to 0.)

\!vdr Reset volume to the server default value.

Input Result

The flight departs at \!vp150 seven-fifty \!vpr in the evening.

[volume = 50] The flight departs at [volume = 75] seven-fifty [volume = 50] in the evening.

Severe \!vd60 storm warning \!vd50 has been issued for \!vd80 Suffolk and Nassau \!vpr counties.

[volume = 50] Severe [volume = 60] storm warning [volume = 50] has been issued for [volume = 80] Suffolk and Nassau [volume = 50] counties.

Volume control tags Description

SpeechWorks Proprietary Fifth Edition, Update 24–53

Embedded TagsSpeechify User’s Guide

The following tags control rate changes within an utterance:

The rate cannot be set to less than one-third or more than 3 times the server default. Attempting to do so results in a value at the corresponding minimum or maximum.

These examples assume port-specific rate has been set to 200 with SWIttsSetParameter( ) prior to each SWIttsSpeak( ) call:

Speaking rate control tags Description

\!rpN Set rate to the given percentage of the port-specific value. (N is an integer greater than 0.)

\!rpr Reset rate to the port-specific value.

\!rdN Set rate to the given percentage of the server default value. (N is an integer from 33 to 300.)

\!rdr Reset rate to the server default value.

Input Result

The flight departs at \!rp50 seven-fifty \!rpr in the evening.

[rate = twice default] The flight departs at [rate = default] seven-fifty [rate = twice default] in the evening.

\!rd150 The share price of Acme Corporation stock is \!rd120 $7.00

[rate = twice default] [rate = 1.5 times default] The share price of Acme Corporation stock is [rate = 1.2 times default] seven dollars.

Fifth Edition, Update 2 SpeechWorks Proprietary4–54

CHAPTER 5

Symbolic Phonetic Representations

A Symbolic Phonetic Representation (SPR) is the phonetic spelling used by Speechify to represent the pronunciation of a single word. An SPR represents:

❏ The sounds of the word❏ How these sounds are divided into syllables❏ Which syllables receive stress, tone, or accent

You can use SPRs as input to Speechify in order to specify pronunciations that are different from those generated by the system automatically. SPRs are used in two different ways:

❏ Enter an SPR directly into text in place of the ordinary spelling of a word. In the following example, an SPR replaces the word root in order to trigger a pronunciation that rhymes with foot rather than boot:

We need to get to the \![rUt] of the problem.

❏ To make the pronunciation change more permanent, enter an SPR as the translation value of either a main or root dictionary entry. The specified pronunciation is then generated whenever that word is encountered in any text. (See “User Dictionaries” on page 6-59.)

In this chapter

• “SPR format” on page 5-56

• “Syllable boundaries” on page 5-56

• “Syllable-level information” on page 5-56

• “Speech sound symbols” on page 5-57

SpeechWorks Proprietary Fifth Edition, Update 25–55

Symbolic Phonetic RepresentationsSpeechify User’s Guide

SPR format

An SPR consists of a sequence of allowable SPR symbols for a given language, enclosed in square brackets [ ] and prefixed with the embedded tag indicator \! (See “Embedded Tags” on page 4-43.)

These examples are valid SPRs in US English:

though \![.1Do]shocking \![.1Sa.0kIG]

The periods signal the beginning of a new syllable, the digits 1 and 0 indicate the stress levels of the syllables, and the letters D, o, S, a, k, I, and G represent specific US English speech sounds. Each of these elements of the SPR is discussed below.

An SPR entry which does not conform to the requirements detailed in this chapter is considered invalid and ignored.

Syllable boundaries

You can use periods to delimit syllables in an SPR, although they are not required. In de-DE, these periods determine the location of the syllable boundaries of the word. In other languages the periods are only used to enhance the readability of the SPR, and do not affect the way the word is syllabified in the speech output. Speechify’s internal syllabification rules apply as usual to divide the word into syllables. See the appropriate language supplement for details.

Syllable-level information

Use digits to indicate the stress or (in Japanese) the pitch accent of the syllable. In languages other than Japanese, a polysyllabic word with no stress marked is assigned a default stress. To ensure the correct pronunciation of the word, you should mark stress explicitly in the SPR. Marking stress and pitch accent in an SPR varies by language and is described in the appropriate Speechify Language Supplement.

Fifth Edition, Update 2 SpeechWorks Proprietary5–56

Speech sound symbolsSpeechify User’s Guide

Speech sound symbols

Each language uses its own inventory of SPR symbols for representing its speech sounds. See the appropriate Speechify Language Supplement for a table of SPR symbols and examples of words in which each sound occurs. These tables show valid symbols for vowels, consonants, syllable stresses, and syllable boundaries.

NOTE

Letters are case-sensitive, so \![e] and \![E] represent two distinct sounds. Multi-character symbols must be contained in single quotes; for example, French peu is represented \![p’eu’]. SPRs containing sound symbols that do not belong to the inventory of the current language are considered invalid, and ignored.

Some speech sounds have limited distributional patterns in specific languages. For example, in English, the sound [G] of sing \![.1sIG] does not occur at the beginning of a word. Other US English sounds that have a particularly narrow distribution are the flap [F], and the syllabic nasal [N]. Entering a sound symbol in a context where it does not normally occur may result in unnatural-sounding speech.

Speechify applies a sophisticated set of linguistic rules to its input to reflect the processes by which sounds change in specific contexts in natural language. For example, in US English, the sound [t] of write \![.1rYt] is pronounced as a flap [F] in writer \![.1rY.0FR]. SPR input undergoes these modifications just as ordinary text input does. In this example, whether you enter \![.1rY.0tR] or \![.1rY.0FR], the speech output is the same.

SpeechWorks Proprietary Fifth Edition, Update 25–57

Symbolic Phonetic RepresentationsSpeechify User’s Guide

Fifth Edition, Update 2 SpeechWorks Proprietary5–58

CHAPTER 6

User Dictionaries

Speechify provides a set of user dictionaries for customizing the pronunciations of words, abbreviations, acronyms, and other sequences. For example, if you want the sequence SWI to be pronounced SpeechWorks every time it occurs in any text, you can create a dictionary entry specifying this pronunciation.

NOTE

The user dictionaries should be used only for permanent pronunciation changes. They apply from the time the entries are added (see “SWIttsAddDictionaryEntry( )” on page 7-73) until the connection with the server is terminated or until the entry is explicitly removed from the dictionary. For customized pronunciations which apply only to specific instances of a text string, use Symbolic Phonetic Representations and the other embedded tags described in “Symbolic Phonetic Representations” on page 5-55 and “Embedded Tags” on page 4-43.

In this chapter

• “Overview of dictionaries” on page 6-60

• “Main dictionary” on page 6-60

• “Abbreviation dictionary” on page 6-61

• “Root dictionary” on page 6-62

• “Choosing a dictionary” on page 6-63

• “File-based dictionaries” on page 6-66

SpeechWorks Proprietary Fifth Edition, Update 26–59

User DictionariesSpeechify User’s Guide

Overview of dictionaries

A dictionary entry consists of a key and a translation value. When the key matches a string in the input text, the translation value replaces it, and the translation is then pronounced according to Speechify’s internal pronunciation rules.

Speechify provides three user dictionaries:

❏ Main dictionary❏ Abbreviation dictionary❏ Root dictionary

Each dictionary is characterized by the kinds of keys and translation values it accepts. An invalid dictionary key or translation causes dictionary lookup to fail, and the text string is handled as if the dictionary entry did not exist.

Dictionary lookups ignore surrounding parentheses, quotation marks, and the like. For example, if WHO is a key in a main dictionary entry, it matches input strings such as (WHO) and “WHO”.

Dictionary entries can be added at run time via the API (see “SWIttsAddDictionaryEntry( )” on page 7-73), or they can be loaded from a file at startup. See “File-based dictionaries” on page 6-66 for details.

Main dictionary

The main dictionary is an all-purpose exception dictionary which can replace a word in input text with almost any type of input string. It is more permissive than the other dictionaries in the make-up of its keys and translations: a valid translation consists of any valid input string (with the exception of SAPI and SSML tags), and a valid key may contain any characters other than white space (except that the final character of the key may not be a punctuation symbol). You can use the main dictionary for:

❏ Strings that translate into more than one word❏ Translations which include Symbolic Phonetic Representations or other

embedded tags❏ URLs and e-mail addresses with idiosyncratic pronunciations❏ Keys containing digits or other non-alphabetic symbols❏ Acronyms with special pronunciations

Fifth Edition, Update 2 SpeechWorks Proprietary6–60

Abbreviation dictionarySpeechify User’s Guide

Additional notes on main dictionary entries

The main dictionary is case-sensitive. For example, lowercase who does not match a main dictionary key WHO.

Main dictionary translations may include Speechify embedded tags but not SAPI or SSML tags.

For formatting requirements and examples of valid main dictionary keys and translations, see the appropriate Speechify Language Supplement.

Abbreviation dictionary

The abbreviation dictionary is designed to handle word abbreviations which translate to one or more words in ordinary spelling.

Like the main dictionary, the abbreviation dictionary is case-sensitive. For example, if you enter the key Mar with translation march, lowercase mar is still pronounced as mar.

For formatting requirements and examples of valid abbreviation dictionary keys and translations, see the appropriate Speechify Language Supplement.

Interpretation of trailing periods in the abbreviation dictionary

When you enter a key in the abbreviation dictionary, it is not necessary to include the “trailing” period that is often the final character of an abbreviation (as in the final period of etc.). If the key does not contain the trailing period, it matches input text both with and without the period. However, if you want an abbreviation to be

SpeechWorks Proprietary Fifth Edition, Update 26–61

User DictionariesSpeechify User’s Guide

pronounced as specified in the translation only when it is followed by a period in the text, then you must enter the trailing period in the key. The following table summarizes the use of trailing periods in entry keys:

An abbreviation dictionary entry invokes different assumptions about how to interpret the trailing period in the text than does a main dictionary entry. Since the final period cannot be part of a main dictionary entry key, it is always interpreted as end-of-sentence punctuation. A period following an abbreviation dictionary entry, on the other hand, is ambiguous. It is only interpreted as end-of-sentence punctuation if other appropriate conditions obtain (e.g., if it is followed by at least two spaces and an uppercase letter). For example, input (a) is interpreted as one sentence, while input (b) is interpreted as two sentences.

Root dictionary

The root dictionary is used for ordinary words, like nouns (including proper names), verbs, or adjectives. Unlike the main and abbreviation dictionaries, lookups are not case-sensitive. While you must enter a root into the dictionary in lowercase letters, the entry matches an input string regardless of case. For example, the pronunciation specified in the translation still applies when the word begins with an uppercase letter (as the first word in a sentence, for example) or when it is spelled in all uppercase letters for emphasis.

The translation value of a root dictionary entry may be either a Symbolic Phonetic Representation (see “Symbolic Phonetic Representations” on page 5-55) or a word in ordinary spelling. For example, if you want the word route to be pronounced with the vowel of out rather than the vowel of boot, you could enter the translation as the SPR \![rWt], or in letters as rout, which also produces the desired vowel.

Key Matches

inv inv.inv

sid. sid.

Input

(a) It rained 2 cm. on Monday.

(b) On Sunday it rained 2 cm. On Monday, it was sunny.

Fifth Edition, Update 2 SpeechWorks Proprietary6–62

Choosing a dictionarySpeechify User’s Guide

Beware of keys without vowels

Do not specify keys that consist entirely of consonants in the root dictionary; use main dictionary instead.

A root dictionary key cannot consist entirely of consonants, since Speechify spells out sequences of all consonants before root dictionary lookup occurs. An entry like the following can be placed in the main dictionary instead:

ng \![.1EG]

Check language supplements for variations

The use of the root dictionary varies among languages. For formatting requirements and examples of valid root dictionary keys and translations, see the appropriate Speechify Language Supplement.

Choosing a dictionary

This section covers guidelines for determining which dictionary to use for particular entries.

Speechify includes two kinds of text processing functions:

❏ determining how the input text should be read❏ specifying how words are pronounced

The first kind of processing is discussed in greater detail in Chapter 3, and includes expanding abbreviations and acronyms, reading digit sequences, and interpreting non-alphanumeric characters such as punctuation and currency symbols. For example, specifying that the abbreviation “Fri.” should be read as “Friday” is different from specifying whether the word “Friday” should be pronounced so that the last vowel is the same as in the word “day” or the same as in the word “bee.” This distinction is reflected in the dictionaries, as discussed in the following sections.

SpeechWorks Proprietary Fifth Edition, Update 26–63

User DictionariesSpeechify User’s Guide

Main and abbreviation dictionaries vs. root dictionary

Both the main and abbreviation dictionaries are used to specify how input text should be read, while the root dictionary is used to specify how individual words should be pronounced. Word pronunciations can be specified by either an SPR (phonetic representation) or another word (real or invented) that has the desired pronunciation.

Because words are, with a few exceptions, pronounced the same whether they are in uppercase, lowercase, or mixed case letters, root dictionary lookup is not case-sensitive. An entry that you add with a lowercase key applies to words in text when they are capitalized or uppercase. For example, if you specify that “friday” should be pronounced “frydi,” then "Friday" and “FRIDAY” are also pronounced “frydi.”

On the other hand, main and abbreviation dictionary lookups are case-sensitive, since the reading of particular character strings can be affected by letter case. For example, the abbreviation “ft.” is read as “foot,” while “Ft.” is read as “Fort.” “ERA” might be read as “Equal Rights Amendment,” but “era” should still be read as “era.”

Main dictionary vs. abbreviation dictionary

The main dictionary can be thought of as a string replacement dictionary: with the few exceptions outlined in the Main dictionary section above, it is used to replace any input string with any other input string. Use it when either the key or the translation contains non-alphabetic characters. You can use it to specify the reading of e-mail addresses, alphanumeric sequences such as “Win2K,” digit sequences, and the like, or even to encode entire phrases or sentences in a single token.

The abbreviation dictionary is used to expand what we normally think of as abbreviations: shortened forms of a word that may end in a period to signal that they are abbreviations, and which expand into full words. Abbreviations are entered in a separate dictionary because the final period is handled differently in abbreviations than in main dictionary entries (see “Interpretation of trailing periods in the abbreviation dictionary” on page 6-61).

Fifth Edition, Update 2 SpeechWorks Proprietary6–64

Choosing a dictionarySpeechify User’s Guide

The following table shows some sample entries, along with the dictionary they should be entered in.

Dictionary interactions

The order of lookups is main, abbreviation, root. Since the translation from one dictionary is looked up in subsequent dictionaries, dictionary entries can feed into one another. For example, given the dictionary entries in the following table:

The input and output are as follows:

Key Translation Dictionary

Win2K Windows 2000orWindows two thousand

main

4x4 4 by 4orfour by four

main

50% half main

Phrase217 How may I help you? main

FAA Federal Aviation Administration main

f.a.a. free of all average abbreviation

sunday sundior\![1sHndi]

root

quay key root

Key Translation Dictionary

h/w hrs. per wk. main

hrs. hours abbreviation

wk. week abbreviation

hours \![1arz] root

Input Pronunciation

h/w \![1arz] \![1pR] \![1wik]

SpeechWorks Proprietary Fifth Edition, Update 26–65

User DictionariesSpeechify User’s Guide

If the same key occurs in more than one dictionary, the order of lookups determines which entry is used. For example, given the following entries:

The input and output are as follows:

Remember, however, that the main and abbreviation dictionary lookups are case-sensitive, while the root dictionary lookups are case-insensitive. Given the entries shown above, only the root dictionary entry will apply to "Win":

File-based dictionaries

There are two ways to add entries to a user dictionary:

❏ At run time: use an API function to add entries

❏ When the server initializes: load a set of entries from a file. This option may be more convenient when the set of entries is large or changes infrequently. Using this facility, you can make changes to the entries in the file without having to change or rebuild your application.

Note that entries added during run time supersede entries from a file-based dictionary.

Details on adding dictionary entries at run time are found in “SWIttsAddDictionaryEntry( )” on page 7-73. This section provides details about file-based dictionaries.

Key Translation Dictionary

win Microsoft Windows main

win windows abbreviation

win \![wIn] root

Input Pronunciation

win microsoft windows

Input Pronunciation

Win \![wIn]

Fifth Edition, Update 2 SpeechWorks Proprietary6–66

File-based dictionariesSpeechify User’s Guide

File-based dictionaries are loaded when you start the Speechify server. For each dictionary type (main, root, or abbreviation in Western languages, mainext in Japanese) you can have one file containing a set of entries (a file-based dictionary) for the language and one for the voice. Entries in language-specific dictionaries affect all voices for a certain language. Entries in voice-specific dictionaries affect only one voice.

In general, language-specific dictionaries are used to overcome areas where Speechify’s pronunciation rules do not produce correct pronunciations. This can be the case with proper names, names of corporations, etc. Voice-specific dictionaries are used less often and are mostly useful when a specific voice pronounces a word inconsistently compared to all other voices.

Once the server has initialized, you can modify the loaded file-based dictionaries by calls to SWIttsAddDictionaryEntry( ), SWIttsResetDictionary( ), and SWIttsDeleteDictionaryEntry( ). Thus, the API functions take precedence over the content of the file-based dictionaries. The language dictionary is loaded before the voice dictionary, so the entries in the voice dictionary take precedence over the entries in the language dictionary.

For example, if your root file dictionary contains an entry for “cat,” that entry is loaded when you start the server. If during run time you use SWIttsDeleteDictionaryEntry( ) to delete “cat,” it is deleted until you either re-add “cat” with SWIttsAddDictionaryEntry( ) or you restart the server (to load it from the file again). This behavior is consistent for all languages.

Dictionary loading

The Speechify engine attempts to load the dictionaries each time the application calls SWIttsOpenPort( ). Subsequent changes made via API functions such as SWIttsAddDictionaryEntry( ) can override the contents of the default dictionaries. If an error occurs while loading a dictionary, the server generates an error message and continues to initialize. The server logs a diagnostic message if a dictionary file is successfully loaded or if a dictionary file is not found.

SpeechWorks Proprietary Fifth Edition, Update 26–67

User DictionariesSpeechify User’s Guide

File names and locations

To use language-specific dictionaries, create a text file for one or more of the dictionary types described above and place it in the <voice_dir>/<language ID> directory. The name of the text file is xx-XX-type.dic, e.g.:

C:\Program Files\Speechify\en-US\en-US-main.dic\en-US-root.dic\en-US-abbreviation.dic

To use voice-specific dictionaries, place the files in the <voice_dir>/<language ID>/<voice name> directory. The name of the file is name-type.dic, e.g.:

C:\Program Files\Speechify\en-US\rick\rick-main.dic\rick\rick-root.dic\rick\rick-abbreviation.dic

File format

A file-based dictionary is a text file that contains one or more dictionary entries. There is only one entry per line and each entry has the following format:

<key><Tab><translation><new line>

❏ For Western European languages, use the Latin-1/ISO-8859-1 encoding. For Japanese, use the Shift-JIS encoding.

❏ The key and translation values should be equivalent to what you would pass to the SWIttsAddDictionaryEntry( ) function; therefore the rules for what constitutes legal values for these functions apply. See the chapter on user dictionaries in the appropriate Speechify Language Supplement to get a list of these rules.

❏ The new line character must be in the format of the server operating system (i.e., on Windows: CR+LF, on Unix: LF).

For example, you may have a file C:\Program Files\Speechify\en-US\en-US-main.dic that contains the following entry:

test \![hx1lo]

If you submit the text “this is a test” to Speechify, it says, “this is a hello.”

Fifth Edition, Update 2 SpeechWorks Proprietary6–68

CHAPTER 7

API Reference

This chapter describes the API functions in alphabetical order. All API function prototypes, types, error codes, and constants are located in the header file SWItts.h.

In this chapter

• Calling convention on page 7-70

• Server’s preferred character set on page 7-70

• Result codes on page 7-71

• SWIttsAddDictionaryEntry( ) on page 7-73

• SWIttsCallback( ) on page 7-75

• SWIttsClosePort( ) on page 7-80

• SWIttsDeleteDictionaryEntry( ) on page 7-81

• SWIttsGetDictionaryKeys( ) on page 7-83

• SWIttsGetParameter( ) on page 7-86

• SWIttsInit( ) on page 7-88

• SWIttsLookupDictionaryEntry( ) on page 7-89

• SWIttsOpenPort( ) on page 7-91

• SWIttsPing( ) on page 7-92

• SWIttsResetDictionary( ) on page 7-93

• SWIttsSetParameter( ) on page 7-94

• SWIttsSpeak( ) on page 7-96

• SWIttsStop( ) on page 7-98

• SWIttsTerm( ) on page 7-99

SpeechWorks Proprietary Fifth Edition, Update 27–69

API ReferenceSpeechify User’s Guide

Calling convention

All Speechify API functions use the stdcall (or Pascal) calling convention. The header files contain the appropriate compiler directives to ensure correct compilation. When writing callback functions, be sure to use the correct calling convention.

The calling convention is dependent on the operating system, and is defined in the SWItts.h header file.

Under NT:

#define SWIAPI __stdcall

Under UNIX:

#define SWIAPI

Server’s preferred character set

The server’s preferred character set is ISO-8859-1 (also known as Latin-1). All strings passed to the server by calls to SWIttsAddDictionaryEntry( ), SWIttsDeleteDictionaryEntry( ), SWIttsLookupDictionaryEntry( ), and SWIttsSpeak( ) are converted to ISO-8859-1 before they are processed internally. Consequently, in Speechify 2.1, text entered into these functions must be representable in ISO-8859-1 even if it is encoded in another character set supported by Speechify. (Japanese is an exception, because it does not support ISO-8859-1. The Japanese server’s preferred character set is Shift-JIS.)

Calls which return strings, such as SWIttsLookupDictionaryEntry( ) and SWIttsGetDictionaryKeys( ), return them in ISO-8859-1. Bookmark IDs are converted to 0-terminated wide character strings before they are returned to the user.

Fifth Edition, Update 2 SpeechWorks Proprietary7–70

Server’s preferred character setSpeechify User’s Guide

Result codes

The following result codes are defined in the enum SWIttsResult in SWItts.h.

Code Description

SWItts_SUCCESS The API function completed successfully.

SWItts_ALREADY_EXECUTING_API This API function cannot be executed because another API function is in progress on this port on another thread.

SWItts_CONNECT_ERROR The client could not connect to the server.

SWItts_ENGINE_ERROR An internal error occurred in the TTS engine on the server.

SWItts_ERROR_PORT_ALREADY_STOPPING SWIttsStop( ) was called when the port was already in the process of stopping.

SWItts_ERROR_STOP_NOT_SPEAKING SWIttsStop( ) was called when the port was not speaking.

SWItts_FATAL_EXCEPTION (NT only.) A crash occurred within the client library. A crash log named ALTmon.dmp might have been generated in the Speechify SDK directory. Please send it to Speechify technical support. This is an unrecoverable error and you should close the application.

SWItts_HOST_NOT_FOUND Could not resolve the host name or IP address.

SWItts_INVALID_PARAMETER One of the parameters passed to the function was invalid.

SWItts_INVALID_PORT The port handle passed is not a valid port handle.

SWItts_MUST_BE_IDLE This API function can only be called if the TTS port is idle.

SWItts_NO_ENGINE The engine on this port is no longer available.

SWItts_NO_MEMORY An attempt to allocate memory failed.

SWItts_NO_MUTEX An attempt to create a new mutex failed.

SWItts_NO_THREAD An attempt to create a new thread failed.

SWItts_NOT_EXECUTING_API An internal error. Notify SpeechWorks technical support if you see this result code.

SWItts_PORT_ALREADY_SHUT_DOWN The port is already closed. You cannot invoke SWIttsClosePort( ) on a port that has been closed.

SWItts_PORT_ALREADY_SHUTTING_DOWN

SWIttsClosePort( ) was called when the port was already being closed.

SWItts_PORT_SHUTTING_DOWN A command could not be executed because the port is shutting down.

SWItts_PROTOCOL_ERROR An error in the client/server communication protocol occurred.

SWItts_READ_ONLY SWIttsSetParameter( ) was called with a read-only parameter.

SWItts_SERVER_ERROR An error occurred on the server.

SWItts_SOCKET_ERROR A sockets error occurred.

SWItts_SSML_PARSE_ERROR Could not parse SSML text.

SWItts_UNINITIALIZED The TTS client is not initialized.

SpeechWorks Proprietary Fifth Edition, Update 27–71

API ReferenceSpeechify User’s Guide

This is the full set of codes that the API functions return. No functions return all the codes. SWItts_SUCCESS and SWItts_FATAL_EXCEPTION are the only codes that are common to all functions. All functions except SWIttsInit( ) return SWItts_UNINITIALIZED if SWIttsInit( ) was not the first function called.

SWItts_UNKNOWN_CHARSET Character set is invalid or unsupported.

SWItts_UPDATE_DICT_PARTIAL_SUCCESS SWIttsAddDictionaryEntry( ) or SWIttsDeleteDictionaryEntry( ) was called with one or more invalid entries.

SWItts_WINSOCK_FAILED WinSock initialization failed. (NT Only.)

Code Description

Fifth Edition, Update 2 SpeechWorks Proprietary7–72

Server’s preferred character setSpeechify User’s Guide

SWIttsAddDictionaryEntry( )Mode: Synchronous

Adds a list of dictionary entries to the specified dictionary.

SWIttsResult SWIAPI SWIttsAddDictionaryEntry (SWIttsPort ttsPortExt,const char *dictionaryType,const char *charset,unsigned int numEntries,SWIttsDictionaryEntry *entries

);

SWIttsDictionaryEntry is the data structure encapsulating dictionary entry data. In the context of SWIttsAddDictionaryEntry( ) it is used as follows:

typedef struct {const unsigned char *key;unsigned int keyLengthBytes;const unsigned char *translation;

Parameter Description

ttsPort Port handle returned by SWIttsOpenPort( ).

dictionaryType The type of dictionary to add entries to. The following types are supported as US-ASCII strings:❏ main❏ root❏ abbreviation

See “User Dictionaries” on page 6-59 for information about these dictionary types.

charset The charset used to encode the content of individual entries.

For Western languages, the default charset (if NULL is passed in) is ISO-8859-1. The following charsets are supported as case-insensitive, US-ASCII strings:❏ US-ASCII (acceptable synonym: ASCII)❏ ISO-8859-1❏ UTF-8❏ UTF-16

For Japanese, the default charset is Shift-JIS. The following charsets are supported:❏ Shift-JIS❏ EUC❏ UTF-8❏ UTF-16

numEntries Number of entries being passed to the call.

entries Array of dictionary entries to be added to the dictionary.

SpeechWorks Proprietary Fifth Edition, Update 27–73

API ReferenceSpeechify User’s Guide

unsigned int translationLengthBytes;} SWIttsDictionaryEntry;

Notes

SWIttsAddDictionaryEntry( ) is not an atomic operation. If one or more of the entries fail to be added, for whatever reason, the rest may still take place. SWItts_UPDATE_DICT_PARTIAL_SUCCESS is returned and the entries that failed to be added are logged on the server. See “Speechify Logging” on page A-109 for more information about logging.

If SWIttsAddDictionaryEntry( ) is called with a key that already exists in the dictionary, the existing translation is replaced with the new translation. At present, there can only be one translation for each key in the dictionary.

See also

“SWIttsDeleteDictionaryEntry( )” on page 7-81“SWIttsGetDictionaryKeys( )” on page 7-83“SWIttsLookupDictionaryEntry( )” on page 7-89“SWIttsResetDictionary( )” on page 7-93

Member Description

key The key to be added to the dictionary. It must be in the character set specified by the charset parameter in the call to SWIttsAddDictionaryEntry( ). See “User Dictionaries” on page 6-59 for information about the format of the key.

keyLengthBytes The length of key in bytes.

translation The translation to be added to the dictionary. It must be in the character set specified by the charset parameter in the call to SWIttsAddDictionaryEntry( ). See “User Dictionaries” on page 6-59 for information about the format of the translation.

translationLengthBytes The length of translation in bytes.

Fifth Edition, Update 2 SpeechWorks Proprietary7–74

Server’s preferred character setSpeechify User’s Guide

SWIttsCallback( )Mode: Synchronous. IMPORTANT: You must not block/wait in this function.

User-supplied handler for data returned by the synthesis server.

typedef SWIttsResult (SWIAPI SWIttsCallback) (SWIttsPort ttsPort,SWItts_cbStatus status,void *data,void *userData

);

This table lists the values of SWItts_cbStatus:

Parameter Description

ttsPort The port handle returned by SWIttsOpenPort( ) or -1 if the callback is called from within SWIttsInit( ), SWIttsOpenPort( ), or SWIttsTerm( ).

status These are enumerated types that are used to inform the callback function of the status of the void *data variable. See table below.

data Pointer to a structure containing data generated by the server. This pointer is declared as void * because the exact type varies. The status parameter indicates the exact type to which this pointer should be cast.

userData This is a void * in which the application programmer may include any information that he wishes to be passed back to the callback function. A typical example is a thread ID that is meaningful to the application. The userData variable is a value you pass to SWIttsOpenPort( ).

Status code Description

SWitts_cbAudio Audio data packet. The data structure is a SWIttsAudioPacket shown below.

SWItts_cbBookmark User-defined bookmark. The data structure is a SWIttsBookMark as shown below.

SWItts_cbDiagnostic Diagnostic message. The data structure is a SWIttsMessagePacket as shown below. You only receive this message if the SWITTSLOGDIAG environment variable is defined. See “Speechify Logging” on page A-109 for more information about logging.

SWItts_cbEnd End of audio packets from the current SWIttsSpeak( ) command. The data is a NULL pointer.

SpeechWorks Proprietary Fifth Edition, Update 27–75

API ReferenceSpeechify User’s Guide

Structures

The audio packet data structure is described here:

typedef struct {void *samples;unsigned int numBytes;unsigned int firstSampleNumber;

} SWIttsAudioPacket;

SWItts_cbError Asynchronous error message. The data structure is a SWIttsMessagePacket which contains error information, and is described below. This message is received if an asynchronous API function encounters an error when trying to perform an asynchronous operation such as reading from the network. If you receive this message, consider it fatal for that port. You are free to call SWItts functions from the callback but you should consider the receipt of SWItts_cbError fatal and call SWIttsClosePort( ) to properly clean up the port.

SWItts_cbLogError Error message. The data structure is a SWIttsMessagePacket which contains error information, and is described below. The callback may receive the cbLogError and cbDiagnostic events at anytime, whether inside a synchronous or asynchronous function. The user is not allowed to call any SWItts function at this time. If you receive this message, log it to a file, console, etc., and continue execution.

SWItts_cbPhonememark Represents information about a phoneme boundary in the input text. The data structure is a SWIttsPhonemeMark shown below.

SWItts_cbPing A reply was received from the TTS port on the server after a call to SWIttsPing( ). The data is a NULL pointer.

SWItts_cbPortClosed The port was successfully closed after a call to SWIttsClosePort( ). The data is a NULL pointer.

SWItts_cbStart Represents the commencement of audio packets from the current SWIttsSpeak( ) command. The data is a NULL pointer.

SWItts_cbStopped SWIttsStop( ) has been called and recognized. There is no SWItts_cbEnd notification. The data is a NULL pointer.

SWItts_cbWordmark Represents information about a word boundary in the input text. The data structure is a SWIttsWordMark shown below

Status code Description

Fifth Edition, Update 2 SpeechWorks Proprietary7–76

Server’s preferred character setSpeechify User’s Guide

The message packet data structure is described here:

typedef struct {time_t messageTime;unsigned short messageTimeMs;unsigned int msgID;unsigned int numKeys;const wchar_t **infoKeys;const wchar_t **infoValues;const wchar_t *defaultMessage

} SWIttsMessagePacket;

See “Speechify Logging” on page A-109 for information about how to map msgID into a meaningful message.

Member Description

samples The buffer of speech samples. You must copy the data out of this buffer before the callback returns as the client library may free it or overwrite the contents with new samples.

numBytes The number of bytes in the buffer. This number of bytes may be larger than the number of samples, e.g., if you’ve chosen a sample format of 16-bit linear, the number of bytes would be twice the number of samples.

firstSampleNumber

The accumulated number of samples in the current SWIttsSpeak( ) call. The first packet has a sample number of zero.

Member Description

messageTime The absolute time at which the message was generated.

messageTimeMs An adjustment to messageTime to allow millisecond accuracy.

msgID An unique identifier. A value of 0 is used for SWItts_cbDiagnostic messages.

numKeys The number of key/value pairs.

infoKeys/infoValues Additional information about message, in key/value pairs of 0-terminated wide character string text. These members are only valid for SWItts_cbError and SWItts_cbLogError messages.

defaultMessage A pre-formatted 0-terminated wide character message. This member is only valid for SWItts_cbDiagnostic messages.

SpeechWorks Proprietary Fifth Edition, Update 27–77

API ReferenceSpeechify User’s Guide

The bookmark data structure is described here:

typedef struct {const wchar_t *ID;unsigned int sampleNumber;

} SWIttsBookMark;

The wordmark data structure is described here:

typedef struct {unsigned int sampleNumber;unsigned int offset;unsigned int length;

} SWIttsWordMark;

The phoneme-mark data structure is described here:

typedef struct {unsigned int sampleNumber;const char *name;unsigned int duration;unsigned int stress;

} SWIttsPhonemeMark;

Member Description

ID A pointer to the bookmark 0-terminated wide character string in the server’s preferred character set. It corresponds to the user-defined string specified in the bookmark tag.

See “Server’s preferred character set” on page 7-70 for more information.

sampleNumber The accumulated number of samples in the current SWIttsSpeak( ) call. A bookmark placed at the beginning of a string has a timestamp of 0.

Member Description

sampleNumber The sample number correlating to the beginning of this word.

offset The index into the input text of the first character where this word begins. Starts at zero.

length The length of the word in characters not bytes.

Member Description

sampleNumber The sample number correlating to the beginning of this phoneme.

name The name of the phoneme as a NULL-terminated US-ASCII string. (The phoneme names are described in the Speechify supplements for each language.)

Fifth Edition, Update 2 SpeechWorks Proprietary7–78

Server’s preferred character setSpeechify User’s Guide

Notes

The callback function is user-defined but is called by the SWItts library, i.e., the user writes the code for the callback function, and a pointer to it is passed into the SWIttsOpenPort( ) function. The client calls this function as needed when data arrives from the Speechify server. It is called from a thread created for the port during the SWIttsOpenPort( ) function.

The SWItts_cbStatus variable indicates the reason for invoking the callback and also what, if any, type of data is being passed. The SWIttsResult code returned by the callback is not currently interpreted by Speechify, but may be in the future, thus the callback function should always return SWItts_SUCCESS.

NOTE

Because the callback function is user-defined, the efficiency of its code has a direct impact on system performance – if it is inefficient, it may hinder the client’s ability to service the network connection and data may be lost.

The Speechify server does not “throttle” its transmission of audio data from it to the client; it sends the audio as fast as it can. This means that sending a large amount of text to the SWIttsSpeak( ) function may cause the server to send back a large amount of audio before the application needs to send it to an audio device or telephony card.

On average, expect about one second of audio for every ten characters of text input. For example, if you pass 10 KB of text to the SWIttsSpeak( ) function, your callback may receive about 1000 seconds of audio samples. That is 8 MB of data if you chose to receive 8-bit µ-law samples and 16 MB of data if you chose to receive 16-bit linear samples. This amount of text may require more buffering than you want to allow for, especially in a scenario with multiple TTS ports.

A common technique to avoid a buffering load is to divide your input text into pieces, sending a new speak request for one piece when the previous is finished playing. For best results, you should divide the text at sentence boundaries such as periods.

duration The length of the phoneme in samples.

stress Indicates whether the phoneme was stressed or not. A 0 indicates no stress, a 1 indicates primary stress, and a 2 indicates secondary stress.

Member Description

SpeechWorks Proprietary Fifth Edition, Update 27–79

API ReferenceSpeechify User’s Guide

SWIttsClosePort( ) Mode: Asynchronous

Closes a TTS port which frees all resources and closes all communication with the server.

SWIttsResult SWIAPI SWIttsClosePort (SWIttsPort ttsPort

);

After closing, SWIttsClosePort( ) sends a SWItts_cbPortClosed message to the callback upon successful closing of the port. Once a port is closed, you cannot pass that port handle to any SWItts function.

See also

“SWIttsOpenPort( )” on page 7-91

Parameter Description

ttsPort Port handle returned by SWIttsOpenPort( ).

Fifth Edition, Update 2 SpeechWorks Proprietary7–80

Server’s preferred character setSpeechify User’s Guide

SWIttsDeleteDictionaryEntry( )Mode: Synchronous

Deletes a list of dictionary entries from a dictionary.

SWIttsResult SWIAPI SWIttsDeleteDictionaryEntry (SWIttsPort ttsPort,const char *dictionaryType,const char *charset,unsigned int numEntries,SWIttsDictionaryEntry *entries

);

The dictionary entry data structure in the context of SWIttsDeleteDictonaryEntry( ) is explained here:

typedef struct {const unsigned char *key;unsigned int keyLengthBytes;const unsigned char *translation;

Parameter Description

ttsPort Port handle returned by SWIttsOpenPort( ).

dictionaryType The type of dictionary to delete entries from. The following types are supported as US-ASCII strings:❏ main❏ root❏ abbreviation

See “User Dictionaries” on page 6-59 for information about the different dictionary types.

charset The charset used to encode the content of individual entries.

For Western languages, the default charset (if NULL is passed in) is ISO-8859-1. The following charsets are supported as case-insensitive, US-ASCII strings:❏ US-ASCII (acceptable synonym: ASCII)❏ ISO-8859-1❏ UTF-8❏ UTF-16

For Japanese, the default charset is Shift-JIS. The following charsets are supported:❏ Shift-JIS❏ EUC❏ UTF-8❏ UTF-16

numEntries Number of entries being passed to the call.

entries An array of dictionary entries to be deleted from the dictionary.

SpeechWorks Proprietary Fifth Edition, Update 27–81

API ReferenceSpeechify User’s Guide

unsigned int translationLengthBytes;} SWIttsDictionaryEntry;

Notes

SWIttsDeleteDictionaryEntry( ) is not an atomic operation. If one or more of the entries fail to be deleted, for whatever reason, the rest may still take place. SWItts_UPDATE_DICT_PARTIAL_SUCCESS is returned and the entries that failed to be deleted are logged on the server. See “Speechify Logging” on page A-109 for more information about logging.

Requesting deletion of non-existent entries does not return an error.

See also

“SWIttsAddDictionaryEntry( )” on page 7-73“SWIttsGetDictionaryKeys( )” on page 7-83“SWIttsLookupDictionaryEntry( )” on page 7-89“SWIttsResetDictionary( )” on page 7-93

Member Description

key The key to be deleted from the dictionary. It must be in the character set specified by the charset parameter in the call to SWIttsDeleteDictionaryEntry( ). The associated translation is also be deleted.

See “User Dictionaries” on page 6-59 for information about the format of the key.

keyLengthBytes The length of key in bytes.

translation Not used in this call. It should be set to NULL.

translationLengthBytes Not used in this call. It should be set to 0.

Fifth Edition, Update 2 SpeechWorks Proprietary7–82

Server’s preferred character setSpeechify User’s Guide

SWIttsGetDictionaryKeys( )Mode: Synchronous

Enumerates dictionary keys from the specified dictionary.

SWIttsResult SWIAPI SWIttsGetDictionaryKeys(SWIttsPort ttsPort,const char *dictionaryType,SWIttsDictionaryPosition *startingPosition,unsigned int *numkeys,SWIttsDictionaryEntry **keys,const char *reserved

);

The dictionary entry data structure in the context of SWIttsGetDictionaryKeys( ) is explained here:

typedef struct {const unsigned char *key;unsigned int keyLengthBytes;const unsigned char *translation;unsigned int translationLengthBytes;

} SWIttsDictionaryEntry;

Parameter Description

ttsPort The port handle returned by SWIttsOpenPort( ).

dictionaryType The type of dictionary to enumerate entries from. The following types are supported as US-ASCII strings:❏ main❏ root❏ abbreviation

See “User Dictionaries” on page 6-59 for information about the different dictionary types.

startingPosition A token encoding the state of the enumeration. See below for a description.

numKeys On call, the maximum number of keys to be retrieved (use a very large number e.g., UINT_MAX, to get all of them), on return the number of keys actually retrieved.

keys Pointer to an array of keys retrieved. This array is valid until the next call to SWIttsGetDictionaryKeys( ).

reserved Reserved for future use (should be NULL).

SpeechWorks Proprietary Fifth Edition, Update 27–83

API ReferenceSpeechify User’s Guide

Notes

Enumerating keys from a dictionary requires a pointer to a SWIttsDictionaryPosition token. To start enumeration from the beginning, you need to create a SWIttsDictionaryPosition token, initialize it to 0, and pass a pointer to it to SWIttsGetDictionaryKeys( ). Upon return, check the token’s value.

If the token is 0, there are no more keys left in the dictionary. If it is non-zero, call SWIttsGetDictionaryKeys( ) again with a pointer to the token obtained from the last SWIttsGetDictionaryKeys( ) call. Continue this until, upon return from SWIttsGetDictionaryKeys( ), the position token has a value of 0.

Currently, you are allowed only one outstanding enumeration at a time. To begin a new enumeration, set your SWIttsDictionaryPosition token to a value of 0.

Example

The following C++ code enumerates all dictionary entries, two at a time, from the “main” dictionary:

SWIttsResult tts_rc = SWItts_SUCCESS;SWIttsPort ttsPort;

SWIttsDictionaryEntry *entries;SWIttsDictionaryPosition pos = 0;unsigned int numEntries = 2; // Retrieve two keys at a time.

do{tts_rc = SWIttsGetDictionaryKeys(ttsPort, 7, &pos,

&numEntries, &entries, NULL);

Member Description

key A key retrieved from the dictionary in the server’s preferred character set. The key is not NULL-terminated. See “Server’s preferred character set” on page 7-70 for more information.

keyLengthBytes The length of the key in bytes.

translation Not used in this call. It is set to NULL upon return.

translationLengthBytes Not used in this call. It is set to 0 upon return.

Fifth Edition, Update 2 SpeechWorks Proprietary7–84

Server’s preferred character setSpeechify User’s Guide

if (tts_rc == SWItts_SUCCESS){for (unsigned int i = 0; i < numEntries; i++){char *key = new char[entries[i].keyLengthBytes + 1];memcpy(key, entries[i].key, entries[i].keyLengthBytes);key[entries[i].keyLengthBytes] = '\0';printf("%s\n", key);delete []key;

}numEntries = 2;

}} while (tts_rc == SWItts_SUCCESS && pos != 0);

See also

“SWIttsAddDictionaryEntry( )” on page 7-73“SWIttsDeleteDictionaryEntry( )” on page 7-81“SWIttsLookupDictionaryEntry( )” on page 7-89“SWIttsResetDictionary( )” on page 7-93

SpeechWorks Proprietary Fifth Edition, Update 27–85

API ReferenceSpeechify User’s Guide

SWIttsGetParameter( )Mode: Synchronous

Retrieves the value of a parameter from the server.

SWIttsResult SWIAPI SWIttsGetParameter (SWIttsPort ttsPort,const char *name,char *value

);

The following table describes the parameters that can be retrieved. All parameters have a default value and certain parameters are read-only.

Parameter Description

ttsPort The port handle returned by SWIttsOpenPort( ).

name The name of the parameter to retrieve.

value Takes a preallocated buffer of size SWITTS_MAXVAL_SIZE.

Name Possible values Default Read only Description

tts.audio.rate 33–300 100 no Port-specific speaking rate of the synthesized text as a percentage of the default rate.

tts.audio.volume 0–100 100 no Port-specific volume of synthesized speech as a percentage of the default volume: 100 means maximum possible without distortion and 0 means silence.

tts.audioformat.encoding ulaw, alaw, linear servera yes Encoding method for audio generated during synthesis.

This value can be set via the mimetype.

tts.audioformat.mimetype audio/basic audio/x-alaw-basic audio/L16;rate=8000audio/L16;rate=16000

server nob The audio format of the server:❏ audio/basic corresponds to 8 kHz,

8-bit µ-law; ❏ audio/x-alaw-basic corresponds to

8 kHz, 8-bit A-law; ❏ audio/L16;rate=8000 corresponds

to 8 kHz, 16-bit linear; ❏ audio/L16;rate=16000 corresponds

to 16 kHz, 16-bit linear.

All other values generate a SWItts_INVALID_PARAM return code. In all cases, audio data is returned in network byte order.

Fifth Edition, Update 2 SpeechWorks Proprietary7–86

Server’s preferred character setSpeechify User’s Guide

See also

“SWIttsSetParameter( )” on page 7-94

tts.audioformat.samplerate 8000, 16000 server yes Audio sampling rate in Hz.

This value can be set via the mimetype.

tts.audioformat.width 8, 16 server yes Size of individual audio sample in bits.

This value can be set via the mimetype.

tts.client.version Current Speechify version number

yes The returned value is a string of the form major.minor.maintenance. For example, 2.1.0 or 2.0.4.

This parameter reflects the client version, and can be retrieved after SWIttsInit( ) is called but before SWIttsOpenPort( ) is called. Use SWITTS_INVALID_PORT for the first argument to SWIttsGetParameter( ).

tts.marks.phoneme true, false false no Controls whether phoneme marks are reported to the client.

tts.marks.word true, false false no Controls whether wordmarks are reported to the client.

tts.network.packetsize 1K, 2K, 4K, 8K, 1MTU, 2MTU, 4MTU

4K no Size of the data packet sent to the callback in bytes or MTUs.

tts.reset none none no Command which causes all parameters controllable via SWIttsSetParameter( ) to revert to their default values; the value is ignored.

tts.voice.gender male, female server yes Synthesis voice gender.

tts.voice.language server server yes Synthesis language.

tts.voice.name server server yes Unique name identifying the voice.

a. Possible and default values indicated as “server” are determined by the particular server instance to which the application con-nects.

b. tts.audioformat.mimetype values may be switched between audio/basic, audio/x-alaw-basic, and audio/L16;rate=8000 if the server has been instantiated with the 8 kHz voice database. If the server is instantiated with the 16 kHz voice database, this parameter has the read-only value of audio/L16:rate=16000

Name Possible values Default Read only Description

SpeechWorks Proprietary Fifth Edition, Update 27–87

API ReferenceSpeechify User’s Guide

SWIttsInit( ) Mode: Synchronous

Initializes the client library so that it is ready to open ports.

SWIttsResult SWIAPI SWIttsInit (SWIttsCallback *callback,SWIttsCallback *userData

);

NOTE

This must be the first API function called, and it should only be called once per process, not once per call to SWIttsOpenPort( ).

See also

“SWIttsOpenPort( )” on page 7-91“SWIttsTerm( )” on page 7-99

Parameter Description

callback A pointer to a callback function that may receive SWItts_cbLogError and/or SWItts_cbDiagnostic messages during the SWIttsInit( ) call. If this callback is called, the ttsPort parameter is –1. This may be the same callback that is passed to SWIttsOpenPort( ) or SWIttsTerm( ).

userData User information passed back to callback. It is not interpreted or modified in any way by the client.

Fifth Edition, Update 2 SpeechWorks Proprietary7–88

Server’s preferred character setSpeechify User’s Guide

SWIttsLookupDictionaryEntry( )Mode: Synchronous

Retrieves the translation for the given key from the specified dictionary.

SWIttsResult SWIAPI SWIttsLookupDictionaryEntry(SWIttsPort ttsPort,const char *dictionaryType,const unsigned char *key,const char *charset,unsigned int keyLengthBytes,unsigned int *numEntries,SWIttsDictionaryEntry **entries

);

Parameter Description

ttsPort The port handle returned by SWIttsOpenPort( ).

dictionaryType The type of dictionary to retrieve the translation from. The following types are supported as US-ASCII strings:❏ main❏ root❏ abbreviation See “User Dictionaries” on page 6-59 for information about the different dictionary types.

key The key whose translation is to be retrieved. See “User Dictionaries” on page 6-59 for information about the format of the key.

charset The charset used to encode the content of individual entries.

For Western languages, the default charset (if NULL is passed in) is ISO-8859-1. The following charsets are supported as case-insensitive, US-ASCII strings:❏ US-ASCII (acceptable synonym: ASCII)❏ ISO-8859-1❏ UTF-8❏ UTF-16

For Japanese, the default charset is Shift-JIS. The following charsets are supported:❏ Shift-JIS❏ EUC❏ UTF-8❏ UTF-16

keyLengthBytes The length of the key in bytes.

numEntries The number of translations retrieved.

entries Pointer to an array of the translations retrieved. This array is valid until the next call to SWIttsLookupDictionaryEntry( ). If the data therein needs to be preserved, the application must copy it into a separate memory location.

SpeechWorks Proprietary Fifth Edition, Update 27–89

API ReferenceSpeechify User’s Guide

The dictionary entry data structure in the context of SWIttsLookupDictionaryEntry( ) is explained here:

typedef struct {const unsigned char *key;unsigned int keyLengthBytes;const unsigned char *translation;unsigned int translationLengthBytes;

} SWIttsDictionaryEntry;

At present, there can only be one translation for each key in the dictionary. This means that numEntries is always 1 upon return from the call.

Calling SWIttsLookupDictionaryEntry( ) with a key that is not in the dictionary does not return an error. It does, however, set numEntries to 0.

See also

“SWIttsAddDictionaryEntry( )” on page 7-73“SWIttsDeleteDictionaryEntry( )” on page 7-81“SWIttsGetDictionaryKeys( )” on page 7-83“SWIttsResetDictionary( )” on page 7-93

Member Description

key Not used in this call. It is set to NULL upon return.

keyLengthBytes Not used in this call. It is set to 0 upon return.

translation A translation for the key passed to SWIttsLookupDictionaryEntry( ) in the server’s preferred character set. The translation is not NULL-terminated. See “Server’s preferred character set” on page 7-70 for more information.

translationLengthBytes The length of the translation in bytes.

Fifth Edition, Update 2 SpeechWorks Proprietary7–90

Server’s preferred character setSpeechify User’s Guide

SWIttsOpenPort( )Mode: Synchronous

Opens and connects to a Speechify server port. This should be called after SWIttsInit( ).

SWIttsResult SWIAPI SWIttsOpenPort (SWIttsPort *ttsPort,char *hostAddr,unsigned short connectionPort,SWIttsCallback *callback,void *userData

);

See also

“SWIttsClosePort( )” on page 7-80“SWIttsInit( )” on page 7-88

Parameter Description

ttsPort Address of a location to place the new port’s handle.

hostAddr A string containing the host server’s name or IP address.

connectionPort The port to connect to on the server. Note that this parameter refers to a sockets port and not a TTS port. This parameter is always the same port as the one specified when you start the server with the --ports switch.

callback A pointer to a callback function that receives audio buffers and other notifications when the server sends data to the client. If an error occurs during the call to SWIttsOpenPort( ), the callback is called with a SWItts_cbLogError message and a ttsPort of –1.

userData User information passed back to callback.

SpeechWorks Proprietary Fifth Edition, Update 27–91

API ReferenceSpeechify User’s Guide

SWIttsPing( ) Mode: Asynchronous

Performs a basic test of server response.

SWIttsResult SWIAPI SWIttsPing (SWIttsPort ttsPort

);

More than just an IP-level “ping,” this verifies that the instance of the TTS server for this port is alive and accepting requests.

A return code of SWItts_SUCCESS means that the ping has been successfully sent to the TTS port. When the server replies, the client calls the callback for this port with a status of SWItts_cbPing. If this function returns an error code, shut down the port with the SWIttsClosePort( ) call. The amount of time you should wait for the SWItts_cbPing message in your callback varies depending on the load on your server; a good rule of thumb is to wait about five seconds for a ping reply before assuming the port is dead.

See also

“SWIttsClosePort( )” on page 7-80“SWIttsOpenPort( )” on page 7-91

Parameter Description

ttsPort The port handle returned by SWIttsOpenPort( )

Fifth Edition, Update 2 SpeechWorks Proprietary7–92

Server’s preferred character setSpeechify User’s Guide

SWIttsResetDictionary( )Mode: Synchronous

Removes all entries from the specified dictionary.

SWIttsResult SWIAPI SWIttsResetUserDictionary (SWIttsPort ttsPort,const char *dictionaryType

);

See also

“SWIttsAddDictionaryEntry( )” on page 7-73“SWIttsDeleteDictionaryEntry( )” on page 7-81“SWIttsGetDictionaryKeys( )” on page 7-83“SWIttsLookupDictionaryEntry( )” on page 7-89

Parameter Description

ttsPort Port handle returned by SWIttsOpenPort( ).

dictionaryType The type of dictionary to reset. The following types are supported as US-ASCII strings:mainrootabbreviationSee “User Dictionaries” on page 6-59 for information about the different dictionary types.

SpeechWorks Proprietary Fifth Edition, Update 27–93

API ReferenceSpeechify User’s Guide

SWIttsSetParameter( )Mode: Synchronous

Sends a parameter to the server.

SWIttsResult SWIAPI SWIttsSetParameter (SWIttsPort ttsPort,const char *name,const char *value

);

Notes

If SWIttsSetParameter( ) returns an error, the parameter is not changed. Setting a parameter is not a global operation, it only affects the TTS port passed to the call.

The following table describes the parameters that can be set. All parameters have a default value. SWIttsGetParameter( ) lists the read-only parameters. If you try to set a read-only parameter, SWIttsSetParameter( ) returns SWItts_READ_ONLY.

Parameter Description

ttsPort The port handle returned by SWIttsOpenPort( ).

name A parameter name represented as a NULL-terminated US-ASCII string.

value A parameter value represented as a NULL-terminated US-ASCII string.

Name Possible values Default Description

tts.audio.rate 33–300 100 Port-specific speaking rate of the synthesized text as a percentage of the default rate.

tts.audio.volume 0–100 100 Port-specific volume of synthesized speech as a percentage of the default volume: 100 means maximum possible without distortion and 0 means silence.

tts.audioformat.mimetype audio/basic audio/x-alaw-basic audio/L16;rate=8000audio/L16;rate=16000a

serverb The audio format of the server:❏ audio/basic corresponds to 8 kHz, 8-bit µ-law; ❏ audio/x-alaw-basic corresponds to 8 kHz, 8-bit

A-law; ❏ audio/L16;rate=8000 corresponds to 8 kHz, 16-

bit linear; ❏ audio/L16;rate=16000 corresponds to 16 kHz,

16-bit linear.

All other values generate a SWItts_INVALID_PARAM return code. In all cases, audio data is returned in network byte order.

Fifth Edition, Update 2 SpeechWorks Proprietary7–94

Server’s preferred character setSpeechify User’s Guide

See also

“SWIttsGetParameter( )” on page 7-86

tts.marks.phoneme true, false false Controls whether phoneme marks are reported to the client.

tts.marks.word true, false false Controls whether wordmarks are reported to the client.

tts.network.packetsize 1K 2K 4K 8K1MTU 2MTU 4MTU

4K Size of the data packet sent to the callback in bytes or MTUs.

tts.reset none none Command which causes all parameters controllable via SWIttsSetParameter( ) to revert to their default values; the value is ignored.

a. tts.audioformat.mimetype values may be switched between audio/basic, audio/x-alaw-basic, and audio/L16;rate=8000 if the server has been instantiated with the 8 kHz voice database. If the server is instantiated with the 16 kHz voice database, this parameter has the read-only value of audio/L16:rate=16000

b. Possible and default values indicated as “server” are determined by the particular server instance to which the application con-nects.

Name Possible values Default Description

SpeechWorks Proprietary Fifth Edition, Update 27–95

API ReferenceSpeechify User’s Guide

SWIttsSpeak( )Mode: Asynchronous

Sends a text string to be synthesized. Call this function for every text string to synthesize.

SWIttsResult SWIAPI SWIttsSpeak (SWIttsPort ttsPort,const unsigned char *text,unsigned int lengthBytes,const char *content_type

);

Notes

The content types that are supported are text/* and application/synthesis+ssml.

Any subtype may be used with “text”. However, only the subtype “xml” is treated specially: the text is assumed to be in SSML and if it is not, an error is returned. All other subtypes are treated as “plain”.

The application/synthesis+ssml content type is used to indicate SSML content, which is parsed accordingly. If SSML input is not signaled via the content type parameter, it is pronounced as plain text.

The only meaningful content_type parameter is “charset,” which is case-insensitive. (See www.iana.org/assignments/character-sets for more details.) All other parameters are ignored. If “charset” is not specified, it is assumed to be ISO-8859-1. An example of a valid content type:

text/plain;charset=iso-8859-1

Parameter Description

ttsPort The port handle returned by SWIttsOpenPort( ).

text The text to be synthesized: an array of bytes representing a string in a given character set.

lengthBytes The length of the text array in bytes; note that this means any NULL in the text is treated as just another character.

content_type Description of the input text according to the MIME standard (per RFC-2045 Sec. 5.1 and RFC 2046).

Default (if set to NULL): text/plain;charset=iso-8859-1. (You can change the default using the --default_contenttype server parameter described on page 1-13.)

Fifth Edition, Update 2 SpeechWorks Proprietary7–96

Server’s preferred character setSpeechify User’s Guide

The following charsets are supported for Western languages:

❏ ISO-8859-1 (default)❏ US-ASCII (synonym: ASCII)❏ UTF-8❏ UTF-16❏ wchar_t

The “wchar_t” character set is not a MIME standard. It indicates that the input is in the form of the client platform’s native wide character array (i.e., wchar_t*). Note that input length must still be specified in bytes (i.e., the number of wide characters in the input times the number of bytes per wide character).

The supported charsets vary for Asian languages. For example, Japanese does not support ISO-8859-1 (and thus, content_type becomes required). Japanese supports:

❏ UTF-8❏ UTF-16❏ EUC❏ Shift-JIS❏ wchar_t

Also for Japanese, the text-to-speech engine ignores any white space in the input text. For example, this allows correct processing when text begins on one line and is continued on the next. A result of this behavior, which you might not anticipate, is that numeric values separated by spaces, tabs, or returns are pronounced as single units: “1 2 3”, “1<tab>2<tab>3”, and “1<return>2<return>3” are all pronounced as “123”. To speak the digits individually, separate them with commas: “1,2,3”.

Note that for Speechify Japanese, the default byte order is set to big endian when the byte order mark is missing.

If text contains byte sequences that do not represent valid characters when converted to the server’s preferred character set, the server still performs the synthesis. It does this by removing the invalid characters and speaking the remaining text.

See also

“SWIttsStop( )” on page 7-98

SpeechWorks Proprietary Fifth Edition, Update 27–97

API ReferenceSpeechify User’s Guide

SWIttsStop( ) Mode: Asynchronous

Interrupts a call to SWIttsSpeak( ).

SWIttsResult SWIAPI SWIttsStop (SWIttsPort ttsPort

);

Notes

When the currently active speak request is completely stopped and the port is idle, the SWItts library calls the port’s callback with a status of SWItts_cbStopped. The callback is called with SWItts_cbStopped only if the SWIttsStop( ) function returns with a SWItts_SUCCESS result.

If there is no SWIttsSpeak( ) function in progress, or if a currently active speak request is already stopping due to a previous call to SWIttsStop( ), this function returns an error.

See also

“SWIttsSpeak( )” on page 7-96

Parameter Description

ttsPort The port handle returned by SWIttsOpenPort( ).

Fifth Edition, Update 2 SpeechWorks Proprietary7–98

Server’s preferred character setSpeechify User’s Guide

SWIttsTerm( )Mode: Synchronous

Closes all ports, terminates their respective threads, shuts down the API library, and cleans up memory usage.

SWIttsResult SWIAPI SWIttsTerm(SWIttsCallback *callback,void *userData

);

Notes

If SWIttsTerm( ) closes one or more open TTS ports, you receive SWItts_cbPortClosed messages in their respective callbacks.

See also

“SWIttsInit( )” on page 7-88

Parameter Description

callback A pointer to a callback function that may receive SWItts_cbError, SWItts_cbLogError, and/or SWItts_cbDiagnostic messages during the SWIttsTerm( ) call.

userData User information passed back to callback.

SpeechWorks Proprietary Fifth Edition, Update 27–99

API ReferenceSpeechify User’s Guide

Fifth Edition, Update 2 SpeechWorks Proprietary7–100

CHAPTER 8

Performance and Sizing

This chapter describes the metrics used to characterize the speed, efficiency, and load-handling capabilities of Speechify. Included is a description of the testing application itself.

Actual test results for any given Speechify release, platform, and voice are provided in a readme file that is created on your system during installation. These tests assume no specific tuning of any operating system to improve application performance. For all measurements, the client and test application are run on a machine separate from that hosting the server.

In this chapter

• Test scenario and application on page 8-102

• Performance statistics on page 8-103

• Resource consumption on page 8-105

• Performance thresholds on page 8-107

SpeechWorks Proprietary Fifth Edition, Update 28–101

Performance and SizingSpeechify User’s Guide

Test scenario and application

Speechify’s performance is dependent on the text being synthesized, including its content, complexity, individual utterance length, presence of unusual strings, abbreviations, etc. Similarly, the usage pattern, i.e., frequency and distribution of synthesis requests, affect the speed with which the server provides audio to the application.

The test application simulates a scenario where each TTS request is sent only after the allotted time required to play the audio from the previous request has elapsed. For example, if the application requests 10 seconds of audio from the server and receives the request within one second, it waits another 9 seconds before sending the next request. This request-wait-request pattern is executed on multiple threads with each thread assigned one connection to the server. This test application is included with the Speechify client SDK installation for easy measurement of performance figures for your specific server machines.

Sample texts are taken from a selection of newspaper articles with each heading and paragraph forming a separate speak request which is sent to the server in a random order, observing the timing described above. All of the measurements, except server CPU utilization and memory usage, are made on the application side of the Speechify API. Performance statistics are reported as a function of the number of channels to the server that are simultaneously opened by the test application.

The application is designed to submit text to the server over a variable and configurable number of channels (simultaneous connections). The command line specifies the initial and final number of channels as well as the increment. For example, a test run may begin with 40 channels and progress to 70 in increments of five. At each step the same number of synthesis requests, for example 100, is submitted per channel. For each channel count, the application reports various statistics describing the responsiveness and speed of the server. These are described below.

Fifth Edition, Update 2 SpeechWorks Proprietary8–102

Speechify User’s Guide

Performance statistics

SpeechWorks uses several metrics to characterize Speechify’s performance. You must understand their meaning to estimate the tasks and loads that the server is capable of handling on a given platform.

Latency (time-to-first-audio)

For Speechify, latency is defined as the time delay between the application’s call to SWIttsSpeak( ) and the arrival of the first corresponding audio packet in the callback function. Speechify uses streaming audio to minimize latency, but to obtain optimal rhythm and intonation, the TTS engine must process sentence-sized segments of text one at a time which causes a processing delay. The absolute value of latency is highly dependent on the characteristics of the requested text, specifically the length and, to a lesser degree, the complexity of the first sentence. Latency also begins to increase with the number of active server ports once the server CPU load approaches 90%.

Real-time factor

The real-time factor (xRT) of a Speechify TTS request is defined as the ratio of the audio playback duration to the processing time required to generate it. Expected latency is estimated from xRT and the duration of the audio corresponding to the first sentence of text. The latter should be approximately equal to the product of latency and the xRT.

For example, if it takes 500 ms to generate 10 sec of audio, the xRT is 20. A xRT of less than 1.0 takes the server longer to generate audio than an application to play it which means the system can never catch up with itself.

SpeechWorks Proprietary Fifth Edition, Update 28–103

Performance and SizingSpeechify User’s Guide

Audio buffer underflow

Audio buffer underflow refers to the audio dropout which occurs when the application consumes (plays out) all of the audio it received from the server and is idle while waiting for the next audio data packet. This may cause audible gaps in the output although many underflows are not perceptible.

An audio buffer underflow does not always lead to an audible gap. There is usually a further level of buffering performed by the audio driver software layers or even the application. This extra buffering “hides” a gap of a few milliseconds at the TTS API level at the cost of slightly greater latency.

Audio buffer underflow rate is the percentage of audio packets that arrive after their immediate predecessors already have been consumed. For the simulation application, each audio packet passed to the callback function contains 512 ms of audio data. An underflow rate of 1% therefore translates to a potential gap every 100 audio buffers, or 51.2 seconds of audio, and a rate of 0.01% equals a gap on average once every 90 minutes.

By default, the Speechify engine divides input text into sentences, and then processes each one in turn. Audio buffer underflows occur when the audio from a sentence has all been sent back through the API, but the audio for the next sentence is not ready. This can happen if the first sentence is very short, perhaps a single word, and the following one is long and complex. The client API adds some trailing silence to each sentence which means a short additional gap occurring during this silence may not be noticed or found objectionable.

Fifth Edition, Update 2 SpeechWorks Proprietary8–104

Speechify User’s Guide

Resource consumption

The Speechify server’s primary resources are CPU cycles and memory. Due to the demands placed on the hosting platform, you should choose a platform for the tasks that the server is expected to handle.

Server CPU utilization

Server CPU utilization is the percentage of the total CPU time spent processing user or system calls (the remainder is time the CPU is idle). As more TTS ports are opened and used for processing, CPU utilization increases approximately linearly. When CPU utilization approaches 100%, the Speechify server starts to saturate and performance degrades rapidly as further ports are opened.

NOTE

CPU utilization should be kept below 85%, which gives some leeway on the server allowing more consistent TTS performance.

Memory use

The Speechify server’s base memory use varies per voice, and is usually on the order of 80–100 MB. See the appropriate Speechify Language Supplement for details on memory use for the supported voices. Each connection made from a client via the SWIttsOpenPort( ) function is handled by a child process of the Speechify server.

❏ On UNIX systems, these additional processes are forked from the Speechify server.

❏ On Windows systems, these additional processes are usually pre-started for efficiency.

SpeechWorks Proprietary Fifth Edition, Update 28–105

Performance and SizingSpeechify User’s Guide

Child processes share most of their memory space with the parent server process and use additional memory only to store dynamic information needed to create each segment of speech. The size of this additional memory varies with the length and complexity of the input text but is usually on the order of 3–4 MB. Consequently, a Speechify server servicing 50 ports requires an additional 150–200 MB of memory.

Measuring server memory use on Windows NT/2000

Using the Windows Task Manager to measure memory usage can be misleading. The Mem Usage column shows the physical memory being used by each process but that includes memory shared between processes. Speechify processes share a base of about 100–110 MB, which means that while most or all Speechify processes may show a memory usage of 100 MB, almost all of it is shared and should not be counted more than once.

For a more accurate way of measuring Speechify’s total memory usage:

1. Boot your server machine and let it come to a steady state with respect to memory use with all of its native services, etc.

2. Start the Speechify processes.

3. Use all the Speechify processes for a few minutes then stop.

4. For each Speechify process, run “vadump –osp <pid>”, where vadump is in the Windows NT/2000 Resource Kit and <pid> is the decimal process ID available from the Task Manager.

5. Calculate total memory usage for Speechify as the sum of the following:

a. Grand Total Working Set Private Kbytes for each process

b. Grand Total Working Set Shareable Kbytes for each process

c. Grand Total Working Set Shared Kbytes, only the largest one of all processes.

Fifth Edition, Update 2 SpeechWorks Proprietary8–106

Speechify User’s Guide

Performance thresholds

SpeechWorks furnishes specific performance figures for each Speechify release and voice. SpeechWorks uses Pentium III, 1 GHz machines with 512 MB of RAM as the reference servers.

We summarize performance by reporting the maximum number of channels supported by the server on the reference platform. This is the maximum number of simultaneous connections that can be made by our test application while keeping the following performance limits:

❏ Audio buffer underflow rate <= 0.04%❏ Average latency <= 250ms❏ CPU utilization <= 85%

SpeechWorks Proprietary Fifth Edition, Update 28–107

Performance and SizingSpeechify User’s Guide

Fifth Edition, Update 2 SpeechWorks Proprietary8–108

APPENDIX A

Speechify Logging

Overview of logs

Speechify has comprehensive logging facilities. Both the client and server have error and diagnostic logs. In addition, the server has an event log.

Error log

The Speechify server uses the error log to report system faults (errors) and possible system faults (warnings) to the system operator for diagnosis and repair. The client and server report errors by error numbers that are mapped to text with an associated severity level. This mapping is maintained in a separate XML document that allows integrators to localize and customize the text without code changes. It also allows integrators and developers to review and re-define severity levels without code changes. Optional key/value pairs are used to convey details about the fault, such as the filename associated with the fault. These can be formatted into text using the information in the XML file. Speechify installs a US English version of this XML document in <InstallDir>/doc/SpeechifyErrors.en-US.xml.

SpeechWorks Proprietary Fifth Edition, Update 2A–109

Speechify User’s Guide

Diagnostic log

Developers and SpeechWorks support staff use the diagnostic log to trace and diagnose system behavior. Diagnostic messages are hard-coded text since they are private messages that are not intended for system operator use. Diagnostic logging has little or no performance impact if disabled but can impact system performance if turned on.

Event log (server only)

The Speechify server can automatically log results from usage activity to a file with a well-defined format. This is called event logging and you must use the “event_file” command-line option (see “--event_file <filename>” on page 1-14) to turn this on. The event log that is generated summarizes usage activity in order to support reporting for such things as capacity planning, performance, and application synthesis usage. Key/value pairs are used to convey details about each event, such as the number of characters in a synthesis request or the number of bytes of audio sent to the client. You may then process the file or files with tools such as Perl or grep to view statistics, identify problem areas or generate reports.

The events that Speechify logs describe such things as synthesis requests, client connections opened and closed, and error conditions. It is important to note that the event log is not the same thing as a diagnostic log that SpeechWorks may request in the event you need technical support. Nor is it an error log since not all error details are logged to the event log.

Client logging

Overview of client logs

The client has two classes of messages: error and diagnostic. The Speechify client library indicates these to an application by passing the SWItts_cbLogError and SWItts_cbDiagnostic status codes to the application’s SWIttsCallback( ) function. These codes have a structure associated with them, SWIttsMessagePacket, that the client sends with the status code. This structure contains detailed information that let

Fifth Edition, Update 2 SpeechWorks ProprietaryA–110

Client loggingSpeechify User’s Guide

the application writer determine how, where, and in what format, logging should happen. For more information on these codes and the structure, see “SWIttsCallback( )” on page 7-75.

Enabling diagnostic logging

Because the client can output a very large amount of diagnostic messages, the client does not send diagnostic messages to the application’s SWIttsCallback( ) function unless you explicitly tell it to do so by setting an environment variable named SWITTSLOGDIAG. The value does not matter as long as it exists. Unless it is set, the client library sends no diagnostic messages to SWIttsCallback( ). For example, from an Windows NT/2000 command shell:

set SWITTSLOGDIAG=1

To log the messages to a file, use these environment variables:

Logging to stdout/stderr

It is not necessary to implement code in the application SWIttsCallback function to enable logging from the Speechify client. To guarantee that SpeechWorks technical support staff can always obtain a log, default logging abilities are built into the client. To enable these, set an environment variable named SWITTSLOGTOSTD. If that variable exists (value is unimportant) then the client library logs diagnostic and error messages to stdout and stderr. Note that the callback function is invoked with the status codes SWItts_cbLogError and SWItts_cbDiagnostic whether or not the variable is set. Also, diagnostics are not printed unless they are turned on with SWITTSLOGDIAG as described above.

Variable Description

SWITTSLOGTOFILE Filename to collect the diagnostic messages.

SWITTSMAXLOGSIZE Maximum size of the log file in Kb. If this variable is not set, there is no limit on the log size.

When the log reaches the size limit, it rolls over into a file named the same as the log file with a .old suffix, then the logging resumes.

SpeechWorks Proprietary Fifth Edition, Update 2A–111

Speechify User’s Guide

Members of error messages are printed to stderr/stdout in the following order:

❏ A timestamp❏ The port number associated with the error (-1 if the port number was unknown

at the time of the message generation)❏ The thread instance in which the error occurred (currently the thread ID)❏ The error ID number❏ Zero or more key/value pairs with data specific to that error

Sep 22 11:45:33.19|0|7603|10002|filename=foo.bar

In the above example, the error occurred on September 22, at approximately 11:45 am. The port number was 0, the thread ID was 7603, and the error number was 10002. Looking at the SpeechifyErrors.en-US.xml, this error code refers to a missing file error. The error message in the XML file refers to a key/value pair named filename. The message above supplies a value for filename of “foo.bar” which is the missing file.

Server logging

Default logging behavior

By default, the Speechify server logs error messages to stdout (not stderr) and does not log diagnostic messages or events. On Windows systems, when the server is run as an NT Service, the server logs error messages to the NT Event Log.

Controlling logging with command-line options

The default logging behavior can be modified by the use of various command-line options. When running the server as an NT service, you can control these options via the Speechify MMC snap-in. See “Installing and Configuring Speechify” on page 1-1 for more details on using this applet and which options there correspond to the command-line options discussed here.

Fifth Edition, Update 2 SpeechWorks ProprietaryA–112

Server loggingSpeechify User’s Guide

--verbose

As in the client, the server does not print every diagnostic mes-sage to stdout by default. Otherwise, the output size would be very large. To enable detailed logging on the server, use the “--verbose <num>” option where <num> is an integer indicat-ing the level of detail desired. The numbering starts at zero.

--diagnostic_file

The server normally logs diagnostic output (controlled by the verbose flag) and errors to stdout. If you want to redirect these to a file, you could use standard command-line redirection. If you use the “--diagnostic_file <filename>” command-line option, the server sends these messages to the file specified (in addition to sending them to stdout). Using this option instead of standard redirection has the benefits of ease of use, limiting the size of the file and rolling it over when it grows past that size.

--event_file

To enable event logging, use the “--event_file <filename>” com-mand-line option. See “Event logging” on page A-114 for more details on event logging.

--system_log

As mentioned above, the server logs errors to stdout. If you use the “--system_log” command-line option, the server also logs error messages to the syslog facility on Unix systems and the NT Event Log facility on Windows systems. Note that this behavior is the default when running the server as an NT service on Win-dows.

Log file size and roll-over

When using the --diagnostic_file or the --event_file options, the Speechify server can log a large amount of data to disk. The rate of file growth differs from application to application but you can expect Speechify to log 10 MB of data for a system supporting 72 channels every 24 hours. If the file size exceeds 10 MB, the event logging system renames the current file to <filename>.old and starts logging to an empty file named <filename>. The system only keeps one old file around.

SpeechWorks Proprietary Fifth Edition, Update 2A–113

Speechify User’s Guide

Error message format

Errors contain the following information:

❏ A timestamp❏ The server instance in which the error occurred (currently the process ID)❏ The error ID number❏ Zero or more key/value pairs with data specific to that error

Examples:

Sep 13 14:01:13.52|329|10011

In the above example, the error occurred on September 13, a little after 2 pm. The process ID was 329 and the error number was 10011. SpeechifyErrors.en-US.xml identifies this error code as an SSML parsing error.

Sep 22 11:45:33.19|7603|10002|filename=foo.bar

In the above example, the error occurred on September 22, at approximately 11:45 am. The process ID was 7603 and the error number was 10002. SpeechifyErrors.en-US.xml identifies this error code as a missing file error. The error message in the XML file refers to a key/value pair named filename. The message above supplies a value for filename of “foo.bar” which is the missing file.

Event logging

Events contain the following information:

❏ A timestamp❏ Two tokens that describe the amount of CPU the current server instance has

used so far:

• The UCPU token records the User CPU used since the process started.

• The KCPU token records the total Kernel CPU used since the process started.❏ The server instance in which the event occurred (currently the process ID)❏ The event name❏ Zero or more tokens of data specific to that event.

Fifth Edition, Update 2 SpeechWorks ProprietaryA–114

Server loggingSpeechify User’s Guide

File format

The Speechify event log is an ANSI text file that contains one event per line. An event never spans more than one line. Each line is terminated by a new-line control sequence; Unix systems use “\n”, Windows systems use “\r\n”. The maximum size of a line is 10 kilobytes.

Event format

Within each event, multiple fields are separated by the “|” character.

❏ The first field is a timestamp with month, date, and time to the hundredth of a second.

❏ The second field is the event name.❏ The third field is the Speechify instance ID (currently the process ID).❏ This is followed by zero or more fields containing keys and values separated by

the “=” character. These key/value pairs are known as “tokens.”

NOTE

Any tool written to process Speechify event log files should allow for and ignore any unknown events or unknown fields within an event.

Example event log

This sample shows a simple series of events: the server starts (STRT then INIT), a client connects (OPEN), the client sets two parameters (SETP) and makes one synthesis request (SPKB then FAUD), the request completes (SPKE), then the client closes the connection (CLOS).

Mar 18 10:46:56.47|UCPU=20|KCPU=10|259|STRT|VERS=Development build|PROT=20020117|NAME=mara|LANG=en-US|FRMT=8|PORT=5555Mar 18 10:46:56.50|UCPU=2854|KCPU=640|334|INITMar 18 10:47:25.27|UCPU=40|KCPU=20|259|OPEN|clientIP=127.0.0.1Mar 18 10:47:25.32|UCPU=40|KCPU=20|259|SETP|NAME=tts.marks.word|VALU=falseMar 18 10:47:25.37|UCPU=40|KCPU=20|259|SETP|NAME=tts.marks.phoneme|VALU=trueMar 18 10:47:25.53|UCPU=40|KCPU=20|259|SPKB|NBYT=164|NCHR=81Mar 18 10:47:28.40|UCPU=70|KCPU=40|259|FAUDMar 18 10:47:28.59|UCPU=70|KCPU=50|259|SPKE|XMIT=23651Mar 18 10:47:28.62|UCPU=70|KCPU=50|259|CLOS

SpeechWorks Proprietary Fifth Edition, Update 2A–115

Speechify User’s Guide

Description of events and tokens

The following list shows the current set of Speechify event names and tokens.

NOTE

This list may expand in future releases. Any tool written to process Speechify event log files should allow for and ignore any unknown events or unknown tokens within an event.

Description Token names Example values Meaning

STRT – Indicates that Speechify has launched and is beginning the initialization phase.

VERS Relx-x X The version of Speechify, for example: “Rel2-0 d”

PROT 20010801 The version of the client/server protocol used.

LANG en-US The language of the server.

NAME rick The name of the voice used.

FRMT 8 The audio format of the speech database.

PORT 5555 The sockets port the server listens on.

INIT – Initialization done

(no tokens)

OPEN – Open connection from client

CLIP 10.2.1.244 The IP address of the client making the connection.

CLOS – Close connection to client

(no tokens)

SPKB – Speak begin. Logged when a speak request is received.

NBYT 4000 The number of bytes in the synthesis text.

NCHR 2000 The number of characters in the synthesis text.

FAUD – First audio. Logged when the first audio packet is sent to the client.

(no tokens)

STRQ – Stop request

(no tokens)

Fifth Edition, Update 2 SpeechWorks ProprietaryA–116

Server loggingSpeechify User’s Guide

STOP – Stop

XMIT 5678 The number of bytes of audio sent to the client before stopping.

SPKE – Speak end

XMIT 10450 The number of bytes of audio sent for the synthesis request.

SETP – Set parameter

NAME tts.marks.word The name of the modified parameter.

VALU false The new value of the parameter.

ERR – Error

ERRN 10002 The server error number

Description Token names Example values Meaning

SpeechWorks Proprietary Fifth Edition, Update 2A–117

Speechify User’s Guide

Fifth Edition, Update 2 SpeechWorks ProprietaryA–118

APPENDIX B

SSML

Speechify can accept input in the form of Speech Synthesis Markup Language (SSML). Speechify complies with the January 2001 draft specification which can be found at http://www.w3.org/TR/speech-synthesis. That document describes all the markup specifications that make up the SSML.

Speechify includes appropriate processing for most of the elements and attributes defined by the specification. For tags whose content fails to parse or is ambiguously formatted the server attempts to synthesize the raw text surrounded by the tag. In practice, this often results in correct output. Such cases are noted in the server error log. As long as the input is identified as SSML, the server never pronounces the tag markup itself. Nevertheless, unsupported tags encountered in the input appear in the server error log.

SpeechWorks Proprietary Fifth Edition, Update 2B–119

Speechify User’s Guide

Element support status

The table below outlines the extent to which SSML elements are currently supported by Speechify. It also notes the limitations on element attributes and content that Speechify currently requires of supported elements.

Elements Support Attributes and content notes/limitations

Audio No

Break Yes If neither the size nor the time attributes are used, the default break duration is 0.7 seconds. If size is specified to be “small”, the duration is 0.35 seconds, if “medium”, 0.7 seconds, and if “large”, 1 second.

Emphasis No

Mark No

Paragraph Yes

Phoneme Yes alphabet

Unsupported attribute. The phonetic representation (i.e., the “ph” attribute) must be specified in the Speechify SPR format. See “Symbolic Phonetic Representations” on page 5-55.

Prosody Partial The attributes “volume” and “rate” are supported; all others are ignored. Note that the values given for these attributes are interpreted relative to the corresponding port-specific values in effect at the time. (See “Controlling the audio characteristics” on page 4-51 for an explanation of port-specific values.)

Say-as Yes This element includes a large number of attributes and formats, virtually all of which are supported, see special section below for details.

Sentence Yes

Speak Yes xml:lang

Only available for languages supported by Speechify.

If an unsupported language is specified, the server logs an error and attempts to process subsequent tags using US English rules.

Voice No

Fifth Edition, Update 2 SpeechWorks ProprietaryB–120

Speechify User’s Guide

Support of the “say-as” element

The “say-as” element identifies the type of text contained therein. This can facilitate the correct pronunciation of the element’s content. Speechify supports both the “type” and the “sub” attributes. The table below lists the possible values of the former and provides some guidance to their usage:

say-as “type” attribute

Notes and cautions

acronym Letters and numbers are pronounced individually.

address

currency Supports currency as commonly specified in the country corresponding to the target language.

For example, dollars and cents for US English, Euros for Parisian French, and pesos and centavos for Mexican Spanish.

date All formats are supported; if the year is written using only two digits, numbers less than 50 are assumed to occur in the 2000s, greater than 50 in the 1900s.

duration All formats are supported; example: “duration:hms” is read out as“<h> hour(s), <m> minute(s), and <s> seconds” (assuming xml:lang was specified as “en-US”).

measure A variety of units (e.g., km, hr, dB, lb, MHz) is supported; the units may appear immediately next to a number (e.g., 1cm) or be separated by a space (e.g., 15 ms); for some units the singular/plural distinction may not always be made correctly.

name

net Both the “uri” and “email” formats are supported; note, however, that e-mail addresses are difficult to pronounce the way a user expects.

number All three formats, “digits”, “ordinal”, and “cardinal”, are supported (if relevant in the target language); Roman numerals are not supported.

telephone Supports telephone numbers as commonly specified in the country corresponding to the target language. For “en-US” this includes: (800) 123-4567, 617-123-4567, and 212 123-4567.

time All formats are supported; the hour should be less than 24, minutes and seconds less than 60; AM/PM is read out only if explicitly specified.

SpeechWorks Proprietary Fifth Edition, Update 2B–121

Speechify User’s Guide

Fifth Edition, Update 2 SpeechWorks ProprietaryB–122

APPENDIX C

SAPI 5

The SAPI 5 interface for Speechify is compliant with the Microsoft SAPI 5 text-to-speech specification. Although certain SAPI 5 features are not currently supported, those most commonly used by SAPI 5 developers are.

Compliance

The SAPI 5 interface for Speechify:

1. Provides an in-process COM server implementing the following interfaces:

• IspTTSEngine

• IspObjectWithToken

If you use the SAPI IspVoice interface to manipulate a specific voice, SpeechWorks does not support the following methods:

• Skip

In doing so, Speechify fails the following SAPI Compliance Tool tests:

• TTS Compliance Test\ISpTTSEngine\Skip

• TTS Compliance Test\Real Time Rate/Vol Tests\Real Time Rate Change

• TTS Compliance Test\Real Time Rate/Vol Tests\Real Time Volume Change

SpeechWorks Proprietary Fifth Edition, Update 2C–123

Speechify User’s Guide

2. Supports the following SAPI-defined speak flags:

3. Supports the following output formats natively, depending on the voice selected:

By default, Speechify SAPI 5 voices return audio to SAPI in these formats:

• Speechify 8kHz: SPSF_8kHz16BitMono

• Speechify 16kHz: SPSF_16kHz16BitMono

To set an audio format in the table to be Speechify’s native engine format (before instantiating that voice), use the registry to set the Attributes\MimeType subkey of the appropriate voice key to one of Speechify’s MIME types. (The MIME types are documented in “SWIttsSetParameter( )” on page 7-94.) If MimeType is not present or is set to an empty string, Speechify voices use their default native formats.

Thus, you can set a default in the registry (e.g., if you’re using an 8 kHz voice and want µ-law instead of 8 kHz linear PCM), which is equivalent to using SWIttsSetParameter( ) to set tts.audioformat.mimetype for each port. SAPI has no equivalent of SWIttsSetParameter( ); setting parameters is combined with creating an instance.

Note that SAPI 5 can convert to other audio formats not listed in this table.

Speak flags Action

SPF_DEFAULT This is the default speak flag. The engine renders text to the output side under normal conditions.

SPF_PURGEBEFORESPEAK The engine can stop rendering when passed an abort request.

SPF_IS_XML The engine correctly interprets and acts upon a number of SAPI XML tags (defined below).

SPF_ASYNC The engine uses SAPI 5 thread management to support the asynchronous synthesis of audio output without blocking the calling application.

Output formats Definition

SPSF_CCITT_uLaw_8kHzMono

Single channel 8 kHz µ-law with an 8-bit sample size

SPSF_CCITT_ALaw_8kHzMono

Single channel 8 kHz A-law with an 8-bit sample size

SPSF_8kHz16BitMono Single channel 8 kHz linear PCM with a 16-bit sample size

SPSF_16kHz16BitMono Single channel 16 kHz linear PCM with a 16-bit sample size

Fifth Edition, Update 2 SpeechWorks ProprietaryC–124

SAPI voice propertiesSpeechify User’s Guide

4. Supports SAPI 5’s User and Application Lexicons.

SAPI 5 has a separate client/application-specific dictionary called the Lexicon. Speechify for SAPI 5 interacts with the SAPI lexicon allowing clients to override the default word pronunciation of the Speechify Server. Speechify ignores the user–supplied part-of-speech field in the Lexicon.

5. Supports the following SAPI XML tags. All other SAPI XML tags are ignored by Speechify:

• <SILENCE>

• <PRON>

• <BOOKMARK>

• <SPELL>

• <RATE>

• <VOLUME>

By ignoring other XML tags, Speechify fails the following tests in SAPI Compliance Tool:

• TTS Compliance Test\TTS XML Markup\Pitch (uses <PITCH> tag)

• Features\Emph (uses <EMPH> tag)

• Features\PartOfSp (uses <PARTOFSP> tag)

6. Synthesizes the following SAPI events:

Bookmark names beginning with “!SWI” are now reserved for internal SAPI processing and cannot be used as names of user–provided SAPI bookmarks.

• SPEI_TTS_BOOKMARK

• SPEI_WORD_BOUNDARY

• SPEI_PHONEME

• SPEI_VISEME (for US English only)

7. Supports the instantiation and simultaneous use of multiple TTS Engine instances within a single client process.

SAPI voice properties

The SAPI 5 API was not explicitly designed to allow for client/server speech synthesis systems such as Speechify. By default, the Speechify installer configures Speechify's SAPI 5 interface to look for the server on the same machine as the client (i.e., localhost) but it is possible to configure the interface to look for a server elsewhere on

SpeechWorks Proprietary Fifth Edition, Update 2C–125

Speechify User’s Guide

the network, even on a non-Windows machine. To do this configuration, the interface provides a properties dialog box accessible via the Speech control panel applet. This dialog box also lets you examine the voice's attributes and turn diagnostic logging on or off for technical support purposes.

To invoke the properties dialog box, use Start >> Settings >> Speech and click the Text To Speech tab. From the Voice Selection list, choose a Speechify voice. (You may see a message about not being able to initialize the voice. Ignore this message; it is innocuous.) Once the Speechify voice is selected, the button labeled Settings… should be enabled. Click this button to open the Speechify SAPI Voice Properties dialog box.

The properties dialog box displays the voice name at the top of the box. The next section displays attributes of the voice including the language, gender, age, and the native audio format of the server. None of these values are editable. Although SAPI can provide an application with almost any audio format it requests, the application should request audio in the voice’s native audio format for the best audio quality.

The next section of the dialog box lets you configure the Speechify server’s address and port number. You can select either Host name and enter a server’s host name or select Host IP and enter a server’s IP address. Below those fields, enter the server's port number. This corresponds to the “--port <number>” option used to start the Speechify server.

The final section of the dialog box is for diagnostic logging. If you experience problems with Speechify’s SAPI 5 interface and require technical support, SpeechWorks may ask you to turn on diagnostic logging within the interface. Unless required for technical support, you should leave logging turned off to avoid unnecessary CPU and disk activity. To turn on diagnostic logging, click the arrows to set the logging level:

❏ 0: logging is turned off❏ 1: log high-level information❏ 2: log verbose information

When logging is turned on, information is logged to the Speechify /bin directory, in a file named Speechify-SAPI5.log.

When you are done modifying the settings in the Voice Properties dialog box, click OK to accept the changes. The changes go into effect the next time an engine instance is created.

Fifth Edition, Update 2 SpeechWorks ProprietaryC–126

APPENDIX D

Frequently Asked Questions

This appendix answers frequently asked questions about using Speechify.

❏ Question types: Why is the output the same, whether I end a sentence with a question mark or a period?

❏ Changing rate or volume: Can the application change the speaking rate or volume of the audio output while Speechify is synthesizing?

❏ Rewinding and fast-forwarding: Can the application move forward or backward in the audio output (e.g. go back 10 seconds)?

❏ Java interface: Does Speechify or Speechify Solo offer a Java interface?

❏ E-mail pre-processor and SAPI 5: Is it possible to use the e-mail pre-processor with SAPI 5?

❏ SSML and SAPI 5: Can I use input text containing SSML with SAPI 5?

❏ Error codes 107 and 108: What are the error codes 107 and 108? (For example: ERROR 108 received in myTTSCallBack.)

❏ Speechify 2.1 and Speechify 2.0 voices: After installing Speechify 2.1 and trying to install a Speechify 2.0 voice, some customers have seen the following error message: “You must have Speechify 2.0 installed to run this voice.”

❏ Connecting to the server: When trying to run the Speechify “dialogGUI” sample application, you may get the following error message box: “ERROR: The SpeechWorks TTS library could not connect to the server.”

❏ Finding voices: When trying to start up a Speechify service, you may get the following message: “The voice that you entered cannot be found. Check the path of the installed voices, Name, Language, and Format.”

SpeechWorks Proprietary Fifth Edition, Update 2D–127

Speechify User’s Guide

❏ Port types: What is the relationship between the SWIttsOpenPort( ) function and the port number used to configure a voice on the Speechify server?

Question types

Why is the output the same, whether I end a sentence with a question mark or a period?

There are many different types of questions, including:

❏ Yes/No questions, e.g. Did you see the film yesterday?❏ Tag questions, e.g. You saw the film yesterday, didn't you?❏ Wh-questions, e.g. Where did you see the film?

Different question types have fundamentally different prosodic patterns. It is a common misconception that all a TTS engine needs to do is generate rising intonation at the end of every question. For certain question types, the intonation produced by Speechify (and many other TTS systems) might be inappropriate. In order to get the most natural speech possible out of Speechify, we have concentrated on generating optimal output for statements and wh-questions (who, how, what, when, where, why, which). If you design your user interactions carefully, it’s possible to have your text consist entirely of statements and wh-questions. For example, “You can choose one of options a, b, or c. Which would you like?”

Changing rate or volume

Can the application change the speaking rate or volume of the audio output while Speechify is synthesizing?

Once it has asked Speechify to synthesize some text, the application cannot change the rate or volume of the output. However, the application can tell Speechify to change to different rates or volumes at different points in the output by embedding rate and/or volume control tags in the input text.

Fifth Edition, Update 2 SpeechWorks ProprietaryD–128

Rewinding and fast-forwardingSpeechify User’s Guide

Rewinding and fast-forwarding

Can the application move forward or backward in the audio output (e.g. go back 10 seconds)?

Speechify and Speechify Solo do not support this directly, but an application could buffer the audio output and provide that functionality.

Java interface

Does Speechify or Speechify Solo offer a Java interface?

Speechify and Speechify Solo currently do not offer a Java interface. A Java developer will need to write the JNI (Java Native Interface) wrapper to access the C API. If you would like SpeechWorks to provide a Java interface, please contact your SpeechWorks sales representative or technical support.

E-mail pre-processor and SAPI 5

Is it possible to use the e-mail pre-processor with SAPI 5?

It is possible to use the e-mail pre-processor and SAPI together. The application must process the e-mail via the e-mail preprocessor first, independently of SAPI, and then pass the resulting text into SAPI.

SSML and SAPI 5

Can I use input text containing SSML with SAPI 5?

SpeechWorks Proprietary Fifth Edition, Update 2D–129

Speechify User’s Guide

It is not possible to use SSML input with the SAPI 5 interface. This is because SAPI 5 uses its own XML mark-up called SAPI XML. It may be possible to use XSLT to translate between the two XML formats.

Error codes 107 and 108

What are the error codes 107 and 108? (For example: ERROR 108 received in myTTSCallBack.)

Error codes 107 and 108 are both related to networking:

Error 107 indicates that the connection between the client and the server existed at one point but was disconnected unexpectedly. There are several likely causes:

❏ The Speechify server stopped, either by an operator shutting it down or by a crash.

❏ The machine that the server was running on was shut down.

❏ The network connection between the client and server was broken, either by unplugging a cable or shutting down a switch.

Error 108 indicates that some network operation between the client and server timed out. There are several common causes:

❏ The Speechify server stopped, either by an operator shutting it down or by a crash.

❏ The server machine is under heavy load and the Speechify server could not respond fast enough to the client.

❏ The Speechify server is not started.

Fifth Edition, Update 2 SpeechWorks ProprietaryD–130

Speechify 2.1 and Speechify 2.0 voicesSpeechify User’s Guide

Speechify 2.1 and Speechify 2.0 voices

After installing Speechify 2.1 and trying to install a Speechify 2.0 voice, some customers have seen the following error message: “You must have Speechify 2.0 installed to run this voice.”

This is a known problem. If this occurs, follow this workaround to avoid the problem:

1. Open the Registry Editor and navigate to HKEY_LOCAL_MACHINE\SOFTWARE\SpeechWorks International\Speechify\2.1.

2. Rename the key 2.1 to 2.0.

3. Install the 2.0 voice package.

4. Rename the key 2.0 back to 2.1.

Connecting to the server

When trying to run the Speechify “dialogGUI” sample application, you may get the following error message box: “ERROR: The SpeechWorks TTS library could not connect to the server.”

Common causes:

❏ The Speechify service has not yet been started. Start the Speechify service and try running the sample again.

❏ You have started the Speechify server but it has not completed initialization so is not ready to accept connections.

❏ You entered an incorrect host-name/port-number pair in the Server Address box. Restart the sample after checking that you have the correct address.

SpeechWorks Proprietary Fifth Edition, Update 2D–131

Speechify User’s Guide

Finding voices

When trying to start up a Speechify service, you may get the following message: “The voice that you entered cannot be found. Check the path of the installed voices, Name, Language, and Format.”

A common cause is that you do not have enough virtual memory configured in your system. Check that the size of your paging file meets the minimum requirements (specified on page 1-2), and also check the release notes for each voice since the requirements may differ.

Port types

What is the relationship between the SWIttsOpenPort( ) function and the port number used to configure a voice on the Speechify server?

A common mistake is to think that each call that the application makes to SWIttsOpenPort( ) must specify a different port number for the server address. This is because the application developer believes that they can only “open” a port once. The cause of this confusion is the name chosen for the function. The TTS “port” handle returned from the SWIttsOpenPort( ) function has nothing to do with the “port” number passed to the function. The handle returned refers to an instance of a Speechify voice. The port number passed to the function and used on the server to configure the voice refers to a different type of port: a networking/sockets port.

When you configure a voice on the server for a certain port number, that number is part of the network address on which the server listens for connections from a client application. That application creates an instance of a voice by passing the server’s address, i.e., the host name and the port number, to SWIttsOpenPort( ). To create multiple TTS ports for that voice, always pass the same host name/port number combination to the function. Even though a single Speechify server listens on only one network address, it can support multiple voice instances. One useful way to think of the problem is to imagine that SWIttsOpenPort( ) is renamed to SWIttsCreateVoice( ) and that it returns a handle to a voice instance.

Fifth Edition, Update 2 SpeechWorks ProprietaryD–132

SpeechWorks Proprietary

Index

Symbols!SWI C-125\! 3-44\![SPR] 3-50\!bm 3-50\!ny0 3-49\!ny1 3-49\!p 3-44\!rdN 3-54\!rdr 3-54\!rpN 3-54\!rpr 3-54\!ts0 3-47\!tsa 3-47\!tsc 3-44, 3-47\!tsr 3-47\!vdN 3-53\!vdr 3-53\!vpN 3-52\!vpr 3-52

Aabbreviation dictionary 2-30, 5-61, 5-64, 5-67ambiguous expressions 3-33annotations

entering SPRs 3-50pause 3-44pronouncing numbers and years 3-49

API function overview 6-69API result codes 6-71application outline 2-23audio buffer underflow 7-104

Bbookmarks

inserting 3-50

Ccallback function 2-24, 6-79calling convention 6-70cardinal numbers 3-34character set

for Japanese 6-97ISO-8859-1 6-70, 6-97preferred 6-70Shift-JIS 6-70supported 6-97US-ASCII 6-97UTF-16 6-97UTF-8 6-97wchar_t 6-97

charset

Japanese 6-73, 6-81, 6-89Western languages 6-73, 6-81, 6-89

client SDK on NThardware requirements 1-2software requirements 1-2

configuring server 1-17configuring shared memory 1-11configuring Speechify 1-1currencies 3-35

Ddates 3-35dictionaries

abbreviation 5-61file-based 5-67language-specific 5-67main 5-60root 5-62voice-specific 5-67

dictionaryabbreviation 5-67main 5-67root 5-67

dictionary processing of abbreviationsannotations 3-50

digitsfloating point 3-34

Eend of sentence 3-45, 5-62

Ffeatures 2-22file-based dictionaries 5-67floating point digits 3-34fractions 3-34

Gguidelines

implementation 2-31

Iimplementation guidelines 2-31International Radio Alphabet 3-47

JJapanese, supported charsets 6-97

Kkey, dictionary 5-60

Llanguage-specific dictionaries 5-67latency 7-103

Fifth Edition, Update 2 133

Speechify User’s Guide

Mmain dictionary 2-30, 5-60, 5-64, 5-67max shared memory segment 1-11monetary expressions 3-35

Nnegative numbers 3-34numbers

cardinal 3-34negative 3-34ordinal 3-34

numbers and yearsannotations 3-49

Ooperations aids 2-31order of API functions 2-23ordinal numbers 3-34

Ppaging file 1-2, D-132pauses

inserting 3-44performance 7-101period, trailing abbreviation dictionary) 5-61phone numbers 3-35

Rreal-time factor 7-103result codes 6-71root dictionary 2-30, 5-62, 5-64, 5-67

Ssample time line 2-26SAPI 5 C-123SHMMAX 1-11sizing 7-101social security numbers 3-35Speechify

configuring 1-1features 2-22installing 1-1

spellout modes 3-47SPR tag 3-50structure

SWIttsAudioPacket 2-25, 6-76SWIttsBookMark 6-78SWIttsDictionaryEntry 6-74, 6-82, 6-83, 6-90SWIttsMessagePacket 6-77SWIttsPhonemeMark 6-78SWIttsWordMark 6-78

support services xiiSWItts_ALREADY_EXECUTING_API 6-71SWitts_cbAudio 6-75SWItts_cbBookmark 6-75

SWItts_cbDiagnostic 6-75SWItts_cbEnd 6-75SWItts_cbError 6-76SWItts_cbLogError 6-76SWItts_cbPhonememark 6-76SWItts_cbPing 6-76SWItts_cbPortClosed 6-76SWItts_cbStart 6-76SWItts_cbStatus 2-24, 6-75SWItts_cbStopped 6-76SWItts_cbWordmark 6-76SWItts_CONNECT_ERROR 6-71SWItts_ENGINE_ERROR 6-71SWItts_ERROR_PORT_ALREADY_

STOPPING 6-71SWItts_ERROR_STOP_NOT_SPEAKING 6-71SWItts_FATAL_EXCEPTION 6-71SWItts_HOST_NOT_FOUND 6-71SWItts_INVALID_PARAMETER 6-71SWItts_INVALID_PORT 6-71SWItts_MUST_BE_IDLE 6-71SWItts_NO_ENGINE 6-71SWItts_NO_MEMORY 6-71SWItts_NO_MUTEX 6-71SWItts_NO_THREAD 6-71SWItts_NOT_EXECUTING_API 6-71SWItts_PORT_ALREADY_SHUT_DOWN

6-71SWItts_PORT_ALREADY_SHUTTING_

DOWN 6-71SWItts_PORT_SHUTTING_DOWN 6-71SWItts_PROTOCOL_ERROR 6-71SWItts_READ_ONLY 6-71SWItts_SERVER_ERROR 6-71SWItts_SOCKET_ERROR 6-71SWItts_SSML_PARSE_ERROR 6-71SWItts_SUCCESS 6-71SWItts_UNINITIALIZED 6-71SWItts_UNKNOWN_CHARSET 6-72SWItts_UPDATE_DICT_PARTIAL_SUCCESS

6-72SWItts_WINSOCK_FAILED 6-72SWIttsAddDictionaryEntry() 2-31, 6-73SWIttsAudioPacket structure 2-25, 6-76SWIttsBookMark structure 6-78SWIttsCallback() 6-73, 6-75SWIttsClosePort() 6-80SWIttsDeleteDictionaryEntry() 2-31, 6-81SWIttsDictionaryEntry structure 6-74, 6-82, 6-83,

6-90SWIttsGetDictionaryKeys() 2-31, 6-83SWIttsGetParameter() 2-30, 6-86

Fifth Edition, Update 2 SpeechWorks Proprietary134

Speechify User’s Guide

SWIttsInit() 6-86, 6-88SWITTSLOGDIAG A-111SWITTSLOGTOFILE A-111SWIttsLookupDictionaryEntry() 2-31, 6-89SWITTSMAXLOGSIZE A-111SWIttsMessagePacket structure 6-77SWIttsOpenPort() 6-89, 6-91

stack size 2-32SWIttsPhonemeMark structure 6-78SWIttsPing() 6-92SWIttsResetDictionary() 6-93SWIttsResult 6-71SWIttsSetParameter() 2-30, 6-94SWIttsSpeak() 2-31, 6-93, 6-96SWIttsStop() 6-98SWIttsTerm() 6-99SWIttsWordMark structure 6-78syllable boundaries 4-56syllable stress 4-56Symbolic Phonetic Representation 3-50

Ttime line

sample 2-26times 3-35translation value, dictionary 5-60tts.audio.rate 6-86, 6-94tts.audio.volume 6-86, 6-94tts.audioformat.encoding 6-86tts.audioformat.mimetype 6-86, 6-94tts.audioformat.samplerate 6-87tts.audioformat.width 6-87tts.client.version 6-87tts.marks.phoneme 6-87, 6-95tts.marks.word 6-87, 6-95tts.network.packetsize 6-87, 6-95tts.reset 6-87, 6-95tts.voice.gender 6-87tts.voice.language 6-87tts.voice.name 6-87

Vvoice-specific dictionaries 5-67

Wwhite space, in Japanese text 6-97

SpeechWorks Proprietary

Fifth Edition, Update 2 135