Skip to content

Speech script functions

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

speech.activateVoiceGate

Switches to a VoiceGate profile. VoiceGate holds speech back while you are talking. Use "none" (or empty) to switch VoiceGate off.

Value What to put in
profile The profile name as set on the Speech page, like "Talking". "none" switches it off.

Gives back: true when it worked, false when no profile has that name.

var answer = await Cb.Call("speech.activateVoiceGate", new { profile = "Talking" });
answer = cb.call("speech.activateVoiceGate", profile="Talking")

speech.clear

Throws away every text that is waiting in the speech queue. The text being spoken right now keeps playing.

Gives back: Nothing.

var answer = await Cb.Call("speech.clear");
answer = cb.call("speech.clear")

speech.pause

Pauses the speech queue, or starts it again. Texts keep waiting while it is paused.

Value What to put in
paused Optional. true pauses, false starts it again. Default true.

Gives back: Nothing.

var answer = await Cb.Call("speech.pause", new { paused = true });
answer = cb.call("speech.pause", paused=True)

speech.setEnabled

Turns all text-to-speech on or off. While it is off, new texts are not spoken.

Value What to put in
enabled Optional. true turns speech on, false turns it off. Default true.

Gives back: Nothing.

var answer = await Cb.Call("speech.setEnabled", new { enabled = false });
answer = cb.call("speech.setEnabled", enabled=False)

speech.setEvents

Turns spoken event alerts (like follows and raids) on or off.

Value What to put in
enabled Optional. true turns event speech on, false turns it off. Default true.

Gives back: Nothing.

var answer = await Cb.Call("speech.setEvents", new { enabled = true });
answer = cb.call("speech.setEvents", enabled=True)

speech.setUserVoice

Gives a viewer their own voice. Their chat messages are then read with it. An empty alias resets them to the normal voice.

Value What to put in
platform The platform of the viewer, like "twitch".
user The viewer's name, like "CoolViewer".
userId The viewer's user id. You can give this, the name, or both.
alias The voice name (alias) from the Speech page, like "Robot". Empty resets the voice.

Gives back: Nothing.

var answer = await Cb.Call("speech.setUserVoice", new { platform = "twitch", user = "CoolViewer", alias = "Robot" });
answer = cb.call("speech.setUserVoice", platform="twitch", user="CoolViewer", alias="Robot")

speech.speak

Says text out loud with your text-to-speech voice. It joins the speech queue. Nothing is said when speech is turned off or the text is empty.

Value What to put in
text What to say, like "Welcome to the stream!"
alias Optional. The voice name (alias) to use, as set on the Speech page. Leave it out for your default voice.
wait Optional. true waits until the text has been spoken before your script goes on. Default false.
silent Optional. true only makes the sound file and does not play it. Default false.
badWordFilter Optional. true runs the text through your speech word filters first. Default false.

Gives back: Nothing, unless wait or silent is true. Then it gives back success (false when skipped or speech is off), duration in milliseconds, and speechFile (the saved sound file, or empty).

var answer = await Cb.Call("speech.speak", new { text = "Welcome to the stream!" });
answer = cb.call("speech.speak", text="Welcome to the stream!")

speech.state

Tells you what text-to-speech is doing right now.

Gives back: enabled, paused, eventsEnabled (true/false), queueLength (how many texts wait), current (the text being spoken, or empty) and voiceGate (true while VoiceGate holds speech back).

var answer = await Cb.Call("speech.state");
answer = cb.call("speech.state")

speech.stop

Stops the text that is being spoken right now. The queue goes on with the next one.

Gives back: Nothing.

var answer = await Cb.Call("speech.stop");
answer = cb.call("speech.stop")

speech.stopUser

Throws away a viewer's waiting texts and stops theirs if it is playing right now.

Value What to put in
platform The platform of the viewer, like "twitch".
user The viewer's name, like "SpammyViewer".
userId The viewer's user id. You can give this, the name, or both.

Gives back: How many texts were stopped or thrown away (0 when no name or id was given).

var answer = await Cb.Call("speech.stopUser", new { platform = "twitch", user = "SpammyViewer" });
answer = cb.call("speech.stopUser", platform="twitch", user="SpammyViewer")