Rss Categories

Intro to LVSpeechPort Class

Reference Number: AA-00742 Views: 2639 0 Rating/ Voters

An LVSpeechPort Object represents one Speech Recognition Port and processes its sound data into text; all port instances can process their data in parallel.  If the client application is multi-threaded, every thread that needs to process audio data should have its own LVSpeechPort.

Each port has multiple voice channels and grammar sets.

Each voice channel holds raw audio data.  Before processing any data, the client application must call LoadVoiceChannel to load the channel.  The channel keeps its own copy of this sound data, so the client application can free its copy after the call to LoadVoiceChannel.  The voice channel will store the data until the client application loads new data into the channel.  This allows the client application to decode the same sound data against different grammars without reloading the data.

The Decode method processes a voice channel against a grammar set, returning the concepts from the grammar set recognized in the channel's audio data.  Multiple voice channels are provided as a convenience, but only one voice channel can decode concurrently per port.

Use <LVSpeechPort.h>


LVSpeechPort Constructs an LVSpeechPort object.

~LVSpeechPort Closes the speech port object and releases its resources.

Startup Initializes the client application.

Shutdown Gracefully shuts down the threads related to the client application and performs house keeping such as flushing logs.

Port Management Functions

CreateClient Opens the speech port and initializes the Speech Engine.

OpenPort Deprecated - see CreateClient

DestroyClient Closes the port, and releases its resources.

ClosePort Deprecated - see DestroyClient

Decode Processes the voice channel audio data against the active grammar.

InterpretText Returns the evaluated semantic interpretation of the specified text without performing an actual decode

DTMFDecode Returns the evaluated semantic interpretation of the specified DTMF digit string without performing an actual decode

GetVoiceChannelData - Deprecated.

LoadVoiceChannel Loads the audio data into the specified voice channel prior to a call to Decode (which decodes the audio data).

RegisterAppLogMsg Registers an application level log message callback.

ReturnErrorString Returns a description of an error code.

GetLastDecodeError Provides the last decode error on a specific voice channel.

SetPropertyEx Sets various properties on various scopes.

GetStringPropertyEx Gets various properties of string type for a specific port or the client properties used in initializing a new port.

GetIntPropertyEx Gets various properties of integer type for a specific port or the client properties used in initializing a new port.

GetFloatPropertyEx Gets various properties of float type for a specific port or the client properties used in initializing a new port.

WaitForEngineToIdle Blocks the client application until the port is idle (not decoding).

WaitForDecode Blocks the client application until the decode is finished.

SetCustomCallGuid Sets the identifier string used in the current call log file.

GetAvailableLicensesCount Provides the sum of the number of licenses currently available on all connected license servers.

SetClientPropertyEx Sets various properties on client process level. (static)

Advanced Port Management Functions:

SetClientPropertyExPermanent Sets configuration properties for the client application and marks the properties' changes as permanent 

CommitClientPropertySettings Writes out changes to the configuration file on disk after LV_SRE_SetClientPropertiesExPermanent has been called.

IsServerAvailable Check if any of the assigned ASR servers (either set in client_property.conf or as set for PROP_EX_SRE_SERVERS) are reachable.

AddEvent Adds specified events to call log files

AddEventEx Adds specified events to call log files

AddFieldToRequest Adds a custom string to a named field in the call log file.

ClearAllFieldsToRequest Clears all custom fields added to the request via AddFieldToRequest.

GetAvailableLanguageCount Returns the number languages available on the ASR server.

GetAvailableLanguageIndex Provides the language identifier string of an available language on the ASR server.

GetCallGuid Returns the string identifier assigned to the current call log file.

GetLogFileName Provides the call log filename where events related to the last decode on the specified voice channel are stored.

GetPhoneticPronunciation Returns the ASR Engine's phonetic pronunciation for a list of words as a list of raw phonemes.

GetPhoneticPronunciationCount Returns the number of different pronunciations the ASR Engine has for a given list of space separated words in a specified language.

Streaming Functions

StreamStart Sets up a new stream.

