SpeechSynthesizer class
Defines the class SpeechSynthesizer for text to speech. Updated in version 1.16.0
- Extends
Speech |
SpeechSynthesizer constructor. |
authorization |
Gets the authorization token used to communicate with the service. |
auto |
Indicates if auto detect source language is enabled |
bookmark |
Defines event handler for bookmark reached events Added in version 1.16.0 |
internal |
|
properties | The collection of properties and their values defined for this Synthesizer. |
Synthesis |
Defines event handler for synthesis cancelled events. |
synthesis |
Defines event handler for synthesis completed events. |
synthesis |
Defines event handler for synthesis start events. |
synthesizing | Defines event handler for synthesizing events. |
viseme |
Defines event handler for viseme received event Added in version 1.16.0 |
word |
Defines event handler for word boundary events |
close(() => void, (error: string) => void) | Dispose of associated resources. |
From |
SpeechSynthesizer constructor. |
get |
Get list of synthesis voices available. The task returns the synthesis voice result. |
speak |
Executes speech synthesis on SSML. The task returns the synthesis result. |
speak |
Executes speech synthesis on plain text. The task returns the synthesis result. |
build |
|
dispose(boolean) | This method performs cleanup of resources. The Boolean parameter disposing indicates whether the method is called from Dispose (if disposing is true) or from the finalizer (if disposing is false). Derived classes should override this method to dispose resource if needed. |
SpeechSynthesizer constructor.
new SpeechSynthesizer(speechConfig: SpeechConfig, audioConfig?: AudioConfig)
Parameters
- speechConfig
- SpeechConfig
An set of initial properties for this synthesizer.
- audioConfig
- AudioConfig
An optional audio configuration associated with the synthesizer.
Gets the authorization token used to communicate with the service.
string authorizationToken
Property Value
string
Authorization token.
Indicates if auto detect source language is enabled
boolean autoDetectSourceLanguage
Property Value
boolean
if auto detect source language is enabled
Defines event handler for bookmark reached events Added in version 1.16.0
public bookmarkReached: (sender: SpeechSynthesizer, event: SpeechSynthesisBookmarkEventArgs) => void
Property Value
(sender: SpeechSynthesizer, event: SpeechSynthesisBookmarkEventArgs) => void
object internalData
Property Value
object
The collection of properties and their values defined for this Synthesizer.
PropertyCollection properties
Property Value
The collection of properties and their values defined for this SpeechSynthesizer.
Defines event handler for synthesis cancelled events.
public SynthesisCanceled: (sender: SpeechSynthesizer, event: SpeechSynthesisEventArgs) => void
Property Value
(sender: SpeechSynthesizer, event: SpeechSynthesisEventArgs) => void
Defines event handler for synthesis completed events.
public synthesisCompleted: (sender: SpeechSynthesizer, event: SpeechSynthesisEventArgs) => void
Property Value
(sender: SpeechSynthesizer, event: SpeechSynthesisEventArgs) => void
Defines event handler for synthesis start events.
public synthesisStarted: (sender: SpeechSynthesizer, event: SpeechSynthesisEventArgs) => void
Property Value
(sender: SpeechSynthesizer, event: SpeechSynthesisEventArgs) => void
Defines event handler for synthesizing events.
public synthesizing: (sender: SpeechSynthesizer, event: SpeechSynthesisEventArgs) => void
Property Value
(sender: SpeechSynthesizer, event: SpeechSynthesisEventArgs) => void
Defines event handler for viseme received event Added in version 1.16.0
public visemeReceived: (sender: SpeechSynthesizer, event: SpeechSynthesisVisemeEventArgs) => void
Property Value
(sender: SpeechSynthesizer, event: SpeechSynthesisVisemeEventArgs) => void
Defines event handler for word boundary events
public wordBoundary: (sender: SpeechSynthesizer, event: SpeechSynthesisWordBoundaryEventArgs) => void
Property Value
(sender: SpeechSynthesizer, event: SpeechSynthesisWordBoundaryEventArgs) => void
Dispose of associated resources.
function close(cb?: () => void, err?: (error: string) => void)
Parameters
- cb
-
() => void
- err
-
(error: string) => void
SpeechSynthesizer constructor.
static function FromConfig(speechConfig: SpeechConfig, autoDetectSourceLanguageConfig: AutoDetectSourceLanguageConfig, audioConfig?: AudioConfig): SpeechSynthesizer
Parameters
- speechConfig
- SpeechConfig
an set of initial properties for this synthesizer
- autoDetectSourceLanguageConfig
- AutoDetectSourceLanguageConfig
An source language detection configuration associated with the synthesizer
- audioConfig
- AudioConfig
An optional audio configuration associated with the synthesizer
Returns
Get list of synthesis voices available. The task returns the synthesis voice result.
function getVoicesAsync(locale?: string): Promise<SynthesisVoicesResult>
Parameters
- locale
-
string
Locale of voices in BCP-47 format; if left empty, get all available voices.
Returns
Promise<SynthesisVoicesResult>
- Promise of a SynthesisVoicesResult.
speakSsmlAsync(string, (e: SpeechSynthesisResult) => void, (e: string) => void, PathLike | AudioOutputStream | PushAudioOutputStreamCallback)
Executes speech synthesis on SSML. The task returns the synthesis result.
function speakSsmlAsync(ssml: string, cb?: (e: SpeechSynthesisResult) => void, err?: (e: string) => void, stream?: PathLike | AudioOutputStream | PushAudioOutputStreamCallback)
Parameters
- ssml
-
string
SSML to be synthesized.
- cb
-
(e: SpeechSynthesisResult) => void
Callback that received the SpeechSynthesisResult.
- err
-
(e: string) => void
Callback invoked in case of an error.
- stream
-
PathLike | AudioOutputStream | PushAudioOutputStreamCallback
AudioOutputStream to receive the synthesized audio.
speakTextAsync(string, (e: SpeechSynthesisResult) => void, (e: string) => void, PathLike | AudioOutputStream | PushAudioOutputStreamCallback)
Executes speech synthesis on plain text. The task returns the synthesis result.
function speakTextAsync(text: string, cb?: (e: SpeechSynthesisResult) => void, err?: (e: string) => void, stream?: PathLike | AudioOutputStream | PushAudioOutputStreamCallback)
Parameters
- text
-
string
Text to be synthesized.
- cb
-
(e: SpeechSynthesisResult) => void
Callback that received the SpeechSynthesisResult.
- err
-
(e: string) => void
Callback invoked in case of an error.
- stream
-
PathLike | AudioOutputStream | PushAudioOutputStreamCallback
AudioOutputStream to receive the synthesized audio.
function buildSsml(text: string): string
Parameters
- text
-
string
Returns
string
Inherited From Synthesizer.buildSsml
This method performs cleanup of resources. The Boolean parameter disposing indicates whether the method is called from Dispose (if disposing is true) or from the finalizer (if disposing is false). Derived classes should override this method to dispose resource if needed.
function dispose(disposing: boolean): Promise<void>
Parameters
- disposing
-
boolean
Flag to request disposal.
Returns
Promise<void>
Inherited From Synthesizer.dispose