MixedRealityToolkit-Unity icon indicating copy to clipboard operation
MixedRealityToolkit-Unity copied to clipboard

Acoustic feedback for successful speech recognition

Open assert-not-singularity opened this issue 9 years ago • 6 comments

Hi everyone!

When starting to develop my app, I used the Academy tutorial as a reference for my speech recognition manager. It's been a while and if I remember correctly, the KeywordManager script wasn't available then. So I hard-coded my voice commands into my script.

Now I'd like to use the KeywordManager because I prefer the flexibility of defining the commands and their reactions in the Unity Editor. But as far as I can figure it, it is not possible to play a sound when a voice command is recognized correctly as it is right now. Since I'd like to have some kind of acoustic feedback after a recognition, I've got three ideas for enhancing the KeywordManager with this functionality:

  1. Adding an AudioSource and a public AudioClip to the class which is played when the registered action is called

or

  1. adding a new event handler and a new event to the class (e.g. OnKeywordRecognized) which allows us to subscribe to this event and play a sound in another class (e.g. SoundManager)

or

  1. making the created KeywordRecognizer a public accessible property ( get; private set; ). This would enable us to also subscribe to the KeywordRecognizer's OnPhraseRecognized event.

I'd like to hear about your thoughts!

// edit: I've just discovered that the SpeechInputSource now has the same functionality. I'm using the latest release of the HTK, so when I looked into it, I just could assign keyboard shortcuts. So just see this issue as an improvement to the SpeechInputSource instead of the KeywordManager.

assert-not-singularity avatar Mar 22 '17 15:03 assert-not-singularity

I created a pull request https://github.com/Microsoft/HoloToolkit-Unity/pull/581 for 2. It adds a UnityEvent that triggers on any recognized phrase or keycode.

sixpolys avatar Mar 23 '17 12:03 sixpolys

Oh, thanks for already implementing this feature!

I would have done this by myself, I just wanted to discuss the approach before. However, using a UnityEvent is a even nicer solution.

But I think you committed too much lines of code in the KeywordManager.unity scene. ;-)

assert-not-singularity avatar Mar 23 '17 13:03 assert-not-singularity

Was I able to address this in PR https://github.com/Microsoft/HoloToolkit-Unity/pull/533?

Also the KeywordManager is going to be marked as obsolete due to the SpeechInputSource pretty much doing the same thing.

StephenHodgson avatar Mar 23 '17 13:03 StephenHodgson

I have to admit that I didn't understand your changes as a whole yet.

But I reckon that I'm able to implement the ISpeechHandler interface then and play a audio clip in the OnSpeechKeywordRecognized method?

assert-not-singularity avatar Mar 24 '17 12:03 assert-not-singularity

correct.

StephenHodgson avatar Mar 24 '17 14:03 StephenHodgson

Thank you!

assert-not-singularity avatar Mar 24 '17 14:03 assert-not-singularity