StreamStartListening Allows streaming before all stream parameters are set.

StreamSendData Send data buffer of sound data to stream.

StreamGetStatus Returns status of stream.

StreamGetLength Returns length of sound data in stream buffer.

StreamSetStateChangeCallBack Set up a call back to receive state change notification of a stream.

StreamStop Stops stream and loads sound channel with streamed data.

StreamCancel Stops stream, sound data is discarded.

StreamSetParameter Sets a new value for a stream property.

StreamGetParameter Gets the current value of a stream property.

StreamSetParameterToDefault Sets a stream property to its default value.

SRGS Grammar Functions

LoadGrammar Loads an SRGS grammar into the speech port

LoadGrammarFromBuffer Loads an SRGS grammar specified as a string buffer into the speech port

LoadGrammarFromObject Loads an SRGS grammar from an LVGrammar object into the speech port

LoadGrammarWithParameters Loads an SRGS grammar from a specified URI with an optional list of MRCP or HTTP-style headers

LoadGlobalGrammar   Deprecated - use LoadGrammar instead.

LoadGlobalGrammarFromBuffer   Deprecated - use LoadGrammarFromBuffer instead.

LoadGlobalGrammarFromObject   Deprecated - use LoadGrammarFromObject instead.

RegisterGrammarForPendingStream Registers an SRGS grammar for use with a stream before it has been loaded with LoadGrammar

UnloadGrammar Unloads a grammar from the speech port.

UnloadGrammars Unloads all grammars from the speech port.

UnloadGlobalGrammar   Deprecated - use UnloadGrammar instead.

IsGrammarLoaded Checks if a grammar has already been compiled and loaded into port.

ActivateGrammar Activates an SRGS grammar for decoding

ActivateGlobalGrammar   Deprecated - use ActivateGrammar instead.

DeactivateGrammar Removes a grammar from the active grammar set.

DeactivateGrammars Clears the active grammar set.

ReturnGrammarErrorString Returns a string that contains errors related to loading a specified grammar.

GetGrammarVocabSize Returns the vocabulary size of the specified grammar

SRGS Result Functions

GetNumberOfParses Returns the number of parses generated by the decode, according to the active grammars.

GetParseTreeString Returns a string representation of the parse tree.

GetParseTree Returns a Parse Tree result.

GetNumberOfInterpretations Returns the number of interpretations generated by the decode + semantic interpretation process.

GetInterpretationString Returns an XML snippet representation of the interpretation result.

GetInterpretationScore Returns the confidence score for a given interpretation from a prior call to Decode.

GetInterpretationGrammarLabel Provides the label of the grammar that was used by the ASR engine to produce the parse associated with a given interpretation.

GetInterpretation Returns an interpretation result.

Advanced Result Functions:

GetDecodeAcousticModel Provides the name of the acoustic model that was used by the ASR engine during the decode operation.

GetDecodeMS Returns the time (in milliseconds) elapsed on the ASR server processing the decode task.

GetTotalDecodeMS Returns the overall time (in milliseconds) taken for a decode operation, from the time the decode request was sent to the ASR server to the time the results were received and processed.

GetInterpretationData Returns a handle to an object representing the semantic data generated from the semantic interpretation process associated with a given interpretation.

GetInterpretationInputString Returns the input that was fed to the matching grammar to create the specified interpretation index.

GetInterpretationLanguage Returns the language identifier of the grammar that generated the specified interpretation index.

GetInterpretationMode Returns the interaction mode that produced the specified interpretation index.

GetInterpretationPhonemes Returns the ASR engine's phonetic pronunciation for the string that you would get from a call to GetInterpretationInputString with the same parameters.

GetInterpretationTopLevelRule Provides the name of the root rule of the grammar that was used by the ASR engine to produce the parse associated with a given interpretation.

N-Best Result Functions

GetNumberOfNBestAlternatives Returns number of n-best alternatives found by the engine.

SwitchToNBestAlternative Set the n-best alternative that is viewable.


Error Codes Error codes returned by methods.

Sound Formats Sound data format constants.