class SpeechSynthesizer

class SpeechSynthesizer
  : public std::enable_shared_from_this< SpeechSynthesizer >

Class for speech synthesizer. Updated in version 1.13.0

Members

Properties

Syntax: public PropertyCollection & Properties;

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

SynthesisStarted

Syntax: public EventSignal< const SpeechSynthesisEventArgs & > SynthesisStarted;

The event signals that a speech synthesis result is received when the synthesis just started.

Synthesizing

Syntax: public EventSignal< const SpeechSynthesisEventArgs & > Synthesizing;

The event signals that a speech synthesis result is received while the synthesis is on going.

SynthesisCompleted

Syntax: public EventSignal< const SpeechSynthesisEventArgs & > SynthesisCompleted;

The event signals that a speech synthesis result is received when the synthesis completed.

SynthesisCanceled

Syntax: public EventSignal< const SpeechSynthesisEventArgs & > SynthesisCanceled;

The event signals that a speech synthesis result is received when the synthesis is canceled.

WordBoundary

Syntax: public EventSignal< const SpeechSynthesisWordBoundaryEventArgs & > WordBoundary;

The event signals that a speech synthesis word boundary is received while the synthesis is on going. Added in version 1.7.0

SpeakText

Syntax: public inline std::shared_ptr< SpeechSynthesisResult > SpeakText ( const std::string & text );

Execute the speech synthesis on plain text, synchronously.

Parameters

  • text The plain text for synthesis.

Returns

A smart pointer wrapping a speech synthesis result.

SpeakText

Syntax: public inline std::shared_ptr< SpeechSynthesisResult > SpeakText ( const std::wstring & text );

Execute the speech synthesis on plain text, synchronously. Added in 1.9.0

Parameters

  • text The plain text for synthesis.

Returns

A smart pointer wrapping a speech synthesis result.

SpeakSsml

Syntax: public inline std::shared_ptr< SpeechSynthesisResult > SpeakSsml ( const std::string & ssml );

Execute the speech synthesis on SSML, synchronously.

Parameters

  • ssml The SSML for synthesis.

Returns

A smart pointer wrapping a speech synthesis result.

SpeakSsml

Syntax: public inline std::shared_ptr< SpeechSynthesisResult > SpeakSsml ( const std::wstring & ssml );

Execute the speech synthesis on SSML, synchronously. Added in version 1.9.0

Parameters

  • ssml The SSML for synthesis.

Returns

A smart pointer wrapping a speech synthesis result.

SpeakTextAsync

Syntax: public inline std::future< std::shared_ptr< SpeechSynthesisResult > > SpeakTextAsync ( const std::string & text );

Execute the speech synthesis on plain text, asynchronously.

Parameters

  • text The plain text for synthesis.

Returns

An asynchronous operation representing the synthesis. It returns a value of SpeechSynthesisResult as result.

SpeakTextAsync

Syntax: public inline std::future< std::shared_ptr< SpeechSynthesisResult > > SpeakTextAsync ( const std::wstring & text );

Execute the speech synthesis on plain text, asynchronously. Added in version 1.9.0

Parameters

  • text The plain text for synthesis.

Returns

An asynchronous operation representing the synthesis. It returns a value of SpeechSynthesisResult as result.

SpeakSsmlAsync

Syntax: public inline std::future< std::shared_ptr< SpeechSynthesisResult > > SpeakSsmlAsync ( const std::string & ssml );

Execute the speech synthesis on SSML, asynchronously.

Parameters

  • ssml The SSML for synthesis.

Returns

An asynchronous operation representing the synthesis. It returns a value of SpeechSynthesisResult as result.

SpeakSsmlAsync

Syntax: public inline std::future< std::shared_ptr< SpeechSynthesisResult > > SpeakSsmlAsync ( const std::wstring & ssml );

Execute the speech synthesis on SSML, asynchronously. Added in version 1.9.0

Parameters

  • ssml The SSML for synthesis.

Returns

An asynchronous operation representing the synthesis. It returns a value of SpeechSynthesisResult as result.

StartSpeakingText

Syntax: public inline std::shared_ptr< SpeechSynthesisResult > StartSpeakingText ( const std::string & text );

Start the speech synthesis on plain text, synchronously.

Parameters

  • text The plain text for synthesis.

Returns

A smart pointer wrapping a speech synthesis result.

StartSpeakingText

