Use your voice as a Hotkey in AutoHotkey!
If you speak a language other than English, I would greatly appreciate it if you could help expand the demo or suggest other changes!
SR
in their name. TTS
labelled downloads are for Text-to-speech and will not work with HotVoice.MSSpeech_SR_en-US_TELE.msi
unblock.ps1
in the HotVoice Folder and select "Run as Administrator". "Recognizers" are basically Language Packs. Ordering seems to be based on installation order, with the "Lightweight" pack always present and at the end of the list. Therefore, if you only install one language pack, it should always be ID 0
, so everything in HotVoice defaults to using ID 0.
The Mic Volume
slider should move when you speak.
HotVoice uses the "Default Recording Device" that is configured in Windows.
HotVoice uses these two types of object to build up commands.
Throughout this documentation, the following syntax will be used to denote a phrase with optional components:
Launch [Notepad, Word]
In this instance it can mean "Launch Notepad" or "Launch Word".
Choices objects represent a series of optional words. As in the above example, [Notepad, Word]
is a series of Choices.
Grammar objects are the primary building blocks of HotVoice. They can hold either single words, or choices objects, or even other Grammar objects.
A HotVoice script must do the following:
Load the HotVoice Library
#include Lib\HotVoice.ahk
Create a new HotVoice class
hv := new HotVoice()
; Create a new Grammar
testGrammar := hv.NewGrammar()
; Add the word "Test" to it
testGrammar.AppendString("Test")
; Load the Grammar
hv.LoadGrammar(testGrammar, "Test", Func("MyFunc"))
hv.StartRecognizer()
Creates a new Choices object from a comma-separated string
Choices NewChoices(string choiceListStr)
eg choices := hv.NewChoices("Up, Down, Left, Right")
Note that if you want to re-use the same choices in multiple scripts, see MikeHotelOscar's ChoiceBuilder library
Creates a new, empty Grammar Object
GrammarObj NewGrammar()
eg grammarObj := hv.NewGrammar()
Gets a Choices object from HotVoice's store of choices objects.
By default, this is empty execpt for the Percent
Choices object, which contains the numbers 0-100
Choices GetChoices(string name)
eg percentChoices := hv.GetChoices("Percent")
Adds a Choices object to HotVoice's store of choices objects.
void SetChoices(string name, Choices choices)
eg percentChoices := hv.SetChoices("Directions", hv.NewChoices("Up, Down, Left, Right"))
Loads a GrammarObject into the Recognizer and specifies which function to call when it is triggered.
void LoadGrammar(GrammarObject g, string name, BoundFunc callback)
eg hv.LoadGrammar(testGrammar, "Test", Func("MyFunc"))
Gets a list of available recognizers
RecognizerObject GetRecognizerList()
eg recgonizers := recognizers := hv.GetRecognizerList()
RecognizerObject is an array containing objects with the following properties:
ID: The ID of the recognizer (Starts at 0)
Name: The Name of the recognizer
TwoLetterISOLanguageName: The ISO 639-1 code for the language (eg "en")
LanguageDisplayName: The display name for the language (eg "English (United States)")
Loads a Recognizer
void Initialize(int recognizerId = 0)
eg hv.Initialize()
Note that if you call Initialize
, any previously loaded recognizer is unloaded.
Starts the Recognizer
void StartRecognizer()
eg hv.StartRecognizer()
Gets a human-readable string that describes the phrasology that this Grammar supports
string GetPhrases()
eg phrases := grammarObj.GetPhrases()
Adds a word or words to a GrammarObject
void AppendString(string text)
eg grammarObj.AppendString("Hello")
Adds a ChoicesObject to this GrammarObject
void AppendChoices(Choices choices)
eg grammarObj.AppendChoices(choicesObj)
Adds up to 10 GrammarObjects to this GrammarObject
void AppendGrammars(GrammarObject g1, ... , GrammarObject g10)
eg grammarObj1.AppendGrammars(grammarObj2, grammarObj3)
This ONLY APPLIES if you want to work with the C# code that powers HotVoice.
If you are writing AHK scripts using HotVoice, this does not apply to you.
Microsoft.Speech
C:\Program Files\Microsoft SDKs\Speech\v11.0\Assembly