相关疑难解决方法(0)

Python中的Python文本到语音

Python中是否有任何库使用Mac Lion的内置文本到语音引擎来实现或允许文本到语音转换?我做谷歌,但大多数是基于Windows的.我试过pyttx.我试着跑

import pyttsx
engine = pyttsx.init()
engine.say('Sally sells seashells by the seashore.')
engine.say('The quick brown fox jumped over the lazy dog.')
engine.runAndWait()
Run Code Online (Sandbox Code Playgroud)

但是我得到了这些错误

File "/Users/manabchetia/Documents/Codes/Speech.py", line 2, in <module>
    engine = pyttsx.init()
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pyttsx-1.0.egg/pyttsx/__init__.py", line 39, in init
    eng = Engine(driverName, debug)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pyttsx-1.0.egg/pyttsx/engine.py", line 45, in __init__
    self.proxy = driver.DriverProxy(weakref.proxy(self), driverName, debug)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pyttsx-1.0.egg/pyttsx/driver.py", line 64, in __init__
    self._module = __import__(name, globals(), locals(), [driverName])
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pyttsx-1.0.egg/pyttsx/drivers/nsss.py", line 18, in <module>
ImportError: No module named Foundation
Run Code Online (Sandbox Code Playgroud)

我该如何解决这些错误?

python macos text-to-speech

8
推荐指数
2
解决办法
2万
查看次数

如何使用 python pyttsx3 和 sapi5 将文本文件转换为 mp3 文件?

这是我的python代码..

import pyttsx3;
engine = pyttsx3.init(driverName='sapi5')
infile = "tanjil.txt"
f = open(infile, 'r')
theText = f.read()
f.close()
engine.say(theText)
engine.runAndWait()
Run Code Online (Sandbox Code Playgroud)

我无法将文件保存为音频文件

python

2
推荐指数
3
解决办法
8548
查看次数

在python中使用PYTTSX模块更改语音

在python中使用Pyttsx模块时,如何更改播放文本时使用的语音ID?

提供的文档说明了如何循环使用所有可用的声音,但没有说明如何选择特定的声音.

python voice

0
推荐指数
2
解决办法
1万
查看次数

标签 统计

python ×3

macos ×1

text-to-speech ×1

voice ×1