0

为什么 espeak 看不懂长行短语?

text = "Do Androids Dream of Electric Sheep?"

os.system('.\\espeak.exe %(text)s' % locals())

而我只有“Do ...”,这里也一样:

os.system(".\\espeak.exe \'Do Androids Dream of Electric Sheep?\' ")

我必须做什么?

4

1 回答 1

1

我尝试了以下方式,它对我有用。我正在使用Windows 2013Python 2.7

我们需要用'_'(下划线)连接单词。不知何故,使用空格的单词分隔似乎会导致问题。

text = "Do Androids Dream of Electric Sheep?"  #Your original text
text = text.replace(" ", "_")                  #join words with underscore
os.system('.\\espeak.exe %(text)s' % locals()) #speak words

编辑 实际上,跟随比仅仅在单词之间引入特殊字符(如“,”或“_”)效果更好。

来自 eSpeak 网站

-g 字间距。此选项在单词之间插入停顿。该值是暂停的长度,以 10 毫秒为单位(默认速度为 170 wpm)。

这是工作代码:

text = 'Do Androids Dream of Electric Sheep?'
text = text.replace(' ', '_')
os.system('.\\espeak.exe  -g 20 %(text)s'  % locals())
于 2016-05-16T13:49:55.273 回答