共用方式為


SpeechSynthesizer class

定義語音轉換文字的SpeechSynthesizer類別。 在 1.16.0 版中更新

Extends

建構函式

SpeechSynthesizer(SpeechConfig, null | AudioConfig)

SpeechSynthesizer 建構函式。

屬性

authorizationToken

取得用來與服務通訊的授權令牌。

autoDetectSourceLanguage

指出是否已啟用自動偵測來源語言

bookmarkReached

定義已加入 1.16.0 版中已加入書籤事件的事件處理程式

internalData
properties

針對這個合成器定義的屬性及其值集合。

SynthesisCanceled

定義合成已取消事件的事件處理程式。

synthesisCompleted

定義合成已完成事件的事件處理程式。

synthesisStarted

定義合成啟動事件的事件處理程式。

synthesizing

定義用於合成事件的事件處理程式。

visemeReceived

定義viseme接收事件在1.16.0版中新增的事件處理程式

wordBoundary

定義字邊界事件的事件處理程式

方法

close(() => void, (error: string) => void)

處置相關聯的資源。

FromConfig(SpeechConfig, AutoDetectSourceLanguageConfig, null | AudioConfig)

SpeechSynthesizer 建構函式。

getVoicesAsync(string)

取得可用的合成語音清單。 工作會傳回合成語音結果。

speakSsmlAsync(string, (e: SpeechSynthesisResult) => void, (e: string) => void, PathLike | AudioOutputStream | PushAudioOutputStreamCallback)

在 SSML 上執行語音合成。 工作會傳回合成結果。

speakTextAsync(string, (e: SpeechSynthesisResult) => void, (e: string) => void, PathLike | AudioOutputStream | PushAudioOutputStreamCallback)

在純文字上執行語音合成。 工作會傳回合成結果。

繼承的方法

buildSsml(string)
dispose(boolean)

這個方法會執行資源的清除。 布爾參數處置會指出方法是從 Dispose 呼叫(如果 disposing 為 true),還是從完成項呼叫 (如果 disposing 為 false)。 衍生類別應該覆寫此方法,視需要處置資源。

建構函式詳細資料

SpeechSynthesizer(SpeechConfig, null | AudioConfig)

SpeechSynthesizer 建構函式。

new SpeechSynthesizer(speechConfig: SpeechConfig, audioConfig?: null | AudioConfig)

參數

speechConfig
SpeechConfig

這個合成器的初始屬性集。

audioConfig

null | AudioConfig

與合成器相關聯的選擇性音訊組態。

屬性詳細資料

authorizationToken

取得用來與服務通訊的授權令牌。

string authorizationToken

屬性值

string

授權令牌。

autoDetectSourceLanguage

指出是否已啟用自動偵測來源語言

boolean autoDetectSourceLanguage

屬性值

boolean

如果已啟用自動偵測來源語言,則為

bookmarkReached

定義已加入 1.16.0 版中已加入書籤事件的事件處理程式

public bookmarkReached: (sender: SpeechSynthesizer, event: SpeechSynthesisBookmarkEventArgs) => void

屬性值

(sender: SpeechSynthesizer, event: SpeechSynthesisBookmarkEventArgs) => void

internalData

object internalData

屬性值

object

properties

針對這個合成器定義的屬性及其值集合。

PropertyCollection properties

屬性值

針對這個SpeechSynthesizer定義的屬性及其值集合。

SynthesisCanceled

定義合成已取消事件的事件處理程式。

public SynthesisCanceled: (sender: SpeechSynthesizer, event: SpeechSynthesisEventArgs) => void

屬性值

(sender: SpeechSynthesizer, event: SpeechSynthesisEventArgs) => void

synthesisCompleted

定義合成已完成事件的事件處理程式。

public synthesisCompleted: (sender: SpeechSynthesizer, event: SpeechSynthesisEventArgs) => void

屬性值

(sender: SpeechSynthesizer, event: SpeechSynthesisEventArgs) => void

synthesisStarted

定義合成啟動事件的事件處理程式。

public synthesisStarted: (sender: SpeechSynthesizer, event: SpeechSynthesisEventArgs) => void

屬性值

(sender: SpeechSynthesizer, event: SpeechSynthesisEventArgs) => void

