TLDR;
|
Do you often find yourself in scenes filled with buttons, and you wish you could just use your voice to control everything?
Well, now you can!
Voice Commander is a plugin that inspects a scene for all buttons, adding their text as keywords into a speech recognition system, then invokes their action(s) when you say their keywords. The scene doesn't need to be made with this in mind; it just needs to use buttons with text that you can reasonably say. All you have to do is add the plugin, and it'll take care of everything else for you.
Instructions
Load the "Voice Commander Demo" scene and follow along with the in-scene instructions to experience Voice Commander's abilities by navigating through a few sub menus using only your voice.
To utilize Voice Commander in other scenes, simply add the "AAM Voice Commander.cs" plugin to a session, scene, or object. I like to add it as to my session plugin default presets, so it's always active for all scenes, and I can easily toggle it off as needed for any scenes that implement their own speech recognition.
The plugin will immediately inspect the entire scene for any buttons and register their keywords. The plugin will also reinspect the scene for buttons any time it invokes a button, after a scene loads, and at any time if you speak the phrase "Refresh Keywords". You may also optionally enable periodic refreshing or manually trigger a refresh, such as via an action of another button or logic brick.
You can toggle a few logging options in the plugin's UI.
- Log Keyword Refreshing
- Logs the full list of keywords every time it refreshes. This can be handy if you're unsure what all it found and which buttons you can control by Voice Commander.
- Log Keyword Recognition
- Logs any keywords it recognizes you saying, along with reporting its confidence level.
- Note that Unity's speech recognition system only listens to the system default microphone!
- This plugin works best on scenes with uniquely named buttons that use short and easily spoken snippets of text.
- If a scene has multiple buttons with the same text visible at the same time, only one of them will be invoked, as there's no reasonable way for the code to know which button with that text you intend to invoke.
- If a button has a lot of text, special characters, or is otherwise too complex, the speech recognition system may not be able to recognize that.
- If this plugin is active while another speech recognition plugin is also active, they may conflict.
- Multiple keyword recognizers are supported, but only one will respond to a specific keyword.
- If a refresh occurs while you are speaking, that won't be recognized, and you'll need to say it again after the refresh completes.
- As of version 3, this type of interruption will be avoided as long as the available keywords didn't just change. It now only rebuilds and restarts the recognizer when it actually detects differences in the set of available keywords.
MacGruber's https://hub.virtamate.com/resources/speechrecognition.6865/ was a major inspiration for this plugin.
I found an issue with a previous version where it was improperly handling the disable and re-enable events, but I put in a fix for that with an update, and it is working for me consistently since then. So, keep an eye out if you're doing any disable/enable or reloading of the plugin or anything like that, as something there may yet be the cause for some scenario where it stops working.