How do I enumerate native speech API engines only?

Last reviewed: 9/10/2008

HOW Article ID: H090818

The information in this article applies to:

  • SpeechKit 6

Summary

Some recognizers and synthesizers support Microsoft SAPI 4 and/or Microsoft SAPI 5 speech APIs in addition to their own native speech API. When ChantSREngine or ChantTTSEngine objects are enumerated, these recognizers and synthesizers may enumerate as SAPI engines and native API engines.

With SpeechKit 6, you can force the engine enumerator to return the engine once as a native engine if available.

More Information

The CNPNativeAPI number property forces the engine enumeration of a recognizer or voice via native API if available and if not, as a SAPI recognizer or voice if supported.

In SpeechKit 6, set the CNPNativeAPI to 1 to enumerate engines via their native API as illustrated in the following example:


// Turn on native engine enumeration for recognizers
ChantSR.SetNumberProperty(CNPNativeAPI, 1)
// Get the number of recognizers
numberOfEngines = ChantSR.GetResourceCount(CSREngine)
for (i = 0; i < numberOfEngines; i++)
{
    ChantSREngine aChantSREngine = ChantSR.GetChantSREngine(i)
    // Access speech recognition engine properties
    MessageBox(aChantSREngine.Engine,"Found Recognizer")
}

// Turn on native engine enumeration for synthesizers
ChantTTS.SetNumberProperty(CNPNativeAPI, 1)
// Get the number of synthesizers (voices)
numberOfEngines = ChantTTS.GetResourceCount(CSREngine)
for (i = 0; i < numberOfEngines; i++)
{
    ChantTTSEngine aChantTTSEngine = ChantTTS.GetChantTTSEngine(i)
    // Access speech synthesis engine properties
    MessageBox(aChantTTSEngine.Engine,"Found Synthesizer")
}