python文本转语音
Text to speech model is a small application or bot which converts the given text into speech.
文本到语音模型是将给定文本转换为语音的小型应用程序或漫游器。
The module that we use for text to speech conversion: pyttsx3
我们用于文本到语音转换的模块: pyttsx3
pyttsx3 is a text-to-speech conversion library in Python. It is very easy to use tool which converts the entered text into speech.
pyttsx3是Python中的文本到语音转换库。 这是非常容易使用的工具,可以将输入的文本转换为语音。
Download the module:
下载模块:
pip install pyttsx3 (In your terminal or command prompt)
If you are using Pycharm User: Go to the project interpreter and install the module.
如果您使用的是Pycharm用户:转到项目解释器并安装模块。
The various functions that we will use in this model are,
我们将在此模型中使用的各种功能是:
engine=pyttsx3.init(): The init function is the main function, we have to use this function every time. This function initializes the connection and creates an engine and we can perform all the things on the engine created by the .init() function
engine = pyttsx3.init() :init函数是主要函数,我们必须每次都使用此函数。 该函数初始化连接并创建引擎,我们可以在由.init()函数创建的引擎上执行所有操作
engine.say(text): This function will convert the text to speech (text is the input from the user)
engine.say(text) :此函数会将文本转换为语音(文本是用户的输入)
engine.runAndWait(): This function will make the speech audible in the system, if you don't write this command then the speech will not be audible to you.
engine.runAndWait() :此函数将使语音在系统中可听见,如果您不编写此命令,则您将听不到语音。
engine.setProperty(): This method sets different properties of the model.
engine.setProperty(