Processes the voice channel audio data against the active grammar. This is the manual process of telling the Engine to perform a recognition. The two most common reasons to use this function are to perform off-line decodes on existing audio or to programatically control whether to decode after a streaming process.
int Decode(int VoiceChannel, int grammarset, unsigned int flags = 0);
Zero (0) or greater indicates success.
A negative result indicates a specific error:
-1 LV_FAILURE - Problem with the sound channel.
-4 LV_BAD_SOUND_DATA - Sound sample was < 1/8 of a second.
-6 LV_TIME_OUT - The decode did not return in time limit specified.
-32 LV_GLOBAL_GRAMMAR_TRANSACTION_ERROR
-33 LV_ACTIVE_GRAMMAR_VOCAB_SIZE_EXCEEDS_LIMIT - you have exceeded the vocabulary size allowed by the active license
-34 LV_INVALID_LICENSE
LV_ACTIVE_GRAMMAR_LANGUAGE_CONFLICT - The active grammars specify different languages
LV_ACTIVE_GRAMMAR_INVALID_LANGUAGE - The Engine does not recognize the specified language.
LV_BAD_HPORT - The Hport specified was invalid.
Note that if the number of interpretations against a grammar grows so high that continuing to build parse trees will cause memory issues, the Engine will return no interpretations but the client will not return an error (this is usually caused by improperly designed grammars that feature some sort of recursion). If the Engine returns no interpretations, please check the decode server log to see if the server recorded an error.
When not blocking the function, GetLastDecodeError should be called to check for additional grammar/language issues which may have occurred during the recognition process. LV_ACTIVE_GRAMMAR_VOCAB_SIZE_EXCEEDS_LIMIT, LV_ACTIVE_GRAMMAR_LANGUAGE_CONFLICT, LV_ACTIVE_GRAMMAR_INVALID_LANGUAGE are all possible errors reported by this function.
VoiceChannel
The voice channel to process.
GrammarSet
The grammar to use for the decode. When using SRGS grammars this value should be set to LV_ACTIVE_GRAMMAR_SET. This tells the decoder to use every SRGS grammar which has been loaded and activated. Other values indicate the Engine should use a concept/phrase grammar set.
Note: Rather than using concept/phrase grammars, LumenVox encourages the use of SRGS grammars. SRGS grammars provide a standards-based method of creating grammars that is more robust and easier to troubleshoot than concept/phrase grammars. See our SRGS tutorial for more information on working with SRGS grammars.
Flags (bitwise OR flags to set desired options)
LV_DECODE_BLOCK - Decode will not return until it has finished.
LV_DECODE_SEMANTIC_INTERPRETATION - This tells the Engine to expect SISR in the tags of the SRGS grammar. Without this tag the engine will ignore what is contained in the tag elements
If LV_DECODE_BLOCK is set, Decode will not return until it has finished processing the data.
If LV_DECODE_BLOCK is not set, Decode returns immediately (but continues processing the data on a separate thread); the client application can continue its own work. Calling other LVSpeechPort methods may block until the Decode is finished. Once the client application is ready to check for results, call WaitForEngineToIdle. If any function which requests the results of the decode is called before the result is ready, the function itself will call WaitForEngineToIdle with an infinite timeout.
On an error, call ReturnErrorString with the negative result from Decode to get a description of the error.
Complete Help Topic List | Speech Engine Product Information