SpeechSynthesizer Class

Definition

Performs speech synthesis to speaker, file, or other audio output streams, and gets synthesized audio as result. Added in version 1.7.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

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.

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.

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.

Applies to