Problem Report Bulletins

Last reviewed: 10/31/2011

Article ID: P101110

PRB: Enumerating SAPI 4 TTS engines may generate an exception or hang

The information in this article applies to:

  • GrammarKit 4
  • LexiconKit 4
  • ProfileKit 4
  • SpeechKit 7
  • VoiceMarkupKit 4

Symptoms

The ChantTTS class GetResourceCount method triggers TTS engine enumeration where SAPI 4 may generate an exception or hang.

Cause

SAPI 4 may be installed by programs such as Dragon Naturally Speaking. If some SAPI 4 libraries are missing, corrupted, the speech engine (i.e., recognizer or synthesizer) has errors, or there are corrupt registry entries, the SAPI 4 enumerator may throw an exception which the application may receive or on which Windows may hang.

Status

Fixed in GrammarKit build 4.0.4.0, LexiconKit build 4.0.4.0, ProfileKit build 4.0.4.0, SpeechKit build 7.0.4.0, and VoiceMarkupKit build 4.0.4.0. Other than catching the exception if returned to the application, there is nothing a SAPI 4 application can do.

To avoid the problem, the ChantGM, ChantLM, ChantPM, ChantSR, ChantTTS, and ChantVM engine API enumerators have a new optimization that allows applications to avoid enumerating SAPI 4 recognizers and synthesizers.

If you do not set any CNPEngineAPI values, the enumerators work as they always have looking on the system for all possible speech APIs.

The new enumerator enhancement allows you to set the CNPEngineAPI values for the specific speech APIs your application wants to enumerate.

After you instantiate your Chant class object, set as many CNPEngineAPI values as desired before getting the engine count and enumerating the engines.

// Enumerate Cepstral voices
NChantTTS1.SetNumberProperty(ChantNumberProperty.CNPEngineAPI, (int)ChantEngineAPI.CESWIFTTTS);
// Enumerate Microsoft SAPI 5 voices
NChantTTS1.SetNumberProperty(ChantNumberProperty.CNPEngineAPI, (int)ChantEngineAPI.CESAPI5TTS);
// Enumerate Nuance Vocalizer voices
NChantTTS1.SetNumberProperty(ChantNumberProperty.CNPEngineAPI, (int)ChantEngineAPI.CEVAUTO);
// Set the path to the Vocalizer install path
NChantTTS1.SetStringProperty(ChantStringProperty.CSPEnginePath, "c:\\Program Files\\Nuance\\Vocalizer for Automotive v5\\");      
// Set for each path to the language files
NChantTTS1.SetStringProperty(ChantStingProperty.CSPLanguagePath, "c:\\Program Files\\Nuance\\Vocalizer for Automotive v5\\languages"); 

int numberOfEngines = NChantTTS1.GetResourceCount(ChantSpeechResource.CSREngine);
for (i = 0; i < numberOfEngines; i++)
{
    NChantTTSEngine nChantTTSEngine = NChantTTS1.GetChantTTSEngine(i);
    // Access speech synthesis engine properties
    String stringVal = nChantTTSEngine.Engine;
}

Component Formats Impacted

All component formats.