首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >将法语口音与pyttsx一起使用

将法语口音与pyttsx一起使用
EN

Stack Overflow用户
提问于 2017-10-26 20:28:03
回答 1查看 2.3K关注 0票数 1

我正在尝试使用pyttsx进行文本到语音的转换。我想让它告诉法国人“é”:

代码语言:javascript
复制
# -*- 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()
EN

回答 1

Stack Overflow用户

发布于 2018-07-13 00:10:30

我尝试使用pyttsx3,因为它是我安装的。它在python2.7下运行。

这是代码(对我来说法语语音是0)。只需给字符串加上前缀u(表示unicode)就行了。

代码语言:javascript
复制
# -*- 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()    
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/46954342

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档