SpeechToText.Command
WebSocket event schema, payload, and examples
text
string
confidence
number required
alternatives
AlternativePhrase[]
text
string
confidence
number required
Schema
The JSON Schema for the event payload, if available.
schema.json
{
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "SpeechToTextEvent",
"type": "object",
"additionalProperties": false,
"properties": {
"text": {
"type": [
"null",
"string"
]
},
"confidence": {
"type": "number",
"format": "float"
},
"alternatives": {
"type": [
"array",
"null"
],
"items": {
"$ref": "#/definitions/AlternativePhrase"
}
}
},
"definitions": {
"AlternativePhrase": {
"type": "object",
"additionalProperties": false,
"properties": {
"text": {
"type": [
"null",
"string"
]
},
"confidence": {
"type": "number",
"format": "float"
}
}
}
}
}
JSON Payload
An example JSON payload for the event, automatically generated using JSONSchemaFaker
example.json
{
"alternatives": [
{
"confidence": 37547837.825373024,
"text": "sint laboris sit Lorem voluptate"
},
{
"confidence": -91163680.7330707,
"text": "non Excepteur in"
},
{
"confidence": -18716286.93454723,
"text": "nostrud aliqua minim dolore pariatur"
},
{
"confidence": 37878688.43062076,
"text": null
},
{
"confidence": -77277048.4592278,
"text": null
}
],
"confidence": -80359425.61902758,
"text": "adipisicing ut velit id"
}
Client Example
Example code showing how to subscribe to this event using the Streamer.bot WebSocket Client
index.js
// Initialize the Streamer.bot WebSocket Client
const client = new StreamerbotClient();
// Subscribe to "SpeechToText.Command" events and register a callback
client.on('SpeechToText.Command', ({ event, data }) => {
// Code here will run every time the event is received!
console.log('Received event:', event.source, event.type);
console.log('Event data:', data);
});