synthesizing

定義用於合成事件的事件處理程式。

public synthesizing: (sender: SpeechSynthesizer, event: SpeechSynthesisEventArgs) => void

屬性值

(sender: SpeechSynthesizer, event: SpeechSynthesisEventArgs) => void

visemeReceived

定義viseme接收事件在1.16.0版中新增的事件處理程式

public visemeReceived: (sender: SpeechSynthesizer, event: SpeechSynthesisVisemeEventArgs) => void

屬性值

(sender: SpeechSynthesizer, event: SpeechSynthesisVisemeEventArgs) => void

wordBoundary

定義字邊界事件的事件處理程式

public wordBoundary: (sender: SpeechSynthesizer, event: SpeechSynthesisWordBoundaryEventArgs) => void

屬性值

(sender: SpeechSynthesizer, event: SpeechSynthesisWordBoundaryEventArgs) => void

方法詳細資料

close(() => void, (error: string) => void)

處置相關聯的資源。

function close(cb?: () => void, err?: (error: string) => void)

參數

cb

() => void

err

(error: string) => void

FromConfig(SpeechConfig, AutoDetectSourceLanguageConfig, null | AudioConfig)

SpeechSynthesizer 建構函式。

static function FromConfig(speechConfig: SpeechConfig, autoDetectSourceLanguageConfig: AutoDetectSourceLanguageConfig, audioConfig?: null | AudioConfig): SpeechSynthesizer

參數

speechConfig
SpeechConfig

這個合成器的初始屬性集

autoDetectSourceLanguageConfig
AutoDetectSourceLanguageConfig

與合成器相關聯的來源語言偵測組態

audioConfig

null | AudioConfig

與合成器相關聯的選擇性音訊組態

傳回

getVoicesAsync(string)

取得可用的合成語音清單。 工作會傳回合成語音結果。

function getVoicesAsync(locale?: string): Promise<SynthesisVoicesResult>

參數

locale

string

BCP-47 格式的語音地區設定;如果保留空白,請取得所有可用的語音。

傳回

  • SynthesisVoicesResult 的承諾。

speakSsmlAsync(string, (e: SpeechSynthesisResult) => void, (e: string) => void, PathLike | AudioOutputStream | PushAudioOutputStreamCallback)

在 SSML 上執行語音合成。 工作會傳回合成結果。

function speakSsmlAsync(ssml: string, cb?: (e: SpeechSynthesisResult) => void, err?: (e: string) => void, stream?: PathLike | AudioOutputStream | PushAudioOutputStreamCallback)

參數

ssml

string

要合成的 SSML。

cb

(e: SpeechSynthesisResult) => void

接收 SpeechSynthesisResult 的回呼。

err

(e: string) => void

發生錯誤時叫用回呼。

stream

PathLike | AudioOutputStream | PushAudioOutputStreamCallback

要接收合成音訊的 AudioOutputStream。

speakTextAsync(string, (e: SpeechSynthesisResult) => void, (e: string) => void, PathLike | AudioOutputStream | PushAudioOutputStreamCallback)

在純文字上執行語音合成。 工作會傳回合成結果。

function speakTextAsync(text: string, cb?: (e: SpeechSynthesisResult) => void, err?: (e: string) => void, stream?: PathLike | AudioOutputStream | PushAudioOutputStreamCallback)

參數

text

string

要合成的文字。

cb

(e: SpeechSynthesisResult) => void

接收 SpeechSynthesisResult 的回呼。

err

(e: string) => void

發生錯誤時叫用回呼。

stream

PathLike | AudioOutputStream | PushAudioOutputStreamCallback

要接收合成音訊的 AudioOutputStream。

繼承的方法的詳細資料

buildSsml(string)

function buildSsml(text: string): string

參數

text

string

傳回

string

繼承自合成器.buildSsml

dispose(boolean)

這個方法會執行資源的清除。 布爾參數處置會指出方法是從 Dispose 呼叫(如果 disposing 為 true),還是從完成項呼叫 (如果 disposing 為 false)。 衍生類別應該覆寫此方法,視需要處置資源。

function dispose(disposing: boolean): Promise<void>

參數

disposing

boolean

要求處置的旗標。

傳回

Promise<void>

繼承自合成器.dispose