VoxCommando Forum

Help and Support (Using VoxCommando) => VoxCommando Basics and Core Features => Topic started by: Bobu on February 14, 2015, 06:49:24 AM

Title: Detecting when a valid command has been triggered?
Post by: Bobu on February 14, 2015, 06:49:24 AM
Hello,

I'm pretty new to Vox having only recently discovered it and am enjoying it thoroughly.

Is there a vox event I can use to determine if a voice command was successful or unsuccessful?

For instance in the following situation:
- If I say "play movie inception" and the confidence comes back at 90% for a command which triggers it, an event of VC.Success is triggered
- If I say "play inception" and the confidence comes back at 55% for the same command which isn't high enough to trigger it, an even of VC.Fail is triggered (or no events are raised)

My plan is to ake a little LED system to detect when an event was successful or not (without having to add OSD to each command or see the VoxCommando window) but couldn't figure out how you can tell when an event was successful or not.

I use the command VC.loaded to minimise the VoxCommando window as soon as it loads, is there something in that same "VC." group I can use?

Hope that all made sense.  Thanks in advance! 


Title: Re: Detecting when a valid command has been triggered?
Post by: Kalle on February 14, 2015, 07:16:44 AM
Hi Bobu and welcome to the VC-Forum.


There is already an event for "confidence too low" available.


copy and paste the command into your existing command tree to see the example:


<?xml version="1.0" encoding="utf-16"?>
<!--VoxCommando 2.1.3.8-->
<command id="403" name="confidence to low" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
  <action>
    <cmdType>TTS.Speak</cmdType>
    <params>
      <param>I did not understand you, please repeat your command.</param>
    </params>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <event>VC.Reco.TooLow</event>
</command>


In this way you get info when the confidence is too low.
Title: Re: Detecting when a valid command has been triggered?
Post by: jitterjames on February 14, 2015, 08:29:58 AM
If that is not enough you can use this

http://voxcommando.com/forum/index.php?topic=1689.msg14689#msg14689
Title: Re: Detecting when a valid command has been triggered?
Post by: nime5ter on February 14, 2015, 09:52:00 AM
Quote from: Bobu on February 14, 2015, 06:49:24 AM
...(without having to add OSD to each command or see the VoxCommando window)

Jitterjames's Python script may be most useful for your LED scenario, but note also:

1. It isn't necessary to manually add an OSD to each command, as there is already a standard option to show an OSD message automatically when a command is recognized in VC Options.

2. It's also possible to play a sound when a command is recognized. Again, see Options.

http://voxcommando.com/mediawiki/index.php?title=Options

3. ... If the VC.RecoTooLow event that Kalle mentions above is of interest to you, note that it actually includes 2 payloads that may be useful: {1} Name of command understood (but at too low a confidence value), and {2} the Confidence value. You can always roll over events when they appear in the history panel to see if they contain payloads.

<?xml version="1.0" encoding="utf-16"?>
<!--VoxCommando 2.1.3.7-->
<command id="403" name="Say what?" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="VC.Reco.TooLow always carries 2 payloads that you can optionally make use of.">
  <action>
    <cmdType>TTS.Speak</cmdType>
    <params>
      <param>Confidence too low.</param>
    </params>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>OSD.ShowText</cmdType>
    <params>
      <param>Command heard: "{1}"</param>
    </params>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>OSD.AddText</cmdType>
    <params>
      <param>But the confidence was only: {2}</param>
    </params>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <event>VC.Reco.TooLow</event>
</command>
Title: Re: Detecting when a valid command has been triggered?
Post by: Bobu on February 15, 2015, 08:54:22 AM
Thanks a lot everyone.  When I next get a moment I'll play around with this but it looks like this may be just what I need!