Author Topic: What am I doing wrong? VC.SetSpeechInput doesn't appear to switch  (Read 7886 times)

0 Members and 1 Guest are viewing this topic.

garryjw

  • $upporter
  • Contributor
  • *****
  • Posts: 59
  • Karma: 5
    • View Profile
Hi I'm trying to get the voice recognition to switch to the Amulet when I pick it up. I've renamed the device in recording devices to Amulet and am using the following...

Code: [Select]
<?xml version="1.0" encoding="utf-16"?>
<!--VoxCommando 1.9.1.9-->
<command id="219" name="Amulet On" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
  <action>
    <cmdType>VC.SetSpeechInput</cmdType>
    <params>
      <param>Amulet</param>
    </params>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>Sound.PartialMute</cmdType>
    <params>
      <param>60</param>
    </params>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>VC.On</cmdType>
    <params />
    <cmdRepeat>1</cmdRepeat>
  </action>
  <event>Amulet.On</event>
</command>

The log shows

Code: [Select]
10/04/2014 23:30:23 293 received udp command:Event&&Amulet.On
10/04/2014 23:30:23 293 [vcevent] Amulet.On

10/04/2014 23:30:23 293 doCommand:Amulet On
10/04/2014 23:30:23 293 action repeat set to: 1
10/04/2014 23:30:23 293 Action:  VC.SetSpeechInput - Amulet
10/04/2014 23:30:23 293 [action] VC.SetSpeechInput:Amulet

10/04/2014 23:30:23 293 attempting to set microphone to: Amulet
10/04/2014 23:30:23 293 token key: {0.0.1.00000000}.{2f96de7b-bf20-4b50-8c05-00f2a473c63d}
10/04/2014 23:30:23 293 token name: CABLE Output (System Audio Driver)
10/04/2014 23:30:23 293 token key: {0.0.1.00000000}.{31beb31f-b57c-4fe3-9a73-0319225d31d9}
10/04/2014 23:30:23 293 token name: Microphone (Plantronics .Audio 626 DSP)
10/04/2014 23:30:23 293 token key: {0.0.1.00000000}.{356ae313-21b2-4cd4-be18-b136ed798a6a}
10/04/2014 23:30:23 293 token name: Digital Audio (S/PDIF) (High Definition Audio Device)
10/04/2014 23:30:23 293 token key: {0.0.1.00000000}.{497b3e78-c6dc-4091-81f7-66edd63a093c}
10/04/2014 23:30:23 293 token name: CABLE Output (System Audio Driver)
10/04/2014 23:30:23 293 token key: {0.0.1.00000000}.{89bb6068-5863-4580-a01d-4757c57589aa}
10/04/2014 23:30:23 293 token name: Line 1 (Virtual Audio Cable)
10/04/2014 23:30:23 293 token key: {0.0.1.00000000}.{9a0a8d71-0bc3-4a57-a201-13c5e7494bd0}
10/04/2014 23:30:23 293 token name: Microphone Array (FV Audio)
10/04/2014 23:30:23 293 token key: {0.0.1.00000000}.{9bd0aad0-5bdc-4020-9888-002bced4be88}
10/04/2014 23:30:23 293 token name: Line 1 (Virtual Audio Cable)
10/04/2014 23:30:23 293 token key: {0.0.1.00000000}.{a6e85431-21ed-40b7-aada-f8d225b5d89a}
10/04/2014 23:30:23 293 token name: Microphone (Amulet Devices Voice Remote Control)
10/04/2014 23:30:23 293 Match found, attempting to set input
10/04/2014 23:30:23 293 action repeat set to: 1
10/04/2014 23:30:23 293 Action:  Sound.PartialMute - 60
10/04/2014 23:30:23 293 [action] Sound.PartialMute:60

10/04/2014 23:30:23 293 action repeat set to: 1
10/04/2014 23:30:23 293 Action:  VC.On -
10/04/2014 23:30:23 293 [action] VC.On:

10/04/2014 23:30:23 293 [vcevent] VC.On

10/04/2014 23:30:23 293 idle timer set for 30 seconds.
10/04/2014 23:30:23 293 [info] Timeout set for: 30(s)

10/04/2014 23:30:23 293 doCommand:Listen
10/04/2014 23:30:23 293 action repeat set to: 1
10/04/2014 23:30:23 293 Action:  VC.On -
10/04/2014 23:30:23 293 [action] VC.On:

Which would appear to suggest it has worked but I am getting no volume level showing in VC when speaking into the Amulet microphone - disabling and re-enabling VS doesn't improve this. If I switch manually to the microphone I do get level showing but I have to disable and re-enable VC first.

This is VC2 on Windows 8.1 with update (it wasn't working before the update)

Many thanks for any clues
Garry

Kalle

  • $upporter
  • Hero Member
  • *****
  • Posts: 2319
  • Karma: 47
    • View Profile
Re: What am I doing wrong? VC.SetSpeechInput doesn't appear to switch
« Reply #1 on: April 10, 2014, 07:45:52 PM »
I think you must insert a "VC.RestartQuick" action in your command, but I'm not really sure  ::hmm
« Last Edit: April 10, 2014, 07:52:46 PM by Kalle »
***********  get excited and make things  **********

garryjw

  • $upporter
  • Contributor
  • *****
  • Posts: 59
  • Karma: 5
    • View Profile
Re: What am I doing wrong? VC.SetSpeechInput doesn't appear to switch
« Reply #2 on: April 10, 2014, 07:56:36 PM »
Hi Kalle

That sounded a good idea but I've now tried a RestartQuick immediately after the VC.SetSpeechInput, After the Partial mute and after the VC.On and unfortunately it hasn't improved things.

Thanks for trying to help - really appreciate what you do in the forum

Cheers
Garry

Kalle

  • $upporter
  • Hero Member
  • *****
  • Posts: 2319
  • Karma: 47
    • View Profile
Re: What am I doing wrong? VC.SetSpeechInput doesn't appear to switch
« Reply #3 on: April 10, 2014, 08:00:04 PM »
Thanks Garry, can you try a full restart, maybe this will help.
***********  get excited and make things  **********

garryjw

  • $upporter
  • Contributor
  • *****
  • Posts: 59
  • Karma: 5
    • View Profile
Re: What am I doing wrong? VC.SetSpeechInput doesn't appear to switch
« Reply #4 on: April 10, 2014, 08:13:01 PM »
Hi Kalle

Unfortunately FullRestart didn't work either but even if it had I have way too much going on at startup to be an effective method of switching.

I'm going to call it a night and come at it with a clear head tomorrow.

Thanks again
Garry

Kalle

  • $upporter
  • Hero Member
  • *****
  • Posts: 2319
  • Karma: 47
    • View Profile
Re: What am I doing wrong? VC.SetSpeechInput doesn't appear to switch
« Reply #5 on: April 10, 2014, 08:20:59 PM »
Maybe James has an idea  :bignod

Sleep well  ;)
Kalle
***********  get excited and make things  **********

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7715
  • Karma: 116
    • View Profile
    • VoxCommando
Re: What am I doing wrong? VC.SetSpeechInput doesn't appear to switch
« Reply #6 on: April 10, 2014, 08:36:27 PM »
I have not used this action recently so I will do some testing and get back to you.

In the meantime if you want to do some tests that may help us diagnostically, you can try this:

- test the same command with version 1.
- test the same command but with some other input other than the Amulet. (either with VC1 or VC2)

If it is working as intended you should not need to do any kind of restart.  Worst case you would need to set VC to off and then back to on (or standby), but I don't think even this should be necessary.

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7715
  • Karma: 116
    • View Profile
    • VoxCommando
Re: What am I doing wrong? VC.SetSpeechInput doesn't appear to switch
« Reply #7 on: April 10, 2014, 08:50:44 PM »
I should also mention that this action is a bit of a hack because Windows does not allow us to set the input for speech recognition...

I know, very stupid.  Bad microsoft, bad.  ::club

The only way to change the input for speech is to change the default TTS input device, and I am doing this through the registry... (always a last resort).

