SpeechSynthesizer class

Warning

This API is now deprecated.

Defines the class SpeechSynthesizer for text to speech. Updated in version 1.16.0

Extends

Constructors

SpeechSynthesizer(SpeechConfig, AudioConfig)

SpeechSynthesizer constructor.

Properties

authorizationToken

Gets the authorization token used to communicate with the service.

autoDetectSourceLanguage

Indicates if auto detect source language is enabled

bookmarkReached

Defines event handler for bookmark reached events Added in version 1.16.0

internalData
properties

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

SynthesisCanceled

Defines event handler for synthesis cancelled events.

synthesisCompleted

Defines event handler for synthesis completed events.

synthesisStarted

Defines event handler for synthesis start events.

synthesizing

Defines event handler for synthesizing events.

visemeReceived

Defines event handler for viseme received event Added in version 1.16.0

wordBoundary

Defines event handler for word boundary events

Methods

close(() => void, (error: string) => void)

Dispose of associated resources.

FromConfig(SpeechConfig, AutoDetectSourceLanguageConfig, AudioConfig)

SpeechSynthesizer constructor.

getVoicesAsync(string)

Get list of synthesis voices available. The task returns the synthesis voice result.

speakSsmlAsync(string, (e: SpeechSynthesisResult) => void, (e: string) => void, PathLike | AudioOutputStream | PushAudioOutputStreamCallback)

Executes speech synthesis on SSML. The task returns the synthesis result.

speakTextAsync(string, (e: SpeechSynthesisResult) => void, (e: string) => void, PathLike | AudioOutputStream | PushAudioOutputStreamCallback)

Executes speech synthesis on plain text. The task returns the synthesis result.

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

SpeechSynthesizer(SpeechConfig, AudioConfig)

Warning

This API is now deprecated.

SpeechSynthesizer constructor.

new SpeechSynthesizer(speechConfig: SpeechConfig, audioConfig?: AudioConfig)

Parameters

speechConfig
SpeechConfig

An set of initial properties for this synthesizer.

audioConfig
AudioConfig

An optional audio configuration associated with the synthesizer.

Property Details

authorizationToken

Warning

This API is now deprecated.

Gets the authorization token used to communicate with the service.

string authorizationToken

Property Value

string

Authorization token.

autoDetectSourceLanguage

Warning

This API is now deprecated.

Indicates if auto detect source language is enabled

boolean autoDetectSourceLanguage

Property Value

boolean

if auto detect source language is enabled

bookmarkReached

Warning

This API is now deprecated.

Defines event handler for bookmark reached events Added in version 1.16.0

public bookmarkReached: (sender: SpeechSynthesizer, event: SpeechSynthesisBookmarkEventArgs) => void

Property Value

(sender: SpeechSynthesizer, event: SpeechSynthesisBookmarkEventArgs) => void

internalData

Warning

This API is now deprecated.

object internalData

Property Value

object

properties

Warning

This API is now deprecated.

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.

SynthesisCanceled

Warning

This API is now deprecated.

Defines event handler for synthesis cancelled events.

public SynthesisCanceled: (sender: SpeechSynthesizer, event: SpeechSynthesisEventArgs) => void

Property Value

(sender: SpeechSynthesizer, event: SpeechSynthesisEventArgs) => void

synthesisCompleted

Warning

This API is now deprecated.

Defines event handler for synthesis completed events.

public synthesisCompleted: (sender: SpeechSynthesizer, event: SpeechSynthesisEventArgs) => void

Property Value

(sender: SpeechSynthesizer, event: SpeechSynthesisEventArgs) => void

synthesisStarted

Warning

This API is now deprecated.

Defines event handler for synthesis start events.

public synthesisStarted: (sender: SpeechSynthesizer, event: SpeechSynthesisEventArgs) => void

Property Value

(sender: SpeechSynthesizer, event: SpeechSynthesisEventArgs) => void

synthesizing

Warning

This API is now deprecated.

Defines event handler for synthesizing events.

