Browse
 
Tools
Rss Categories

Using the SimpleASRClient

Reference Number: AA-01487 Views: 17013 0 Rating/ Voters

LumenVox provides a very useful example application called the SimpleASRClient to get you quickly started using the ASR resource and to act as a sanity check that everything is working as expected after the installation.

Version 10.5
In versions prior to 10.5, it was known as the SimpleClient or SimpleSREClient. The source code for the example is also provided serving as a teaching aid.

The application is installed with the LumenVox Engine Installer (Windows)in the installed directory (by default C:\Program Files\LumenVox\Engine\ ) and with the LumenVoxClient RPM(Linux) in /usr/bin (and is thus in the path).

For Windows the source code is in the installed directory\Examples\ and for Linux the source code is in /usr/share/doc/lumenvox/client/examples/. The source code demonstrates how to use the LumenVox C and C++ API.

The SimpleASRClient will perform decodes against the LumenVox ASR with an audio and grammar file. You can provide your own or you can use default ones supplied by LumenVox. The supplied audio and grammar provided are also in the installed directory (Windows) or /usr/share/lumenvox/client/data (Linux) and they are 8587070707.pcm and ABNFDigits.gram.

The usage for SimpleASRClient is: SimpleASRClient  <grammarlabel> <grammar> <audio format> <audio file> [<ASR IP>]

  • <grammar label> is a name you assign to the loaded grammar to make it easier to call upon that grammar during the activate grammar sequence of the application.
  • <grammar> is the location (either a path on disk or a fully qualified URI) to the grammar you wish to be loaded.
  • <audio format> indicates in which format the audio you are providing exists.
    Acceptable formats are 0 for Unknown Format, 1for ULAW 8 kHz, 2 for PCM 8 kHz, 3 for PCM 16 kHz, 4 for ALAW 8 kHz.
    (The audio format for the supplied audio sample is PCM 8 kHz so use number 2 for the audio format parameter.)
  • optionally, <ASR IP> is the IP address of the LumenVox ASR server. This can be used to talk to a remote ASR.

Note: If no path is specified for either the grammar or the audio file, the Linux client will first look in the local directory and then in /usr/share/lumenvox/client/data. The Windows client only looks in the local folder.

Sample use on Windows: C:\Program Files\Lumenvox\Engine>SimpleASRClient.exe grammar_label ABNFDigits.gram 2 8587070707.pcm
Sample use on Linux: # SimpleASRClient grammar_label ABNFDigits.gram 2 8587070707.pcm

The example follows the same pattern that any application would use in order to perform a speech recognition: 

  1. It reads the audio file into a buffer
  2. It creates an ASR client
  3. It loads the grammar into the client
  4. It activates the grammar
  5. It loads the client voice channel with the audio from the buffer
  6. It calls the decode process
  7. It checks  the number of results on the client 
  8. It prints out the results

Sample output (Windows):

C:\ProgramFiles\Lumenvox\Engine>SimpleASRClient.exe grammar_label ABNFDigits.gram 2 8587070707.pcm
Loaded Grammar!
Loaded Audio!
Decode returned!
Alternative 1:
 Interpretation 1 of 1
   Grammar Label        :grammar_label
   Input Sentence       : EIGHT FIVE EIGHT SEVEN O SEVEN O SEVEN O SEVEN
   Interpretation String: 8587070707
   Interpretation Score : 912

Sample output (Linux):

# SimpleASRClient grammar_label ABNFDigits.gram 2 8587070707.pcm
Loaded Grammar!
Loaded Audio!
Decode returned!
Alternative 1:
 Interpretation 1 of 1
   Grammar Label        :grammar_label
   Input Sentence       : EIGHT FIVEEIGHT SEVEN O SEVEN O SEVEN O SEVEN
   Interpretation String: 8587070707
   Interpretation Score : 912