Skip to content

Voice control script functions

Functions for C# (Cb.Call) and Python (cb.call). See Script functions for how to use them.

voiceControl.commands

Lists all your voice commands from the Voice Control page.

Gives back: A list of commands. Each has id, name, enabled, phrase (what to say), location (Exact, Start or Anywhere), stopAfter, overrideGlobal and confidenceThreshold (0-100).

var answer = await Cb.Call("voiceControl.commands");
answer = cb.call("voiceControl.commands")

voiceControl.dictationLog

Shows what voice control heard recently. Handy to see why a command did not run.

Gives back: A list of heard phrases. Each has time, text, confidencePercent (how sure it was, 0-100), commands (which ones ran) and ignored.

var answer = await Cb.Call("voiceControl.dictationLog");
answer = cb.call("voiceControl.dictationLog")

voiceControl.inputDevices

Lists the microphones voice control can listen to.

Gives back: A list of microphones. Each has id, name and isDefault (true for your computer's default).

var answer = await Cb.Call("voiceControl.inputDevices");
answer = cb.call("voiceControl.inputDevices")

voiceControl.isListening

Checks whether voice control is listening to your microphone right now.

Gives back: true while listening, otherwise false.

var answer = await Cb.Call("voiceControl.isListening");
answer = cb.call("voiceControl.isListening")

voiceControl.setCommand

Changes what you have to say for a voice command. Can also make a new command. Fails with an error when the command is not found (and create is off) or the phrase is empty.

Value What to put in
command The voice command's name or id, like "Switch to gameplay".
phrase What you have to say, like "go to gameplay". Needed.
location Optional. Where in what you say the phrase must be: "Exact" (all of it), "Start" or "Anywhere". Leave it out to keep it as it is.
create Optional. true makes a new command with this name when none exists. Default false.

Gives back: The command after the change, with the same details as voiceControl.commands.

var answer = await Cb.Call("voiceControl.setCommand", new { command = "Switch to gameplay", phrase = "go to gameplay", location = "Anywhere" });
answer = cb.call("voiceControl.setCommand", command="Switch to gameplay", phrase="go to gameplay", location="Anywhere")

voiceControl.setCommandState

Turns one voice command on or off. Fails with an error when no command has that name.

Value What to put in
command The voice command's name or id, like "Switch to gameplay".
state Optional. "Enabled", "Disabled" or "Toggle" (switch). Default "Toggle".

Gives back: The new state: true for on, false for off.

var answer = await Cb.Call("voiceControl.setCommandState", new { command = "Switch to gameplay", state = "Disabled" });
answer = cb.call("voiceControl.setCommandState", command="Switch to gameplay", state="Disabled")

voiceControl.setInputDevice

Picks which microphone voice control listens to. The choice is saved.

Value What to put in
device The microphone's name or id from voiceControl.inputDevices. Empty or "Default" uses your computer's default microphone.

Gives back: true when done.

var answer = await Cb.Call("voiceControl.setInputDevice", new { device = "Default" });
answer = cb.call("voiceControl.setInputDevice", device="Default")

voiceControl.startListening

Starts listening to your microphone for voice commands. Fails with an error when no microphone or recognizer is available.

Gives back: true when it is listening now.

var answer = await Cb.Call("voiceControl.startListening");
answer = cb.call("voiceControl.startListening")

voiceControl.status

Tells you how voice control is doing right now.

Gives back: engine (the speech recognizer in use), state, message (a status line), listening (true/false) and inputDevice (the chosen microphone; empty means the default).

var answer = await Cb.Call("voiceControl.status");
answer = cb.call("voiceControl.status")

voiceControl.stopListening

Stops listening for voice commands.

Gives back: true when done.

var answer = await Cb.Call("voiceControl.stopListening");
answer = cb.call("voiceControl.stopListening")