Syntax: public inline std::shared_ptr< SpeechSynthesisResult > StartSpeakingText ( const std::wstring & text );

Start the speech synthesis on plain text, synchronously. Added in version 1.9.0

Parameters

  • text The plain text for synthesis.

Returns

A smart pointer wrapping a speech synthesis result.

StartSpeakingSsml

Syntax: public inline std::shared_ptr< SpeechSynthesisResult > StartSpeakingSsml ( const std::string & ssml );

Start the speech synthesis on SSML, synchronously.

Parameters

  • ssml The SSML for synthesis.

Returns

A smart pointer wrapping a speech synthesis result.

StartSpeakingSsml

Syntax: public inline std::shared_ptr< SpeechSynthesisResult > StartSpeakingSsml ( const std::wstring & ssml );

Start the speech synthesis on SSML, synchronously. Added in version 1.9.0

Parameters

  • ssml The SSML for synthesis.

Returns

A smart pointer wrapping a speech synthesis result.

StartSpeakingTextAsync

Syntax: public inline std::future< std::shared_ptr< SpeechSynthesisResult > > StartSpeakingTextAsync ( const std::string & text );

Start the speech synthesis on plain text, asynchronously.

Parameters

  • text The plain text for synthesis.

Returns

An asynchronous operation representing the synthesis. It returns a value of SpeechSynthesisResult as result.

StartSpeakingTextAsync

Syntax: public inline std::future< std::shared_ptr< SpeechSynthesisResult > > StartSpeakingTextAsync ( const std::wstring & text );

Start the speech synthesis on plain text, asynchronously. Added in version 1.9.0

Parameters

  • text The plain text for synthesis.

Returns

An asynchronous operation representing the synthesis. It returns a value of SpeechSynthesisResult as result.

StartSpeakingSsmlAsync

Syntax: public inline std::future< std::shared_ptr< SpeechSynthesisResult > > StartSpeakingSsmlAsync ( const std::string & ssml );

Start the speech synthesis on SSML, asynchronously.

Parameters

  • ssml The SSML for synthesis.

Returns

An asynchronous operation representing the synthesis. It returns a value of SpeechSynthesisResult as result.

StartSpeakingSsmlAsync

Syntax: public inline std::future< std::shared_ptr< SpeechSynthesisResult > > StartSpeakingSsmlAsync ( const std::wstring & ssml );

Start the speech synthesis on SSML, asynchronously. Added in version 1.9.0

Parameters

  • ssml The SSML for synthesis.

Returns

An asynchronous operation representing the synthesis. It returns a value of SpeechSynthesisResult as result.

SetAuthorizationToken

Syntax: public inline void SetAuthorizationToken ( const std::string & token );

Sets 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. Added in version 1.7.0

Parameters

  • token The authorization token.

GetAuthorizationToken

Syntax: public inline std::string GetAuthorizationToken ( ) const;

Gets the authorization token. Added in version 1.7.0

Returns

Authorization token

~SpeechSynthesizer

Syntax: public inline ~SpeechSynthesizer ( );

Destructor.

FromConfig

Syntax: public inline static std::shared_ptr< SpeechSynthesizer > FromConfig ( std::shared_ptr< SpeechConfig > speechconfig , std::nullptr_t );

Create a speech synthesizer from a speech config.

Parameters

  • speechconfig Speech configuration.

Returns

A smart pointer wrapped speech synthesizer pointer.

FromConfig

Syntax: public inline static std::shared_ptr< SpeechSynthesizer > FromConfig ( std::shared_ptr< SpeechConfig > speechconfig , std::shared_ptr< Audio::AudioConfig > audioconfig );

Create a speech synthesizer from a speech config and audio config.

Parameters

  • speechconfig Speech configuration.

  • audioconfig Audio configuration.

Returns

A smart pointer wrapped speech synthesizer pointer.

FromConfig

Syntax: public inline static std::shared_ptr< SpeechSynthesizer > FromConfig ( std::shared_ptr< SpeechConfig > speechconfig , std::shared_ptr< AutoDetectSourceLanguageConfig > autoDetectSourceLangConfig , std::shared_ptr< Audio::AudioConfig > audioconfig );

Create a speech synthesizer from a speech config, auto detection source language config and audio config Added in 1.13.0

Parameters

  • speechconfig Speech configuration.

  • autoDetectSourceLangConfig Auto detection source language config.

  • audioconfig Audio configuration.

Returns

A smart pointer wrapped speech synthesizer pointer.