FreePIE speech recognition

Official forum for open source FreePIE discussion and development.
Pluckerpluck
One Eyed Hopeful
Posts: 6
Joined: Mon Sep 15, 2014 4:40 pm

Re: FreePIE speech recognition

Post 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.
CyberVillain
Petrif-Eyed
Posts: 2166
Joined: Mon Jun 22, 2009 8:36 am
Location: Stockholm, Sweden

Re: FreePIE speech recognition

Post by CyberVillain »

Strange.

Thanks for finding the problem, which version was it?
Pluckerpluck
One Eyed Hopeful
Posts: 6
Joined: Mon Sep 15, 2014 4:40 pm

Re: FreePIE speech recognition

Post 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
CyberVillain
Petrif-Eyed
Posts: 2166
Joined: Mon Jun 22, 2009 8:36 am
Location: Stockholm, Sweden

Re: FreePIE speech recognition

Post by CyberVillain »

Ah that used a totlay different approuch wich had the Speech UI enabled, i removed that method on request from another user
Pluckerpluck
One Eyed Hopeful
Posts: 6
Joined: Mon Sep 15, 2014 4:40 pm

Re: FreePIE speech recognition

Post 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.
CyberVillain
Petrif-Eyed
Posts: 2166
Joined: Mon Jun 22, 2009 8:36 am
Location: Stockholm, Sweden

Re: FreePIE speech recognition

Post by CyberVillain »

About using your correct grammar pack

http://stackoverflow.com/questions/1622 ... g-other-th
Infinity+1
One Eyed Hopeful
Posts: 6
Joined: Sun May 01, 2016 11:51 am

Re: FreePIE speech recognition

Post 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.
CyberVillain
Petrif-Eyed
Posts: 2166
Joined: Mon Jun 22, 2009 8:36 am
Location: Stockholm, Sweden

Re: FreePIE speech recognition

Post by CyberVillain »

No, there is no such support, probably easy to fix

https://github.com/AndersMalmgren/FreeP ... hPlugin.cs
Infinity+1
One Eyed Hopeful
Posts: 6
Joined: Sun May 01, 2016 11:51 am

Re: FreePIE speech recognition

Post 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
CyberVillain
Petrif-Eyed
Posts: 2166
Joined: Mon Jun 22, 2009 8:36 am
Location: Stockholm, Sweden

Re: FreePIE speech recognition

Post by CyberVillain »

You do not have the required permissions to view the files attached to this post.
Infinity+1
One Eyed Hopeful
Posts: 6
Joined: Sun May 01, 2016 11:51 am

Re: FreePIE speech recognition

Post by Infinity+1 »

Wow, that works perfectly. Thank you!
Infinity+1
One Eyed Hopeful
Posts: 6
Joined: Sun May 01, 2016 11:51 am

Re: FreePIE speech recognition

Post 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.
CyberVillain
Petrif-Eyed
Posts: 2166
Joined: Mon Jun 22, 2009 8:36 am
Location: Stockholm, Sweden

Re: FreePIE speech recognition

Post 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"):
Infinity+1
One Eyed Hopeful
Posts: 6
Joined: Sun May 01, 2016 11:51 am

Re: FreePIE speech recognition

Post 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.
Infinity+1
One Eyed Hopeful
Posts: 6
Joined: Sun May 01, 2016 11:51 am

Re: FreePIE speech recognition

Post 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?
FrenchyKiel
One Eyed Hopeful
Posts: 47
Joined: Thu Oct 03, 2013 7:10 am

Re: FreePIE speech recognition

Post 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
Post Reply

Return to “FreePIE”