Author Topic: Detecting when a valid command has been triggered?  (Read 1582 times)

0 Members and 1 Guest are viewing this topic.

Bobu

  • Jr. Member
  • **
  • Posts: 2
  • Karma: 0
    • View Profile
Detecting when a valid command has been triggered?
« 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! 



Kalle

  • $upporter
  • Hero Member
  • *****
  • Posts: 2320
  • Karma: 47
    • View Profile
Re: Detecting when a valid command has been triggered?
« Reply #1 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:


Code: [Select]
<?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.
« Last Edit: February 14, 2015, 09:35:50 AM by nime5ter »
***********  get excited and make things  **********

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7714
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Detecting when a valid command has been triggered?
« Reply #2 on: February 14, 2015, 08:29:58 AM »

nime5ter

  • Administrator
  • Hero Member
  • *****
  • Posts: 1999
  • Karma: 61
    • View Profile
    • Getting Started with VoxCommando
Re: Detecting when a valid command has been triggered?
« Reply #3 on: February 14, 2015, 09:52:00 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.

Code: [Select]
<?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>
TIPS: POST VC VERSION #. Explain what you want VC to do. Say what you've tried & what happened, or post a video demo. Attach VC log. Link to instructions followed.  Post your command (xml)

Bobu

  • Jr. Member
  • **
  • Posts: 2
  • Karma: 0
    • View Profile
Re: Detecting when a valid command has been triggered?
« Reply #4 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!