【问题标题】:Espeak phrase stops on the first word with osEspeak 短语在 os 的第一个单词处停止
【发布时间】:2016-05-15 23:51:07
【问题描述】:

为什么 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?\' ")

我必须做什么?

【问题讨论】:

    标签: python-3.x espeak


    【解决方案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 site

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

    这是工作代码:

    text = 'Do Androids Dream of Electric Sheep?'
    text = text.replace(' ', '_')
    os.system('.\\espeak.exe  -g 20 %(text)s'  % locals())
    

    【讨论】:

    • 非常有用
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2021-04-28
    • 2012-07-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-10-08
    相关资源
    最近更新 更多