SpeechSynthesizer Class

Definition

Performs speech synthesis to speaker, file, or other audio output streams, and gets synthesized audio as result. Updated in version 1.16.0

public class SpeechSynthesizer
Inheritance
java.lang.Object
Closeable
SpeechSynthesizer

Constructors

SpeechSynthesizer(SpeechConfig speechConfig)

Creates a new instance of Speech Synthesizer. Uses the default speaker on the system for audio output.

SpeechSynthesizer(SpeechConfig speechConfig, AudioConfig audioConfig)

Creates a new instance of Speech Synthesizer. If audioConfig is null, there is no audio output.

SpeechSynthesizer(SpeechConfig speechConfig, AutoDetectSourceLanguageConfig autoDetectSourceLangConfig, AudioConfig audioConfig)

Creates a new instance of Speech Synthesizer.

Fields

BookmarkReached

Defines event handler for bookmark reached event. Added in version 1.16.0

SynthesisCanceled

Defines event handler for synthesis canceled event.

SynthesisCompleted

Defines event handler for synthesis completed event.

SynthesisStarted

Defines event handler for synthesis started event.

Synthesizing

Defines event handler for synthesizing event.

VisemeReceived

Defines event handler for viseme received event. Added in version 1.16.0

WordBoundary

Defines event handler for word boundary event.

Methods

close()

Dispose of associated resources.

getAuthorizationToken()

Gets the authorization token used to communicate with the service.

getProperties()

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

getVoicesAsync()

Get the available voices, asynchronously. Added in version 1.16.0

getVoicesAsync(String locale)

Get the available voices, asynchronously. Added in version 1.16.0

setAuthorizationToken(String token)

Sets the authorization token used to communicate with the service. Note: The caller needs to ensure that the authorization token is valid. Before the authorization token expires, the caller needs to refresh it by calling this setter with a new valid token. Otherwise, the synthesizer will encounter errors while speech synthesis.

SpeakSsml(String ssml)

Execute the speech synthesis on SSML, synchronously.

SpeakSsmlAsync(String ssml)

Execute the speech synthesis on SSML, asynchronously.

SpeakText(String text)

Execute the speech synthesis on plain text, synchronously.

SpeakTextAsync(String text)

Execute the speech synthesis on plain text, asynchronously.

StartSpeakingSsml(String ssml)

Start the speech synthesis on SSML, synchronously.

StartSpeakingSsmlAsync(String ssml)

Start the speech synthesis on SSML, asynchronously.

StartSpeakingText(String text)

Start the speech synthesis on plain text, synchronously.

StartSpeakingTextAsync(String text)

Start the speech synthesis on plain text, asynchronously.

StopSpeakingAsync()

Stop the synthesis, asynchronously. This method will stop the playback and clear the unread data in PullAudioOutputStream. Added in version 1.14.0

Applies to