SpeechSynthesizer class

Definition

A speech synthesizer.

SpeechSynthesizer(speech_config: azure.cognitiveservices.speech.SpeechConfig, audio_config: typing.Union[azure.cognitiveservices.speech.audio.AudioOutputConfig, NoneType] = 'None', auto_detect_source_language_config: typing.Union[azure.cognitiveservices.speech.languageconfig.AutoDetectSourceLanguageConfig, NoneType] = None)
Inheritance
builtins.object
SpeechSynthesizer

Parameters

speech_config

The config for the speech synthesizer

audio_config

The config for the audio output. This parameter is optional. If it is not provided, the default speaker device will be used for audio output. If it is None, the output audio will be dropped. None can be used for scenarios like performance test.

auto_detect_source_language_config

The auto detection source language config

Methods

speak_ssml

Performs synthesis on ssml in a blocking (synchronous) mode.

speak_ssml_async

Performs synthesis on ssml in a non-blocking (asynchronous) mode.

speak_text

Performs synthesis on plain text in a blocking (synchronous) mode.

speak_text_async

Performs synthesis on plain text in a non-blocking (asynchronous) mode.

start_speaking_ssml

Starts synthesis on ssml in a blocking (synchronous) mode.

start_speaking_ssml_async

Starts synthesis on ssml in a non-blocking (asynchronous) mode.

start_speaking_text

Starts synthesis on plain text in a blocking (synchronous) mode.

start_speaking_text_async

Starts synthesis on plain text in a non-blocking (asynchronous) mode.

speak_ssml

Performs synthesis on ssml in a blocking (synchronous) mode.

speak_ssml(ssml: str) -> azure.cognitiveservices.speech.SpeechSynthesisResult

Returns

A SpeechSynthesisResult.

speak_ssml_async

Performs synthesis on ssml in a non-blocking (asynchronous) mode.

speak_ssml_async(ssml: str) -> azure.cognitiveservices.speech.ResultFuture

Returns

A future with SpeechSynthesisResult.

speak_text

Performs synthesis on plain text in a blocking (synchronous) mode.

speak_text(text: str) -> azure.cognitiveservices.speech.SpeechSynthesisResult

Returns

A SpeechSynthesisResult.

speak_text_async

Performs synthesis on plain text in a non-blocking (asynchronous) mode.

speak_text_async(text: str) -> azure.cognitiveservices.speech.ResultFuture

Returns

A future with SpeechSynthesisResult.

start_speaking_ssml

Starts synthesis on ssml in a blocking (synchronous) mode.

start_speaking_ssml(ssml: str) -> azure.cognitiveservices.speech.SpeechSynthesisResult

Returns

A SpeechSynthesisResult.

start_speaking_ssml_async

Starts synthesis on ssml in a non-blocking (asynchronous) mode.

start_speaking_ssml_async(ssml: str) -> azure.cognitiveservices.speech.ResultFuture

Returns

A future with SpeechSynthesisResult.

start_speaking_text

Starts synthesis on plain text in a blocking (synchronous) mode.

start_speaking_text(text: str) -> azure.cognitiveservices.speech.SpeechSynthesisResult

Returns

A SpeechSynthesisResult.

start_speaking_text_async

Starts synthesis on plain text in a non-blocking (asynchronous) mode.

start_speaking_text_async(text: str) -> azure.cognitiveservices.speech.ResultFuture

Returns

A future with SpeechSynthesisResult.

Attributes

authorization_token

The authorization token that will be used for connecting to 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.

properties

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

synthesis_canceled

Signal for events indicating synthesis has been canceled.

Callbacks connected to this signal are called with a SpeechSynthesisEventArgs instance as the single argument.

synthesis_completed

Signal for events indicating synthesis has completed.

Callbacks connected to this signal are called with a SpeechSynthesisEventArgs instance as the single argument.

synthesis_started

Signal for events indicating synthesis has started.

Callbacks connected to this signal are called with a SpeechSynthesisEventArgs instance as the single argument.

synthesis_word_boundary

Signal for events indicating a word boundary.

Callbacks connected to this signal are called with a SpeechSynthesisWordBoundaryEventArgs instance as the single argument.

synthesizing

Signal for events indicating synthesis is ongoing.

Callbacks connected to this signal are called with a SpeechSynthesisEventArgs instance as the single argument.