5

我想用pyttsx3做一个新项目,但是我不能选择声音。一般来说,我需要一组俄语语音,所以我安装了 RHVoice 包,但该模块不想看到单个语音,只显示语言。请帮助,如何在linux上选择它们或正确配置它们?

我如何看待声音列表:

import pyttsx3

tts = pyttsx3.init()

voices = tts.getProperty('voices')
for voice in voices:
    print(voice.name)

输出此代码:

afrikaans
aragonese
bulgarian
bengali
bosnian
catalan
czech
welsh
danish
german
greek
default
english
en-scottish
english-north
english_rp
english_wmids
english-us
en-westindies
esperanto
spanish
spanish-latin-am
estonian
basque-test
Persian+English-UK
Persian+English-US
persian-pinglish
finnish
french-Belgium
french
irish-gaeilge
greek-ancient
gujarati-test
hindi
croatian
hungarian
armenian
armenian-west
interlingua
indonesian
icelandic
italian
lojban
georgian
kannada
kurdish
latin
lingua_franca_nova
lithuanian
latvian
macedonian
malayalam
malay
nepali
dutch
norwegian
punjabi
polish
brazil
portugal
romanian
russian
slovak
albanian
serbian
swedish
swahili-test
tamil
telugu-test
turkish
vietnam
vietnam_hue
vietnam_sgn
Mandarin
cantonese

我执行安装的视频。它是俄语的,但命令在描述中

更新

<Voice id=afrikaans
          name=afrikaans
          languages=[b'\x05af']
          gender=male
          age=None>
<Voice id=aragonese
          name=aragonese
          languages=[b'\x05an']
          gender=male
          age=None>
<Voice id=bulgarian
          name=bulgarian
          languages=[b'\x05bg']
          gender=None
          age=None>
<Voice id=bengali
          name=bengali
          languages=[b'\x05bn']
          gender=male
          age=None>
<Voice id=bosnian
          name=bosnian
          languages=[b'\x05bs']
          gender=male
          age=None>
<Voice id=catalan
          name=catalan
          languages=[b'\x05ca']
          gender=male
          age=None>
<Voice id=czech
          name=czech
          languages=[b'\x05cs']
          gender=male
          age=None>
<Voice id=welsh
          name=welsh
          languages=[b'\x05cy']
          gender=male
          age=None>
<Voice id=danish
          name=danish
          languages=[b'\x05da']
          gender=male
          age=None>
<Voice id=german
          name=german
          languages=[b'\x05de']
          gender=male
          age=None>
<Voice id=greek
          name=greek
          languages=[b'\x05el']
          gender=male
          age=None>
<Voice id=default
          name=default
          languages=[b'\x05en']
          gender=male
          age=None>
<Voice id=english
          name=english
          languages=[b'\x02en-gb']
          gender=male
          age=None>
<Voice id=en-scottish
          name=en-scottish
          languages=[b'\x05en-sc']
          gender=male
          age=None>
<Voice id=english-north
          name=english-north
          languages=[b'\x05en-uk-north']
          gender=male
          age=None>
<Voice id=english_rp
          name=english_rp
          languages=[b'\x05en-uk-rp']
          gender=male
          age=None>
<Voice id=english_wmids
          name=english_wmids
          languages=[b'\x05en-uk-wmids']
          gender=male
          age=None>
<Voice id=english-us
          name=english-us
          languages=[b'\x02en-us']
          gender=male
          age=None>
<Voice id=en-westindies
          name=en-westindies
          languages=[b'\x05en-wi']
          gender=male
          age=None>
<Voice id=esperanto
          name=esperanto
          languages=[b'\x05eo']
          gender=male
          age=None>
<Voice id=spanish
          name=spanish
          languages=[b'\x05es']
          gender=male
          age=None>
<Voice id=spanish-latin-am
          name=spanish-latin-am
          languages=[b'\x05es-la']
          gender=male
          age=None>
<Voice id=estonian
          name=estonian
          languages=[b'\x05et']
          gender=None
          age=None>
<Voice id=basque-test
          name=basque-test
          languages=[b'\x05eu']
          gender=None
          age=None>
<Voice id=Persian+English-UK
          name=Persian+English-UK
          languages=[b'\x05fa']
          gender=None
          age=None>
<Voice id=Persian+English-US
          name=Persian+English-US
          languages=[b'\x05fa']
          gender=None
          age=None>
<Voice id=persian-pinglish
          name=persian-pinglish
          languages=[b'\x05fa-pin']
          gender=None
          age=None>
<Voice id=finnish
          name=finnish
          languages=[b'\x05fi']
          gender=male
          age=None>
<Voice id=french-Belgium
          name=french-Belgium
          languages=[b'\x05fr-be']
          gender=male
          age=None>
<Voice id=french
          name=french
          languages=[b'\x05fr-fr']
          gender=male
          age=None>
<Voice id=irish-gaeilge
          name=irish-gaeilge
          languages=[b'\x05ga']
          gender=None
          age=None>
<Voice id=greek-ancient
          name=greek-ancient
          languages=[b'\x05grc']
          gender=male
          age=None>
<Voice id=gujarati-test
          name=gujarati-test
          languages=[b'\x05gu']
          gender=None
          age=None>
<Voice id=hindi
          name=hindi
          languages=[b'\x05hi']
          gender=male
          age=None>
<Voice id=croatian
          name=croatian
          languages=[b'\x05hr']
          gender=male
          age=None>
