Page 2 of 2

Re: FreePIE speech recognition

Posted: Thu Sep 25, 2014 4:14 am
by Pluckerpluck
Ah ok. I get how script works now.

Anyway, I decided I'd do some research. I downloaded the first build with speech recognition further up in this thread, and I've found the problem.

My language under "speech recognition" inn the settings was:
Microsoft Speech Recognizer 8.0 for Windows (English - UK)
and not
Microsoft Speech Recognizer 8.0 for Windows (English - US).
Changing this made everything start working, and the reason I detected it was because the earlier build states:
The language for the grammar does not match the language of the speech recognizer
This error just doesn't show up in the newer build.

So that's something you might want to look into. While I can use the US language (it works fine), I'd assume the UK language recognizer will pick up any particular differences in our languages.

Re: FreePIE speech recognition

Posted: Thu Sep 25, 2014 4:23 am
by CyberVillain
Strange.

Thanks for finding the problem, which version was it?

Re: FreePIE speech recognition

Posted: Thu Sep 25, 2014 4:29 am
by Pluckerpluck
I used this file to find the problem. It's the first one you posted in this thread.

Setting the language to US then makes the latest version work as well. I'm mostly happy that I've got this working! Finally I can set up the voice shortcuts I want.

Thanks for all the quick replies

Re: FreePIE speech recognition

Posted: Thu Sep 25, 2014 5:07 am
by CyberVillain
Ah that used a totlay different approuch wich had the Speech UI enabled, i removed that method on request from another user

Re: FreePIE speech recognition

Posted: Thu Sep 25, 2014 5:47 am
by Pluckerpluck
Yeah, I realized that. I thought of trying the old approach because it was more verbose about what was happening. So I thought it would be the best way to debug my problem with the new method.

Re: FreePIE speech recognition

Posted: Thu Sep 25, 2014 5:55 am
by CyberVillain
About using your correct grammar pack

http://stackoverflow.com/questions/1622 ... g-other-th

Re: FreePIE speech recognition

Posted: Sun May 01, 2016 11:58 am
by Infinity+1
Is it possible to get something like speech.isSpeaking() that returns a 1 if the computer is talking and a 0 if it is not?

That way we can create a loop to keep one speech.say command from interrupting the previous one.

Re: FreePIE speech recognition

Posted: Tue May 03, 2016 12:35 am
by CyberVillain
No, there is no such support, probably easy to fix

https://github.com/AndersMalmgren/FreeP ... hPlugin.cs

Re: FreePIE speech recognition

Posted: Tue May 03, 2016 3:45 am
by Infinity+1
I think this might be what is needed, though I don't yet know how to do it myself.

https://msdn.microsoft.com/en-us/librar ... -snippet-1

Re: FreePIE speech recognition

Posted: Tue May 03, 2016 4:50 am
by CyberVillain

Re: FreePIE speech recognition

Posted: Tue May 03, 2016 5:00 am
by Infinity+1
Wow, that works perfectly. Thank you!

Re: FreePIE speech recognition

Posted: Thu May 05, 2016 12:31 am
by Infinity+1
Is there any way to clear the queue that speech.said pulls from?

I ask because sometimes a part of code runs that should be triggered by a phrase, because the trigger-phrase was the last thing I said before I ran the part of the script that contains that trigger.

Re: FreePIE speech recognition

Posted: Thu May 05, 2016 4:05 am
by CyberVillain
I guess you are doing somethinug like?

Code: Select all

if speech.said("foo"):

Have a preecondidion? Like

Code: Select all

if listenToFoo and speech.said("foo"):

Re: FreePIE speech recognition

Posted: Thu May 05, 2016 6:15 am
by Infinity+1
Yes, sort of.

I have a function that's always listening for me to say "Computer" (Star Trek style), that then launches other functions that listen for more specific voice commands. One of those commands is "toggle head tracking", for example. Now, if I say "toggle head tracking" before that secondary function is actually called up, THEN I say "Computer", the head-tracking toggle switches on anyway. It seems to me that there is a queue that speech.said pulls from last-in-first-out. It's probably on Microsofts side of the deal, I bet. I'm just wondering if there is a way, somehow, to clear that queue? That way, I could do something like

Code: Select all

If speech.said("computer"):
   speech.clear
   otherCommands()  
Here's the script I'm taking about.

Re: FreePIE speech recognition

Posted: Thu May 05, 2016 7:22 am
by Infinity+1
it looks like you already have it in there...if I'm reading this correctly:

Code: Select all

        public override void Stop()
        {
            if (synth != null)
                synth.Dispose();

            if (recognitionEngine != null)
            {
                recognitionEngine.RecognizeAsyncStop();
                recognitionEngine.UnloadAllGrammars();
                recognitionEngine.Dispose();
            }
        }
so, would speech.stop work if it was included in:

Code: Select all

[Global(Name = "speech")]
    public class SpeechGlobal
    {
        private readonly SpeechPlugin plugin;

        public SpeechGlobal(SpeechPlugin plugin)
        {
            this.plugin = plugin;
        }

        public void say(string text)
        {
            plugin.Say(text);
        }

        public bool speaking { get { return plugin.Speaking; } }

        public bool said(string text)
        {
            return plugin.Said(text, 0.9f);
        }

        public bool said(string text, float confidence)
        {
            return plugin.Said(text, confidence);
        }

        public void selectVoice(string name)
        {
            plugin.SelectVoice(name);
        }
or would that just kill the speech engine entirely?

Re: FreePIE speech recognition

Posted: Sun May 08, 2016 2:10 pm
by FrenchyKiel
its not on side of microsoft, its the logic of freepie info.result have to return always false if you want to stop speech.said