Class AssistViewTextToSpeech
Represents the AssistViewTextToSpeech component that holds the text-to-speech settings properties.
Inherited Members
Namespace: Syncfusion.Blazor.InteractiveChat
Assembly: Syncfusion.Blazor.InteractiveChat.dll
Syntax
public class AssistViewTextToSpeech : SfOwningComponentBase, IComponent, IHandleEvent, IHandleAfterRender, IDisposable
Remarks
The AssistViewTextToSpeech component provides comprehensive control over text-to-speech behavior, including language selection, pitch, rate, volume, and voice selection.
This component integrates with the browser's native speech synthesis API and provides a user-friendly interface for configuring speech output.
Examples
<AssistViewTextToSpeech Language="en-US" SpeechPitch="1.0" SpeechRate="1.0" Volume="1.0">
</AssistViewTextToSpeech>
Constructors
AssistViewTextToSpeech()
Declaration
public AssistViewTextToSpeech()
Properties
InputText
Specifies the text content to be converted into speech.
Declaration
[Parameter]
public string InputText { get; set; }
Property Value
| Type | Description |
|---|---|
| string | A string containing the text to synthesize. The default value is an empty string. |
Remarks
Accepts plain string input for synthesis. When omitted, callers may provide the text to speak via runtime APIs that invoke the client-side speech routine.
Language
Specifies the language used for text-to-speech synthesis.
Declaration
[Parameter]
public string Language { get; set; }
Property Value
| Type | Description |
|---|---|
| string | A string representing the ISO language code for speech synthesis. The default value is |
Remarks
Accepts valid ISO language codes such as 'en-US', 'fr-FR', or 'de-DE'.
SpeechPitch
Specifies the pitch of the synthesized voice.
Declaration
[Parameter]
public double SpeechPitch { get; set; }
Property Value
| Type | Description |
|---|---|
| double | A double representing the pitch multiplier. The default value is |
Remarks
Accepts numeric values typically between 0 (low) and 2 (high). A value of 1 is the normal pitch for the selected voice.
SpeechRate
Specifies the speaking rate of the synthesized voice.
Declaration
[Parameter]
public double SpeechRate { get; set; }
Property Value
| Type | Description |
|---|---|
| double | A double representing the speaking rate multiplier. The default value is |
Remarks
Accepts numeric values typically between 0.1 (slow) and 10 (fast). A value of 1 is the normal speaking rate.
Voice
Specifies the voice used for speech synthesis.
Declaration
[Parameter]
public string Voice { get; set; }
Property Value
| Type | Description |
|---|---|
| string | A string representing the voice name. The default value is Empty. |
Remarks
Must be a valid speech synthesis voice returned by `speechSynthesis.getVoices()` when available. If not found, the browser falls back to the default voice for the selected language.
Volume
Gets or sets the volume level for the synthesized speech.
Declaration
[Parameter]
public double Volume { get; set; }
Property Value
| Type | Description |
|---|---|
| double | A double representing the volume level. The default value is |
Remarks
Specifies the volume level of the synthesized voice. Accepts numeric values between 0 (mute) and 1 (maximum).
Methods
BuildRenderTree(RenderTreeBuilder)
Declaration
protected override void BuildRenderTree(RenderTreeBuilder __builder)
Parameters
| Type | Name | Description |
|---|---|---|
| RenderTreeBuilder | __builder |
Overrides
Dispose(bool)
Dispose unmanaged resources in the Syncfusion Blazor component.
Declaration
protected override void Dispose(bool disposing)
Parameters
| Type | Name | Description |
|---|---|---|
| bool | disposing | Boolean value to dispose the object. |
Overrides
OnInitialized()
Initializes the AssistViewTextToSpeech component and registers it with the parent SfAIAssistView.
Declaration
protected override void OnInitialized()
Overrides
Remarks
This method is called when the component is first initialized. It notifies the parent SfAIAssistView by calling Syncfusion.Blazor.InteractiveChat.SfAIAssistView.UpdateTextToSpeechSettings(Syncfusion.Blazor.InteractiveChat.AssistViewTextToSpeech).
Overrides the base implementation to include parent registration.
OnParametersSetAsync()
Handles parameter updates for the AssistViewTextToSpeech component.
Declaration
protected override Task OnParametersSetAsync()
Returns
| Type | Description |
|---|---|
| Task | A System.Threading.Tasks.Task representing any asynchronous operation. |