Not only does this method require me to access different keys depending on which engine you are using (old or SP) and possibly with different keys for 32 bit or 64 bit machines (can't remember right now), but the keys may also have changed from Windows 7 to Windows 8!

So, hopefully you can sympathise with me on this one, but I should check that you are using the regular desktop engine and not the SP engine.

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7715
  • Karma: 116
    • View Profile
    • VoxCommando
Re: What am I doing wrong? VC.SetSpeechInput doesn't appear to switch
« Reply #8 on: April 11, 2014, 07:40:49 AM »
We just did our first quick test here and it is working fine for us with the following setup:

Windows 7 x64
VC 1.919
Switching between a realtek builtin laptop mic and a samsom go mic usb.

We are using a single action.  No on,off, or restarts required.

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7715
  • Karma: 116
    • View Profile
    • VoxCommando
Re: What am I doing wrong? VC.SetSpeechInput doesn't appear to switch
« Reply #9 on: April 11, 2014, 07:44:23 AM »

This is VC2 on Windows 8.1 with update (it wasn't working before the update)


Sorry, what wasnt working before which update?  ::confused

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7715
  • Karma: 116
    • View Profile
    • VoxCommando
Re: What am I doing wrong? VC.SetSpeechInput doesn't appear to switch
« Reply #10 on: April 11, 2014, 07:50:07 AM »
Please try this Garry.

Go to device manager. 

On the top menu, click view then show hidden devices...

and make sure you dont have old inactive amulet devices in there.

Alternatively you could rename your current device to something unique like amulet123

I will still try to do a win8 test later on today.

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7715
  • Karma: 116
    • View Profile
    • VoxCommando
Re: What am I doing wrong? VC.SetSpeechInput doesn't appear to switch
« Reply #11 on: April 11, 2014, 10:07:44 AM »
Tested with Win7 x64 and also on Win 8.1 x64 and it works fine here switching between 3 different microphones (Amulet, GoMic USB, and realtek analog - pink input).

garryjw

  • $upporter
  • Contributor
  • *****
  • Posts: 59
  • Karma: 5
    • View Profile
Re: What am I doing wrong? VC.SetSpeechInput doesn't appear to switch
« Reply #12 on: April 11, 2014, 11:26:00 AM »
Hi James on the update point I was trying to say that this was Windows 8.1 with the latest spring update but that I had tested before applying the spring update and it had not worked then either. Turns out not to be relevant anyway.

I don't appear to have any hidden Amulet devices in device manager however I tried renaming to Amulet123 and that has worked. Most odd. Looking at the log it  seems like there is a left over amulet device in the registry but it isn't showing up in the control panel.

Code: [Select]
11/04/2014 15:20:11 316 Action:  VC.SetSpeechInput - Amulet123
11/04/2014 15:20:11 316 [action] VC.SetSpeechInput:Amulet123

11/04/2014 15:20:11 316 attempting to set microphone to: Amulet123
11/04/2014 15:20:11 316 token key: {0.0.1.00000000}.{2f96de7b-bf20-4b50-8c05-00f2a473c63d}
11/04/2014 15:20:11 316 token name: CABLE Output (System Audio Driver)
11/04/2014 15:20:11 316 token key: {0.0.1.00000000}.{31beb31f-b57c-4fe3-9a73-0319225d31d9}
11/04/2014 15:20:11 316 token name: Microphone (Plantronics .Audio 626 DSP)
11/04/2014 15:20:11 316 token key: {0.0.1.00000000}.{356ae313-21b2-4cd4-be18-b136ed798a6a}
11/04/2014 15:20:11 316 token name: Digital Audio (S/PDIF) (High Definition Audio Device)
11/04/2014 15:20:11 316 token key: {0.0.1.00000000}.{497b3e78-c6dc-4091-81f7-66edd63a093c}
11/04/2014 15:20:11 316 token name: CABLE Output (System Audio Driver)
11/04/2014 15:20:11 316 token key: {0.0.1.00000000}.{89bb6068-5863-4580-a01d-4757c57589aa}
11/04/2014 15:20:11 316 token name: Line 1 (Virtual Audio Cable)
11/04/2014 15:20:11 316 token key: {0.0.1.00000000}.{9a0a8d71-0bc3-4a57-a201-13c5e7494bd0}
11/04/2014 15:20:11 316 token name: Microphone Array (FV Audio)
11/04/2014 15:20:11 316 token key: {0.0.1.00000000}.{9bd0aad0-5bdc-4020-9888-002bced4be88}
11/04/2014 15:20:11 316 token name: Line 1 (Virtual Audio Cable)
11/04/2014 15:20:11 316 token key: {0.0.1.00000000}.{a6e85431-21ed-40b7-aada-f8d225b5d89a}
11/04/2014 15:20:11 316 token name: Microphone (Amulet Devices Voice Remote Control)
11/04/2014 15:20:11 316 token key: {0.0.1.00000000}.{c6d3c7c0-ff6c-4238-aef9-c6360048b9e2}
11/04/2014 15:20:11 316 token name: Amulet123 (Amulet Devices Voice Remote Control)
11/04/2014 15:20:11 316 Match found, attempting to set input
11/04/2014 15:20:11 316 doCommand:Listen
11/04/2014 15:20:11 316 action repeat set to: 1
11/04/2014 15:20:11 316 Action:  VC.On -
11/04/2014 15:20:11 316 [action] VC.On:


garryjw

  • $upporter
  • Contributor
  • *****
  • Posts: 59
  • Karma: 5
    • View Profile
Re: What am I doing wrong? VC.SetSpeechInput doesn't appear to switch
« Reply #13 on: April 11, 2014, 11:26:40 AM »
before I forget - thank you

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7715
  • Karma: 116
    • View Profile
    • VoxCommando
Re: What am I doing wrong? VC.SetSpeechInput doesn't appear to switch
« Reply #14 on: April 11, 2014, 11:46:47 AM »
Yes, it happens.  It is an unfortunate side effect of being forced to do it this way.  It is probably possible for me to cross reference the token with other parts of the registry to see if the device is actually valid, but oooffff.  Not much fun.  It usually seems to work fine so I don't think I'm going to do that...  :biglaugh

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7715
  • Karma: 116
    • View Profile
    • VoxCommando
Re: What am I doing wrong? VC.SetSpeechInput doesn't appear to switch
« Reply #15 on: April 11, 2014, 01:51:03 PM »
By the way the keys are stored here in the registry (for the normal speech engine, not for SP):

HKEY_CURRENT_USER\Software\Microsoft\Speech\AudioInput\TokenEnums\MMAudioIn

It really keeps everything in there.  I believe it is safe to go in and delete any tokens you are not using if you want to clean it up a bit.  At some point I'll see if there is anything I can do to make the selection process more robust...

garryjw

  • $upporter
  • Contributor
  • *****
  • Posts: 59
  • Karma: 5
    • View Profile
Re: What am I doing wrong? VC.SetSpeechInput doesn't appear to switch
« Reply #16 on: April 11, 2014, 05:11:58 PM »
Maybe put something in the documentation along the lines of

VC.SetSpeechInput will look for the name you specify in both the 'friendly' name of the sound device and the internal device name. In the sound panel these are shown with the Friendly name above the internal device name for each device. For example if you have an Amulet device this will by default have a friendly name of Microphone and an internal name of Amulet Devices Remote Control and will show as:

Microphone
Amulet Devices Remote Control


VC.SetSpeechInput will switch to the first device in the list that matches the parameter.

In this example doing a VC.SetSpeechInput with a parameter of Amulet will find this device. Equally if the parameter was Microphone, and as long as the amulet was the first device in the list with Microphone in the friendly or device name, then the Amulet device will be switched to. Unfortunately most devices are by default name Microphone so it is probably unwise to rely on this and instead rename your devices to something unique -you cann to this within the properties of the device in the sound control panel.

One thing to note is that renaming a device can sometimes leave internal traces of the original device leading to unexpected results. In the above case it is possible if the device was renamed from Microphone to Amulet then unexpected results might occur. Doing a VC.SetSpeechInput to Amulet might not switch to the device instead the old traces of the Microphone-Amulet Devices Remote Control might be found first instead.

To avoid this we advise only renaming devices to a unique name different to any internal device name. For example changing the name to Amulet1 and doing a VC.SetSpeechInput Amulet1 would work.


Kalle

  • $upporter
  • Hero Member
  • *****
  • Posts: 2319
  • Karma: 47
    • View Profile
Re: What am I doing wrong? VC.SetSpeechInput doesn't appear to switch
« Reply #17 on: April 12, 2014, 05:58:38 AM »
Thanks Garry, great tutorial  ::bow
I have one hint: When the VC.SetSpeechInput action is executed, you can see this in the VC history window. Then you can move your mouse over this command in the history window and will see the result to which input VC has changed (friendly name and also the internal device name in brackets)
***********  get excited and make things  **********

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7715
  • Karma: 116
    • View Profile
    • VoxCommando
Re: What am I doing wrong? VC.SetSpeechInput doesn't appear to switch
« Reply #18 on: April 12, 2014, 08:15:15 AM »
Thanks. Added this to the wiki.

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7715
  • Karma: 116
    • View Profile
    • VoxCommando
Re: What am I doing wrong? VC.SetSpeechInput doesn't appear to switch
« Reply #19 on: April 12, 2014, 08:22:23 AM »
To test I went in and deleted all these token keys from my registry. Windows did not mind, creating new keys for each device the first time I manually selected it as an input.

I found a method that enumerates all active input devices.  If this works reliably, and if it uses a naming system that matches the tokens, I might be able to use this to filter out unused devices.