AvatarSynthesizer class

Defines the avatar synthesizer.

Extends

Constructors

AvatarSynthesizer(SpeechConfig, AvatarConfig)

Creates and initializes an instance of this class.

Properties

authorizationToken

Gets the authorization token used to communicate with the service.

autoDetectSourceLanguage

Indicates if auto detect source language is enabled

avatarEventReceived

Defines event handler for avatar events.

iceServers

Gets the ICE servers. Internal use only.

properties

The collection of properties and their values defined for this Synthesizer.

Methods

close()

Dispose of associated resources.

speakSsmlAsync(string)

Speaks SSML asynchronously. The rendered audio and video will be sent via the WebRTC connection.

speakTextAsync(string)

Speaks plain text asynchronously. The rendered audio and video will be sent via the WebRTC connection.

startAvatarAsync(RTCPeerConnection)

Starts the talking avatar session and establishes the WebRTC connection.

stopAvatarAsync()

Stops the talking avatar session and closes the WebRTC connection. For now, this is the same as close(). You need to create a new AvatarSynthesizer instance to start a new session.

stopSpeakingAsync()

Speaks text asynchronously. The avatar will switch to idle state.

Inherited Methods

buildSsml(string)
dispose(boolean)

This method performs cleanup of resources. The Boolean parameter disposing indicates whether the method is called from Dispose (if disposing is true) or from the finalizer (if disposing is false). Derived classes should override this method to dispose resource if needed.

Constructor Details

AvatarSynthesizer(SpeechConfig, AvatarConfig)

Creates and initializes an instance of this class.

new AvatarSynthesizer(speechConfig: SpeechConfig, avatarConfig: AvatarConfig)

Parameters

speechConfig
SpeechConfig

The speech config.

avatarConfig
AvatarConfig

The talking avatar config.

Property Details

authorizationToken

Gets the authorization token used to communicate with the service.

string authorizationToken

Property Value

string

Authorization token.

autoDetectSourceLanguage

Indicates if auto detect source language is enabled

boolean autoDetectSourceLanguage

Property Value

boolean

if auto detect source language is enabled

avatarEventReceived

Defines event handler for avatar events.

public avatarEventReceived: (sender: AvatarSynthesizer, event: AvatarEventArgs) => void

Property Value

(sender: AvatarSynthesizer, event: AvatarEventArgs) => void

iceServers

Gets the ICE servers. Internal use only.

RTCIceServer[] iceServers

Property Value

RTCIceServer[]

properties

The collection of properties and their values defined for this Synthesizer.

PropertyCollection properties

Property Value

The collection of properties and their values defined for this SpeechSynthesizer.

Method Details

close()

Dispose of associated resources.

function close(): Promise<void>

Returns

Promise<void>

speakSsmlAsync(string)

Speaks SSML asynchronously. The rendered audio and video will be sent via the WebRTC connection.

function speakSsmlAsync(ssml: string): Promise<SynthesisResult>

Parameters

ssml

string

The SSML text to speak.

Returns

Promise<SynthesisResult>

The promise of the synthesis result.

speakTextAsync(string)

Speaks plain text asynchronously. The rendered audio and video will be sent via the WebRTC connection.

function speakTextAsync(text: string): Promise<SynthesisResult>

Parameters

text

string

The plain text to speak.

Returns

Promise<SynthesisResult>

The promise of the synthesis result.

startAvatarAsync(RTCPeerConnection)

Starts the talking avatar session and establishes the WebRTC connection.

function startAvatarAsync(peerConnection: RTCPeerConnection): Promise<SynthesisResult>

Parameters

peerConnection

RTCPeerConnection

The peer connection.

Returns

Promise<SynthesisResult>

The promise of the connection result.

stopAvatarAsync()

Stops the talking avatar session and closes the WebRTC connection. For now, this is the same as close(). You need to create a new AvatarSynthesizer instance to start a new session.

function stopAvatarAsync(): Promise<void>

Returns

Promise<void>

The promise of the void result.

stopSpeakingAsync()

Speaks text asynchronously. The avatar will switch to idle state.

function stopSpeakingAsync(): Promise<void>

Returns

Promise<void>

The promise of the void result.

Inherited Method Details

buildSsml(string)

function buildSsml(text: string): string

Parameters

text

string

Returns

string

Inherited From Synthesizer.buildSsml

dispose(boolean)

This method performs cleanup of resources. The Boolean parameter disposing indicates whether the method is called from Dispose (if disposing is true) or from the finalizer (if disposing is false). Derived classes should override this method to dispose resource if needed.

function dispose(disposing: boolean): Promise<void>

Parameters

disposing

boolean

Flag to request disposal.

Returns

Promise<void>

Inherited From Synthesizer.dispose