【问题标题】:using french accent with pyttsx使用带有 pyttsx 的法语口音
【发布时间】:2018-07-13 00:10:30
【问题描述】:

我正在尝试将 pyttsx 用于文本转语音。我想让它告诉法国人“é”:

# -*- coding: utf8 -*-

import pyttsx
engine = pyttsx.init()
voice = engine.getProperty('voices')[26] # the french voice
engine.setProperty('voice', voice.id)

engine.say('Je lui ai dit, fait gaffe a ton nez') # perfect

engine.say('Tu as bien mangé?') # not saying anything

engine.runAndWait()

【问题讨论】:

    标签: python-2.7 pyttsx french


    【解决方案1】:

    我尝试使用 pyttsx3,因为它是我安装的。它在 python 2.7 下运行。

    这是代码(对我来说法语是 0)。只需在字符串前面加上 u(对于 unicode)就可以了。

    # -*- coding: utf8 -*
    import pyttsx3
    engine = pyttsx3.init()
    voice = engine.getProperty('voices')[0] # the french voice
    engine.setProperty('voice', voice.id)
    
    engine.say('Je lui ai dit, fait gaffe a ton nez') # perfect
    
    engine.say(u'Tu as bien mangé?') # it works!!
    
    engine.runAndWait()    
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-03-08
      • 2018-09-20
      • 2019-01-30
      • 1970-01-01
      • 2013-01-31
      • 2014-04-23
      相关资源
      最近更新 更多