Text to speech component
Reply #81 – 2003-08-29 19:52:43
from help for WinDictEdit The Dictionary Editor can be used to change the pronunciation of words or allow you to easily add a new abbreviation. We’ll describe two different examples to explain how to use the Dictionary Editor to do both. Defining Replacements In this example, we’ll demonstrate how to add a new transcription for the word “WRT” which we want to synthesize as “with respect to”. This same technique works for other words as well such as “NE” for “north east”, “MPH” for “miles per hour”, etc. First, start the Dictionary Editor and either open an existing dictionary file or create a new file. Next, create a new word from the Edit menu. This will pop up a dialog as shown below. The top portion of the dialog box describes the word that is being added or changed in the dictionary. The bottom portion of the dialog can be used to experiment with different pronunciations. The red “mouth/lips” button allows you to hear the how the word or list of phonemes will be pronounced. The ‘T’ button displays the phonemes for the word in the “word” or “sounds like” text box. Adding replacements is very simple: 1. Type in the word to be expanded in the “word” text box in the top section of the dialog, “WRT” in our example. 2.Type in the replacement text in the bottom “Sounds Like” text box in the bottom section of the dialog, e.g. “with respect to”. 3. C lick the “T” button next to the “Sounds Like” text box to retrieve the list of phonemes for the text in the “Sounds Like” text box. 4. Copy the phonemes from the “Phonemes” text box in the “Sounds Like” section at the bottom of the dialog and paste the phonemes into the phonemes text box in the “Edit Entry” section at the top of the dialog. 5. Click the red “mouth/lips” button next to the phonemes in the top part of the dialog to hear how the word “WRT” will be pronounced. 6. Click the “save” button and you’ve defined a new pronunciation. Next step is to tell the TTS engine about your dictionary file, but first we’ll explore changing the pronunciation of a word. Changing the default pronunciation of a word In this example, we’ll change the pronuncation of the name “Proulx” from the default which sounds like “prowlx” to sound like “Pru” which rhymes with “Sue”. This time, we’re going to use the WinDictEdit tool to replace a few of the phonemes in the default pronunication of the word. Here’s the procedure: 1. Type in the word to be expanded in the “word” text box in the top section of the dialog, “Proulx” in our example 2. Click the red “mouth/lips” button next to the word in the top part of the dialog to hear how the word “Proulx” will be pronounced. 3. Click the “T” button next to the word “Proulx” in the top part of the dialog to see the phonemes for the word “Proulx” which are “p r aw l k s 1”. Note that the first part of the pronunciation is correct so we can use the “p r” phonemes but need to replace the “aw l k s 1” with something that rhymes with “Sue”. 4. Next, we need to identify the phonemes that make up the “ue” in “Sue” so type “Sue” in the “Sounds like” text box at the bottom of the dialog. 5. Click the “T” button next to the “Sounds Like” text box to retrieve the list of phonemes “s uw 1” for the text “Sue” in the “Sounds Like” text box. The “uw” phoneme provides the “ue” sound in “Sue”. You can verify this by deleting the ‘s’ phoneme from the phonemes text box in the “Sounds Like” section and then click the “lips/mouth” button to hear the “uw” phoneme. 6. We need to replace the “aw l k s” phonemes in the “Phonemes” text box in the “Word” pane of the dialog with the “uw” from the “Sounds Like” pane so copy that phoneme up to the top, making the list of phonemes in the word pane “p r uw 1”. 7. Click the red “mouth/lips” button next to the phonemes in the top part of the dialog to hear how the word “Proulx” will be pronounced. Sure enough, “Proulx” now rhymes with “Sue”. 8. Click the “save” button and you’ve defined a new pronunciation for the name “Proulx”. Adding Custom Pronunciations to Your Application Once you have defined your custom pronunciations, you’ll need to tell your application about them. Microsoft SAPI 5.1 allows for the creation of user and application dictionaries. The intent of this feature is that the application dictionary includes pronunciations that apply to all users while the user dictionary is unique to an individual user but you may use them any way you wish. The AT&T Labs Natural Voices TTS SDK allows an application to define any number of custom dictionaries, and to control the order in which they are searched. When searching for a transcription, the TTS Server first searches custom dictionaries, in the order specified by the client application, and then its own internal dictionaries to find some pronunciation for the word. The search stops as soon as a pronunciation is found. You’ll find code samples for adding custom dictionaries to your application in Chapter 5 of the System Developer's Guide which describes the SDK. Alternatively, you can update the file which the engine uses during engine initialization. You’ll find tts.cfg in the data subdirectory, e.g. C:\program files\attnaturalvoices\tts1.3\desktop\data\tts.cfg The tts.cfg file describes all of the voices and languages that are available to the TTS engine. Browse through the file to find the “language” section for the language for which you’re defining the dictionary, e.g. Language en_us LanguageLocale en_us LanguageDictionary en_us\en_us.dict att_darpabet_english LanguageTextAnalysis en_us\fe_en_us.dll is the section for the US English language. To use a dictionary file en_us\mydict.dict, add a new line to tts.cfg as follows:Language en_us LanguageLocale en_us LanguageDictionary en_us\en_us.dict att_darpabet_english LanguageTextAnalysis en_us\fe_en_us.dll UserDictionary es_us\mydict.dict The TTS engine will use the transcriptions in mydict.dict.