public synthesizing: (sender: SpeechSynthesizer, event: SpeechSynthesisEventArgs) => void

Property Value

(sender: SpeechSynthesizer, event: SpeechSynthesisEventArgs) => void

visemeReceived

Warning

This API is now deprecated.

Defines event handler for viseme received event Added in version 1.16.0

public visemeReceived: (sender: SpeechSynthesizer, event: SpeechSynthesisVisemeEventArgs) => void

Property Value

(sender: SpeechSynthesizer, event: SpeechSynthesisVisemeEventArgs) => void

wordBoundary

Warning

This API is now deprecated.

Defines event handler for word boundary events

public wordBoundary: (sender: SpeechSynthesizer, event: SpeechSynthesisWordBoundaryEventArgs) => void

Property Value

(sender: SpeechSynthesizer, event: SpeechSynthesisWordBoundaryEventArgs) => void

Method Details

close(() => void, (error: string) => void)

Warning

This API is now deprecated.

Dispose of associated resources.

function close(cb?: () => void, err?: (error: string) => void)

Parameters

cb

() => void

err

(error: string) => void

FromConfig(SpeechConfig, AutoDetectSourceLanguageConfig, AudioConfig)

Warning

This API is now deprecated.

SpeechSynthesizer constructor.

static function FromConfig(speechConfig: SpeechConfig, autoDetectSourceLanguageConfig: AutoDetectSourceLanguageConfig, audioConfig?: AudioConfig): SpeechSynthesizer

Parameters

speechConfig
SpeechConfig

an set of initial properties for this synthesizer

autoDetectSourceLanguageConfig
AutoDetectSourceLanguageConfig

An source language detection configuration associated with the synthesizer

audioConfig
AudioConfig

An optional audio configuration associated with the synthesizer

Returns

getVoicesAsync(string)

Warning

This API is now deprecated.

Get list of synthesis voices available. The task returns the synthesis voice result.

function getVoicesAsync(locale?: string): Promise<SynthesisVoicesResult>

Parameters

locale

string

Locale of voices in BCP-47 format; if left empty, get all available voices.

Returns

  • Promise of a SynthesisVoicesResult.

speakSsmlAsync(string, (e: SpeechSynthesisResult) => void, (e: string) => void, PathLike | AudioOutputStream | PushAudioOutputStreamCallback)

Warning

This API is now deprecated.

Executes speech synthesis on SSML. The task returns the synthesis result.

function speakSsmlAsync(ssml: string, cb?: (e: SpeechSynthesisResult) => void, err?: (e: string) => void, stream?: PathLike | AudioOutputStream | PushAudioOutputStreamCallback)

Parameters

ssml

string

SSML to be synthesized.

cb

(e: SpeechSynthesisResult) => void

Callback that received the SpeechSynthesisResult.

err

(e: string) => void

Callback invoked in case of an error.

stream

PathLike | AudioOutputStream | PushAudioOutputStreamCallback

AudioOutputStream to receive the synthesized audio.

speakTextAsync(string, (e: SpeechSynthesisResult) => void, (e: string) => void, PathLike | AudioOutputStream | PushAudioOutputStreamCallback)

Warning

This API is now deprecated.

Executes speech synthesis on plain text. The task returns the synthesis result.

function speakTextAsync(text: string, cb?: (e: SpeechSynthesisResult) => void, err?: (e: string) => void, stream?: PathLike | AudioOutputStream | PushAudioOutputStreamCallback)

Parameters

text

string

Text to be synthesized.

cb

(e: SpeechSynthesisResult) => void

Callback that received the SpeechSynthesisResult.

err

(e: string) => void

Callback invoked in case of an error.

stream

PathLike | AudioOutputStream | PushAudioOutputStreamCallback

AudioOutputStream to receive the synthesized audio.

Inherited Method Details

buildSsml(string)

Warning

This API is now deprecated.

function buildSsml(text: string): string

Parameters

text

string

Returns

string

Inherited From Synthesizer.buildSsml

dispose(boolean)

Warning

This API is now deprecated.

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