Table of Contents

Class SpeechSynthesisUtterance

Namespace
CSharpToJavaScript.APIs.JS
Assembly
CSharpToJavaScript.dll

The SpeechSynthesisUtterance interface of the Web Speech API represents a speech request.
It contains the content the speech service should read and information about how to read it (e.g., language, pitch and volume.)

[Value("SpeechSynthesisUtterance")]
public class SpeechSynthesisUtterance : EventTarget
Inheritance
SpeechSynthesisUtterance
Inherited Members

Remarks

Constructors

SpeechSynthesisUtterance()

public SpeechSynthesisUtterance()

SpeechSynthesisUtterance(string)

The SpeechSynthesisUtterance() constructor of the SpeechSynthesisUtterance interface returns a new SpeechSynthesisUtterance object instance.

public SpeechSynthesisUtterance(string text = null)

Parameters

text string

Remarks

Properties

Lang

The lang property of the SpeechSynthesisUtterance interface gets and sets the language of the utterance.

[Value("lang")]
public string Lang { get; set; }

Property Value

string

A string representing a BCP 47 language tag.

Remarks

If unset, the app's (i.e., the html lang value) lang will be used, or the user-agent default if that is unset too.

-Web Speech API

See also on MDN

Onboundary

[Value("onboundary")]
public EventHandlerNonNull Onboundary { get; set; }

Property Value

EventHandlerNonNull

Onend

[Value("onend")]
public EventHandlerNonNull Onend { get; set; }

Property Value

EventHandlerNonNull

Onerror

[Value("onerror")]
public EventHandlerNonNull Onerror { get; set; }

Property Value

EventHandlerNonNull

Onmark

[Value("onmark")]
public EventHandlerNonNull Onmark { get; set; }

Property Value

EventHandlerNonNull

Onpause

[Value("onpause")]
public EventHandlerNonNull Onpause { get; set; }

Property Value

EventHandlerNonNull

Onresume

[Value("onresume")]
public EventHandlerNonNull Onresume { get; set; }

Property Value

EventHandlerNonNull

Onstart

[Value("onstart")]
public EventHandlerNonNull Onstart { get; set; }

Property Value

EventHandlerNonNull

Pitch

The pitch property of the SpeechSynthesisUtterance interface gets and sets the pitch at which the utterance will be spoken at.

[Value("pitch")]
public Number Pitch { get; set; }

Property Value

Number

A float representing the pitch value.
It can range between 0 (lowest) and 2 (highest), with 1 being the default pitch for the current platform or voice. Some speech synthesis engines or voices may constrain the minimum and maximum rates further.
If SSML is used, this value will be overridden by prosody tags in the markup.

Remarks

If unset, a default value of 1 will be used.

-Web Speech API

See also on MDN

Rate

The rate property of the SpeechSynthesisUtterance interface gets and sets the speed at which the utterance will be spoken at.

[Value("rate")]
public Number Rate { get; set; }

Property Value

Number

A float representing the rate value.
It can range between 0.1 (lowest) and 10 (highest), with 1 being the default rate for the current platform or voice, which should correspond to a normal speaking rate.
Other values act as a percentage relative to this, so for example 2 is twice as fast, 0.5 is half as fast, etc.Some speech synthesis engines or voices may constrain the minimum and maximum rates further.
If SSML is used, this value will be overridden by prosody tags in the markup.

Remarks

If unset, a default value of 1 will be used.

-Web Speech API

See also on MDN

Text

The text property of the
SpeechSynthesisUtterance interface gets and sets the text that will be synthesized when the utterance is spoken.

[Value("text")]
public string Text { get; set; }

Property Value

string

A string representing the text to the synthesized.
The maximum length of the text that can be spoken in each utterance is 32,767 characters.

Remarks

The text may be provided as plain text, or a well-formed SSML document.
The SSML tags will be stripped away by devices that don't support SSML.

-Web Speech API

See also on MDN

Voice

The voice property of the SpeechSynthesisUtterance interface gets and sets the voice that will be used to speak the utterance.

[Value("voice")]
public SpeechSynthesisVoice? Voice { get; set; }

Property Value

SpeechSynthesisVoice

A SpeechSynthesisVoice object.

Remarks

This should be set to one of the SpeechSynthesisVoice objects returned by GetVoices().
If not set by the time the utterance is spoken, the voice used will be the most suitable default voice available for the utterance's Lang setting.

-Web Speech API

See also on MDN

Volume

The volume property of the SpeechSynthesisUtterance interface gets and sets the volume that the utterance will be spoken at.

[Value("volume")]
public Number Volume { get; set; }

Property Value

Number

A float that represents the volume value, between 0 (lowest) and 1 (highest.)If SSML is used, this value will be overridden by prosody tags in the markup.

Remarks

If not set, the default value 1 will be used.

-Web Speech API

See also on MDN