SpeechSynthesizer Class
Definition
Performs speech synthesis to speaker, file, or other audio output streams, and gets synthesized audio as result. Note: close() must be called in order to release underlying resources held by the object. Updated in version 1.16.0
public class SpeechSynthesizer
- Inheritance
-
java.lang.ObjectAutoCloseableSpeechSynthesizer
Constructors
| SpeechSynthesizer(EmbeddedSpeechConfig embeddedSpeechConfig) |
Creates a new instance of Speech Synthesizer for embedded speech synthesis. Uses the default speaker on the system for audio output. Added in version 1.19.0 |
| SpeechSynthesizer(EmbeddedSpeechConfig embeddedSpeechConfig, AudioConfig audioConfig) |
Creates a new instance of Speech Synthesizer for embedded speech synthesis. If audioConfig is null, there is no audio output. Added in version 1.19.0 |
| 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 |