Speech (WebWidget)
The Speech WebWidget offers the possibility of speech input and output. |
Use
Dependencies
- speech.html
- speech-directive.js
message-interface
In the directional description, the WebWidget is divided into its two components. The WebWidget implemented in HTML, which implements the display logic and user interaction in the browser, and the WebWidget implemented in InstantView, which provides the other side with the data from ClassiX and controls it.
Name | Parameters | Description |
---|---|---|
Push messages (IV→HTML) | ||
speak | Utterance | This message passes an Utterance object as a CX_JSON_OBJECT to the WebWidget and specifies the text to be spoken. |
listen | Parameters | This message passes parameters as CX_JSON_OBJECT to the WebWidget and starts speech input. |
stop_listening | - | This message instructs the WebWidget to stop speech input. |
Events (HTML→IV) | ||
TRANSCRIPT_SOCKET | Result | This message is triggered when the speech input has a result. This can be an intermediate result. |
The Utterance object
Field | Type | Default | Description |
---|---|---|---|
text | String | - | This is the text to be spoken. As the only value, not optional. |
pitch | Float | 1.0 | Must be in the range 0.0 - 2.0. Changes the pitch of the voice. Optional. |
volume | Float | 1.0 | Must be in the range 0.0 - 1.0. Changes the volume of the voice. Optional. |
rate | Float | 1.0 | Must be in the range 0.1 - 10.0. Changes the speed of the voice. Optional. |
long | Float | "en" | A string specifying the language (in BCP47 format, e.g. "en-GB"). Optional. |
The parameter object
Field | Type | Default | Description |
---|---|---|---|
continuous | Boolean | FALSE | Determines whether the speech input should be terminated after an input. If TRUE, then listening continues until stop_listening is sent. |
interimResults | Boolean | FALSE | Determines whether intermediate results are to be sent. If FALSE, only a result is sent when the user stops speaking. If TRUE, fragmentary results are also sent beforehand. |
maxAlternative | Integer | 1 | How many alternatives are to be sent. The result is a list of alternatives sorted by descending probability. Example: "A whale", "Dial-in", "A choice", "A whale", etc. |
The Result object
Field | Type | Description |
---|---|---|
isFinal | Boolean | TRUE if the user has stopped speaking, FALSE if they have not finished. If interimResult is FALSE, isFinal will always be TRUE. |
length | Integer | The number of alternatives, at most maxAlternatives. |
0 ... length-1 | Alternative | The Result object is an array of alternatives, sorted by descending probability. |
The Alternative object
Field | Type | Description |
---|---|---|
confidence | Float | The probability that the user actually said this text. 0.0 - 1.0 |
transcript | String | The text that the user said. |