Hello everyone.

The Mixed Reality Forums here are no longer being used or maintained.

There are a few other places we would like to direct you to for support, both from Microsoft and from the community.

The first way we want to connect with you is our mixed reality developer program, which you can sign up for at https://aka.ms/IWantMR.

For technical questions, please use Stack Overflow, and tag your questions using either hololens or windows-mixed-reality.

If you want to join in discussions, please do so in the HoloDevelopers Slack, which you can join by going to https://aka.ms/holodevelopers, or in our Microsoft Tech Communities forums at https://techcommunity.microsoft.com/t5/mixed-reality/ct-p/MicrosoftMixedReality.

And always feel free to hit us up on Twitter @MxdRealityDev.

SpeechManager: Can I add any keywords as commands?

TRRTRR
edited August 2016 in Questions And Answers

I was following along with the 100E tutorial and wanted to incorporate voice commands into my program. Am I able to use any words that I want? I tried replacing the command I wanted and called the appropriate method to carry out the behavior, but it doesn't seem to work. I included the code that I was following as well as my code below.

From the Tutorial 100E:

 void Start ()
   {
     keywords.Add("Reset world", () =>
    {
        //Call the OnReset Method on every descendent object
        this.BroadcastMessage("OnReset");
    });

    keywords.Add("Drop sphere", () =>
    {
        var focusObject = GazeGestureManager.Instance.FocusedObject;
        if(focusObject != null)
        {
            //Call the OnDrop method on just the focused object
            focusObject.SendMessage("OnDrop");
        }
    });

My code:

 void Start()
    {
       /*keywords.Add("Reset world", () =>
       {
        // Call the OnReset method on every descendant object.
        this.BroadcastMessage("OnReset");
    });*/

    keywords.Add("Rotate handle", () =>
    {
        var focusObject = GazeGestureManager.Instance.FocusedObject;
        if (focusObject != null)
        {
            // Call the OnRotate method on just the focused object.
            focusObject.SendMessage("OnRotate");
        }
    });
Tagged:

Best Answer

Answers

  • That should be working. Have you tried throwing a breakpoint in to see if it's recognizing your command? Maybe put it on the line that reads

    var focusObject = GazeGestureManager.Instance.FocusedObject;

  • TRRTRR
    edited August 2016

    @Jesse_McCulloch Thanks for you response. I just tried it using the Hololens device and it's not working (it doesn't go to the break point, so it doesn't seem to be recognizing my voice command). I also checked the microphone capability and it is on. Is there something special I need to add for it to pick up certain speech commands?

  • edited August 2016

    Sorry, that advice I gave you was bad advice. That breakpoint would not get hit, because all you are doing is adding an anonymous method to the keyword dictionary.

    You want to put a breakpoint in
    private void KeywordRecognizer_OnPhraseRecognized
    in your KeywordManager script

  • The tutorial that I was following doesn't have a KeywordManager script. Do I need to have that? What does it contain?

  • Sorry, I thought you were using the HoloToolkit. Which tutorial are you following?

  • 100E https://developer.microsoft.com/en-us/windows/holographic/holograms_101e

    Should I be using the HoloToolkit? I was trying to find the easiest way to incorporate my own voice commands

  • Ok, so in your speechmanager script, you should have a method called KeywordRecognizer_OnPhraseRecognized. That's where you want your breakpoint

Sign In or Register to comment.