SpeechToText.Dictation
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": -8326007.192854121,
"text": "ad et culpa"
},
{
"confidence": -78315133.75254217,
"text": null
},
{
"confidence": -24680504.742417693,
"text": "veniam"
},
{
"confidence": -56968863.4172427,
"text": "sunt nostrud"
},
{
"confidence": -53336953.43601832,
"text": null
}
],
"confidence": -88197850.30809559,
"text": null
}
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.Dictation" events and register a callback
client.on('SpeechToText.Dictation', ({ 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);
});