python 带有os库的python中的文本到语音(TTS)

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了python 带有os库的python中的文本到语音(TTS)相关的知识,希望对你有一定的参考价值。

import os
os.system('say "Beer time."')

/*FESTIVAL*/
system("festival " + arg)


/*ESPEAK/*
import os 
import datetime 
def tts(text): 
return os.system("espeak -s 155 -a 200 "+text+" " ) 
m = datetime.datetime.now().strftime("%I %M %S") 
tts("'Sir the time is"+str(int(m[0:2]))+" "+str(int(m[3:5]))+" : ' ") 

/*PYTTSX*/
$ sudo apt-get install sphinx2-bin libsphinx2-dev
 # enter your password when prompted 
$ python -i 
>>> import pyttsx 
>>> engine=pyttsx.init() 
>>> engine.say('Sally sells seashells by the seashore.') 
>>> engine.runAndWait()

以上是关于python 带有os库的python中的文本到语音(TTS)的主要内容,如果未能解决你的问题,请参考以下文章

Python的os库的使用

python os库的使用方法 + 自动化安装第三方库脚本

Pathlib模块

用 pyinstaller 打包含xpinyin 库的Python程序

Python比较文件差异,difflib类库的使用

Python基础编程——标准库之fileinput与time模块