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.

HoloToolkit global voice command

Hi all,

Could anyone help me with the global audio command using the new HoloToolkit?
Currently, I am implementing ISpeechHandler in one of the object scripts in a scene. I have implemented the following function, but I get no output in the output window in VS (running in Debug mode).

public void OnSpeechKeywordRecognized(SpeechKeywordRecognizedEventData eventData)
{
Debug.Log(eventData.RecognizedText);
}

Thank you.

Tagged:

Best Answers

  • Answer ✓

    @Jesse_McCulloch No, I haven't added it. I will try it though. Thanks.

    Also, I got the voice commands to work by adding KeywordManager.cs to the Managers object. This was a much better option as I can now start keyword recognition manually when I want and/or keep it on automatically.

Answers

  • Hi @ahdeshpande There is a video about making speech HoloLens Speech Example
    The thread SpeechManager: Can I add any keywords as commands?
    Also discusses how to add commands

  • @Jimbohalo10 The Holographic Academy videos aren't using the HoloToolkit so they aren't that helpful. HoloToolkit makes development much easier. Appreciate your response though. I will take a look into it and see if I can co-relate and use any of the techniques. Thank you.

  • If you already have the InputManager HTK component added to an object in the Unity Scene, then it could be that the Microphone capability has not been added.
    From the HTK KeywordManager.cs file:
    /// IMPORTANT: Please make sure to add the microphone capability in your app, in Unity under
    /// Edit -> Project Settings -> Player -> Settings for Windows Store -> Publishing Settings -> Capabilities

    I have been using the KeyWordManager HTK component for my needs, which allows setting the keywords and handlers using the Unity Editor.

  • @realityenhanced You are absolutely right regarding the configuration of the HoloLens for the microphone to be enabled, but that didn't solve my problem.

    I want the microphone to recognize voice inputs when I look at a button. So, I implemented the following in the script attached to the button.

    public void OnSpeechKeywordRecognized(SpeechKeywordRecognizedEventData eventData)
    {
    Debug.Log(eventData.RecognizedText);
    }

    This doesn't work despite the microphone being included in the Package.appmanifest






    Thanks @realityenhanced for helping but do you know where I am going wrong?

  • @ahdeshpande - You mentioned having the ISpeechHandler implemented, but do you also have the SpeechInputSource.cs script added to your Hierarchy?

  • Answer ✓

    @Jesse_McCulloch No, I haven't added it. I will try it though. Thanks.

    Also, I got the voice commands to work by adding KeywordManager.cs to the Managers object. This was a much better option as I can now start keyword recognition manually when I want and/or keep it on automatically.

  • hmirihmiri
    edited August 2017

    @Jesse_McCulloch

    Does this mean we now only have to use HoloToolkit.Unity.InputModule and then implement OnSpeechKeywordRecognized to be able to recognize keywords? We no longer have to add KeywordManager.cs etc... Correct?

    The following script does not have the effect that I expected (if I am right above)

    public class RectCommand : MonoBehaviour, ISpeechHandler
    {
        public void OnSpeechKeywordRecognized(SpeechKeywordRecognizedEventData eventData)
        {
            Debug.Log(eventData.RecognizedText);
    
            var voiceCommand = eventData.RecognizedText.ToLower();
    
            switch (voiceCommand)
            {
                case "change color":
                    {
                        Debug.Log("Changed Color!");
                        break;
                    }
    
                case "reset":
                    {
                        Debug.Log("Changed Color!");
                        break;
                    }
    
                default:
                    break;
            }
        }
    }
    
  • @Jesse_McCulloch

    Does this mean we now only have to use HoloToolkit.Unity.InputModule and then implement OnSpeechKeywordRecognized to be able to recognize keywords? We no longer have to add KeywordManager.cs etc... Correct?

    The following script does not have the effect that I expected (if I am right above)

    public class RectCommand : MonoBehaviour, ISpeechHandler
    {
        public void OnSpeechKeywordRecognized(SpeechKeywordRecognizedEventData eventData)
        {
            Debug.Log(eventData.RecognizedText);
    
            var voiceCommand = eventData.RecognizedText.ToLower();
    
            switch (voiceCommand)
            {
                case "change color":
                    {
                        Debug.Log("Changed Color!");
                        break;
                    }
    
                case "reset":
                    {
                        Debug.Log("Changed Color!");
                        break;
                    }
    
                default:
                    break;
            }
        }
    }
    
  • @Jesse_McCulloch

    Does this mean we now only have to use HoloToolkit.Unity.InputModule and then implement OnSpeechKeywordRecognized to be able to recognize keywords? We no longer have to add KeywordManager.cs etc... Correct?

    The following script does not have the effect that I expected (if I am right above)

    public class RectCommand : MonoBehaviour, ISpeechHandler
    {
        public void OnSpeechKeywordRecognized(SpeechKeywordRecognizedEventData eventData)
        {
            Debug.Log(eventData.RecognizedText);
    
            var voiceCommand = eventData.RecognizedText.ToLower();
    
            switch (voiceCommand)
            {
                case "change color":
                    {
                        Debug.Log("Changed Color!");
                        break;
                    }
    
                case "reset":
                    {
                        Debug.Log("Changed Color!");
                        break;
                    }
    
                default:
                    break;
            }
        }
    }
    
  • Building the future of holographic navigation. We're hiring.

Sign In or Register to comment.