内容表

上一话题

PySide2.QtTextToSpeech

下一话题

QTextToSpeechEngine

QTextToSpeech

QTextToSpeech class provides a convenient access to text-to-speech engines. 更多

Inheritance diagram of PySide2.QtTextToSpeech.QTextToSpeech

概要

函数

信号

静态函数

详细描述

使用 say() to start synthesizing text. It is possible to specify the language with setLocale() . To select between the available voices use setVoice() . The languages and voices depend on the available synthesizers on each platform. On Linux, speech-dispatcher 被使用默认情况下。

class QTextToSpeech ( [ parent=None ] )

QTextToSpeech(engine[, parent=None])

param parent

QObject

param engine

unicode

Loads a text-to-speech engine from a plug-in that uses the default engine plug-in and constructs a QTextToSpeech object as the child of parent .

The default engine may be platform-specific.

若插件加载失败, state() 返回 BackendError .

Loads a text-to-speech engine from a plug-in that matches parameter engine and constructs a QTextToSpeech object as the child of parent .

engine is empty, the default engine plug-in is used. The default engine may be platform-specific.

若插件加载失败, state() 返回 BackendError .

PySide2.QtTextToSpeech.QTextToSpeech. State

常量

描述

QTextToSpeech.Ready

The synthesizer is ready to start a new text. This is also the state after a text was finished.

QTextToSpeech.Speaking

The current text is being spoken.

QTextToSpeech.Paused

The synthesis was paused and can be resumed with resume() .

QTextToSpeech.BackendError

The backend was unable to synthesize the current string.

static PySide2.QtTextToSpeech.QTextToSpeech. availableEngines ( )
返回类型

字符串列表

Gets the list of supported text-to-speech engine plug-ins.

PySide2.QtTextToSpeech.QTextToSpeech. availableLocales ( )
返回类型

Gets a vector of locales that are currently supported.

注意

On some platforms these can change, for example, when the backend changes synthesizers.

PySide2.QtTextToSpeech.QTextToSpeech. availableVoices ( )
返回类型

Gets a vector of voices available for the current locale.

注意

if no locale has been set, the system locale is used.

PySide2.QtTextToSpeech.QTextToSpeech. locale ( )
返回类型

QLocale

另请参阅

setLocale()

PySide2.QtTextToSpeech.QTextToSpeech. localeChanged ( locale )
参数

locale QLocale

PySide2.QtTextToSpeech.QTextToSpeech. pause ( )

暂停当前语音。

注意:

  • This function depends on the platform and the backend. It may not work at all, it may take several seconds before it takes effect, or it may pause instantly. Some synthesizers will look for a break that they can later resume from, such as a sentence end.

  • Due to Android platform limitations, stops what is presently being said, while resume() starts the previously queued sentence from the beginning.

另请参阅

resume()

PySide2.QtTextToSpeech.QTextToSpeech. pitch ( )
返回类型

double

另请参阅

setPitch()

PySide2.QtTextToSpeech.QTextToSpeech. pitchChanged ( pitch )
参数

pitch double

PySide2.QtTextToSpeech.QTextToSpeech. rate ( )
返回类型

double

另请参阅

setRate()

PySide2.QtTextToSpeech.QTextToSpeech. rateChanged ( rate )
参数

rate double

PySide2.QtTextToSpeech.QTextToSpeech. resume ( )

Resume speaking after pause() has been called.

另请参阅

pause()

PySide2.QtTextToSpeech.QTextToSpeech. say ( text )
参数

text – unicode

Start synthesizing the text . This function will start the asynchronous reading of the text. The current state is available using the state property. Once the synthesis is done, a stateChanged() signal with the Ready state is emitted.

PySide2.QtTextToSpeech.QTextToSpeech. setLocale ( locale )
参数

locale QLocale

设置 locale to a given locale if possible. The default is the system locale.

另请参阅

locale()

PySide2.QtTextToSpeech.QTextToSpeech. setPitch ( pitch )
参数

pitch double

另请参阅

pitch()

PySide2.QtTextToSpeech.QTextToSpeech. setRate ( rate )
参数

rate double

另请参阅

rate()

PySide2.QtTextToSpeech.QTextToSpeech. setVoice ( voice )
参数

voice QVoice

设置 voice to use.

注意

On some platforms, setting the voice changes other voice attributes such as locale, pitch, and so on. These changes trigger the emission of signals.

另请参阅

voice()

PySide2.QtTextToSpeech.QTextToSpeech. setVolume ( volume )
参数

volume double

另请参阅

volume()

PySide2.QtTextToSpeech.QTextToSpeech. state ( )
返回类型

State

PySide2.QtTextToSpeech.QTextToSpeech. stateChanged ( state )
参数

state State

PySide2.QtTextToSpeech.QTextToSpeech. stop ( )

Stop the text that is being read.

PySide2.QtTextToSpeech.QTextToSpeech. voice ( )
返回类型

QVoice

另请参阅

setVoice()

PySide2.QtTextToSpeech.QTextToSpeech. voiceChanged ( voice )
参数

voice QVoice

PySide2.QtTextToSpeech.QTextToSpeech. volume ( )
返回类型

double

另请参阅

setVolume()

PySide2.QtTextToSpeech.QTextToSpeech. volumeChanged ( volume )
参数

volume double

PySide2.QtTextToSpeech.QTextToSpeech. volumeChanged ( volume )
参数

volume int