<Voice id=hungarian
          name=hungarian
          languages=[b'\x05hu']
          gender=male
          age=None>
<Voice id=armenian
          name=armenian
          languages=[b'\x05hy']
          gender=male
          age=None>
<Voice id=armenian-west
          name=armenian-west
          languages=[b'\x05hy-west']
          gender=male
          age=None>
<Voice id=interlingua
          name=interlingua
          languages=[b'\x05ia']
          gender=None
          age=None>
<Voice id=indonesian
          name=indonesian
          languages=[b'\x05id']
          gender=male
          age=None>
<Voice id=icelandic
          name=icelandic
          languages=[b'\x05is']
          gender=male
          age=None>
<Voice id=italian
          name=italian
          languages=[b'\x05it']
          gender=male
          age=None>
<Voice id=lojban
          name=lojban
          languages=[b'\x05jbo']
          gender=None
          age=None>
<Voice id=georgian
          name=georgian
          languages=[b'\x05ka']
          gender=None
          age=None>
<Voice id=kannada
          name=kannada
          languages=[b'\x05kn']
          gender=None
          age=None>
<Voice id=kurdish
          name=kurdish
          languages=[b'\x05ku']
          gender=male
          age=None>
<Voice id=latin
          name=latin
          languages=[b'\x05la']
          gender=male
          age=None>
<Voice id=lingua_franca_nova
          name=lingua_franca_nova
          languages=[b'\x05lfn']
          gender=male
          age=None>
<Voice id=lithuanian
          name=lithuanian
          languages=[b'\x05lt']
          gender=male
          age=None>
<Voice id=latvian
          name=latvian
          languages=[b'\x05lv']
          gender=male
          age=None>
<Voice id=macedonian
          name=macedonian
          languages=[b'\x05mk']
          gender=male
          age=None>
<Voice id=malayalam
          name=malayalam
          languages=[b'\x05ml']
          gender=male
          age=None>
<Voice id=malay
          name=malay
          languages=[b'\x05ms']
          gender=male
          age=None>
<Voice id=nepali
          name=nepali
          languages=[b'\x05ne']
          gender=male
          age=None>
<Voice id=dutch
          name=dutch
          languages=[b'\x05nl']
          gender=male
          age=None>
<Voice id=norwegian
          name=norwegian
          languages=[b'\x05no']
          gender=male
          age=None>
<Voice id=punjabi
          name=punjabi
          languages=[b'\x05pa']
          gender=None
          age=None>
<Voice id=polish
          name=polish
          languages=[b'\x05pl']
          gender=male
          age=None>
<Voice id=brazil
          name=brazil
          languages=[b'\x05pt-br']
          gender=male
          age=None>
<Voice id=portugal
          name=portugal
          languages=[b'\x05pt-pt']
          gender=male
          age=None>
<Voice id=romanian
          name=romanian
          languages=[b'\x05ro']
          gender=male
          age=None>
<Voice id=russian
          name=russian
          languages=[b'\x05ru']
          gender=male
          age=None>
<Voice id=slovak
          name=slovak
          languages=[b'\x05sk']
          gender=male
          age=None>
<Voice id=albanian
          name=albanian
          languages=[b'\x05sq']
          gender=male
          age=None>
<Voice id=serbian
          name=serbian
          languages=[b'\x05sr']
          gender=male
          age=None>
<Voice id=swedish
          name=swedish
          languages=[b'\x05sv']
          gender=male
          age=None>
<Voice id=swahili-test
          name=swahili-test
          languages=[b'\x05sw']
          gender=male
          age=None>
<Voice id=tamil
          name=tamil
          languages=[b'\x05ta']
          gender=male
          age=None>
<Voice id=telugu-test
          name=telugu-test
          languages=[b'\x05te']
          gender=None
          age=None>
<Voice id=turkish
          name=turkish
          languages=[b'\x05tr']
          gender=male
          age=None>
<Voice id=vietnam
          name=vietnam
          languages=[b'\x05vi']
          gender=male
          age=None>
<Voice id=vietnam_hue
          name=vietnam_hue
          languages=[b'\x05vi-hue']
          gender=male
          age=None>
<Voice id=vietnam_sgn
          name=vietnam_sgn
          languages=[b'\x05vi-sgn']
          gender=male
          age=None>
<Voice id=Mandarin
          name=Mandarin
          languages=[b'\x05zh']
          gender=male
          age=None>
<Voice id=cantonese
          name=cantonese
          languages=[b'\x05zh-yue']
          gender=male
          age=None>
4

1 回答 1

-1

我想说的是 Ubuntu 18.04 上的中文工作。我的声音和你一样。我用普通话说,它总是说“Chinese letter letter letter”。“信”字加起来与汉字num相同。每个人都知道如何在 Ubuntu 上说中文吗?

<Voice id=Mandarin
          name=Mandarin
          languages=[b'\x05zh']
          gender=male
          age=None>
<Voice id=cantonese
          name=cantonese
          languages=[b'\x05zh-yue']
          gender=male
          age=None>


import pyttsx3
engine = pyttsx3.init()
voices = engine.getProperty('voices')
for voice in voices:
    print(voice)
engine.setProperty('voice', 'zh')
engine.say("你好")
engine.runAndWait()

或者直接使用“espeak -v zh '你好'”

于 2021-07-21T07:59:50.667 回答