Rss Categories


Reference Number: AA-00675 Views: 8841 0 Rating/ Voters

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 LV_SRE_Decode(HPORT hport, int VoiceChannel, int GrammarSet, unsigned int flags)



The port's handle.


The audio channel holding the decode audio.


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. Concept phrase grammars were deprecated since 10.0

flags (bitwise OR flags to set desired options)

LV_DECODE_BLOCK - Decode will not return until it has finished.


Return Values

Positive Number

A positive number will be returned if you have set LV_DECODE_BLOCK. This number indicates how many interpretations the ASR was able to decode.


LV_SUCCESS will be returned if the LV_DECODE_BLOCK flag was not set. This return indicates that the port was able to successfully communicate with the server.


Indicates that the language specified in the grammar is either invalid or is not available on the ASR server.


Indicates that more than one language was specified in the active grammar set.


Indicates that you do not have the right license type for the decode. Either a Lite license was used when the vocabulary size of the active grammar set exceeded 500, or an SLM decode operation was attempted with a non-SLM license.


Sound sample was < 1/8 of a second.


This grammar could not be activated, because the port was shutting down.


Indicates an error in using an active grammar for the decode operation (eg: there were no words in the compiled grammar).


Indicates License used is not valid.


The grammar could not be loaded due to a license not being available.


The input hport is not a valid one.


The input VoiceChannel is not a valid one.


Indicates that the license acquired for the decode operation does not permit the use of the current version of the ASR server.


Indicates that no ASR servers were available to perform the decode.


Indicates that the preceeding decode operation timed out.


An exception occurred while processing the request.

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, LV_SRE_GetLastDecodeError should be called to check for additional grammar / language issues which may have occurred during the recognition process.


If LV_DECODE_BLOCK is set, LV_SRE_Decode will not return until it has finished processing the data.

If LV_DECODE_BLOCK is not set, LV_SRE_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 LV_SRE_WaitForEngineToIdle. If any function which requests the results of the decode is called before the result is ready, the function itself will call LV_SRE_WaitForEngineToIdle with an infinite timeout.

On an error, call LV_SRE_ReturnErrorString with the negative result from LV_SRE_Decode or LV_SRE_GetLastDecodeError to get a description of the error.

Of the error codes listed above, LV_INVALID_HPORT and LV_INVALID_SOUND_CHANNEL are returned due to an error in the inputs to the function.

See Also