SpeechSynthesis
Namespace: Wisej.Web.Ext.Speech
Assembly: Wisej.Web.Ext.Speech
The SpeechSynthesis interface of the Web Speech API is the controller interface for the speech service; this can be used to retrieve information about the synthesis voices available on the device, start and pause speech, and other commands besides.
- C#
- VB.NET
public class SpeechSynthesis : Component, IExtenderProvider
Public Class SpeechSynthesis
Inherits Component
Implements IExtenderProvider
Constructors
SpeechSynthesis()
Initializes a new instance of the Speech class.
Properties
Enabled
Boolean: Enables or disables the this SpeechSynthesis extender. (Default: True)
Language
String: Returns or sets the language of the utterance. (Default: "")
Pitch
Single: Returns and sets the pitch at which the utterance will be spoken at. (Default: 1)
Rate
Single: Returns and sets the speed at which the utterance will be spoken at. (Default: 1)
Voice
String: Returns or sets the voice that will be used to speak the utterance. (Default: "native")
Volume
Single: Returns or sets the volume that the utterance will be spoken at. The default is 1 (maximum). (Default: 1)
Methods
Cancel()
Removes all utterances from the utterance queue. If an utterance is currently being spoken, speaking will stop immediately.
CanExtend(target)
Returns true if SpeechSynthesis can offer an extender property to the specified target component.
| Parameter | Type | Description |
|---|---|---|
| target | Object | The target object to add an extender property to. |
Returns: Boolean. true if the SpeechSynthesis class can offer one or more extender properties; otherwise, false.
GetSpeechSynthesis(control)
SpeechSynthesis properties.
| Parameter | Type | Description |
|---|---|---|
| control | Control | The Control for which to retrieve the speech properties. |
Returns: Properties. A Properties instance with the SpeechSynthesis properties.
GetVoicesAsync()
Returns: Task<String[]>.
Pause()
Puts the SpeechSynthesis object into a paused state.
RemoveAll()
Removes all speech extenders.
Resume()
Resumes speaking if the SpeechSynthesis object was already paused.
SetSpeechSynthesis(control, speechSynthesis)
| Parameter | Type | Description |
|---|---|---|
| control | Control | |
| speechSynthesis | Properties |
Speak(text)
Adds an utterance to the utterance queue; it will be spoken when any other utterances queued before it have been spoken.
| Parameter | Type | Description |
|---|---|---|
| text | String |