rany2 / edge-tts

Use Microsoft Edge's online text-to-speech service from Python WITHOUT needing Microsoft Edge or Windows or an API key
https://pypi.org/project/edge-tts/
GNU General Public License v3.0
5.45k stars 556 forks source link

Can only use one voice per gender #14

Closed Jay54520 closed 2 years ago

Jay54520 commented 2 years ago

Version: 5.0.0 Many languages can only use one voice per gender, for example, Chinese femal can only use zh-CN-XiaoxiaoNeural but can't use zh-CN-XiaoxuanNeural. Chinese male can only use zh-CN-YunyangNeural.

# Success
edge-playback --text "Hello, world!" --voice zh-CN-XiaoxiaoNeural
# Fail
$ edge-playback --text "Hello, world!" --voice zh-CN-XiaoxuanNeural

Media file: /tmp/tmpy3dtrfg6
Subtitle file: /tmp/tmphm0_zpim

Failed to recognize file format.

Exiting... (Errors when loading file)
rany2 commented 2 years ago

@Jay54520 I don't understand what you're trying to do

Edit: I think a code example or step by step instructions on what you're trying to do but failing at would help

Jay54520 commented 2 years ago

@Jay54520 I don't understand what you're trying to do

Edit: I think a code example or step by step instructions on what you're trying to do but failing at would help

I update above post by using commnad line instead of Python code so you can run it directly.

rany2 commented 2 years ago

@Jay54520 you got the voices wrong, there is no zh-CN-XiaoxuanNeural. Use edge-tts --list-voices to get a list of voices:

Name: Microsoft Server Speech Text to Speech Voice (zh-HK, HiuMaanNeural)
ShortName: zh-HK-HiuMaanNeural
Gender: Female
Locale: zh-HK

Name: Microsoft Server Speech Text to Speech Voice (zh-CN, XiaoxiaoNeural)
ShortName: zh-CN-XiaoxiaoNeural
Gender: Female
Locale: zh-CN

Name: Microsoft Server Speech Text to Speech Voice (zh-CN, XiaoyiNeural)
ShortName: zh-CN-XiaoyiNeural
Gender: Female
Locale: zh-CN

Name: Microsoft Server Speech Text to Speech Voice (zh-CN, YunjianNeural)
ShortName: zh-CN-YunjianNeural
Gender: Male
Locale: zh-CN

Name: Microsoft Server Speech Text to Speech Voice (zh-CN, YunxiNeural)
ShortName: zh-CN-YunxiNeural
Gender: Male
Locale: zh-CN

Name: Microsoft Server Speech Text to Speech Voice (zh-CN, YunxiaNeural)
ShortName: zh-CN-YunxiaNeural
Gender: Male
Locale: zh-CN

Name: Microsoft Server Speech Text to Speech Voice (zh-CN, YunyangNeural)
ShortName: zh-CN-YunyangNeural
Gender: Male
Locale: zh-CN

Name: Microsoft Server Speech Text to Speech Voice (zh-TW, HsiaoChenNeural)
ShortName: zh-TW-HsiaoChenNeural
Gender: Female
Locale: zh-TW
Jay54520 commented 2 years ago

Voices in your list can success. But there was zh-CN-XiaoxuanNeural and other voices before and you can see it in Official demo or use aspeak -t "Hello, world" -v zh-CN-XiaoxuanNeural in https://github.com/kxxt/aspeak

rany2 commented 2 years ago

@Jay54520 This is for the voices available in Microsoft Edge. Previously this library was able to access everything in Azure Cognitive Services but now Microsoft cracked down and it's limited to only the functions available in Edge.

Jay54520 commented 2 years ago

@Jay54520 This is for the voices available in Microsoft Edge. Previously this library was able to access everything in Azure Cognitive Services but now Microsoft cracked down and it's limited to only the functions available in Edge.

Got it. I thought this project only lacks Custom SSML before, now I know it can only achive funcitons in Edge.

rany2 commented 2 years ago

@Jay54520 It used to have these functions, I had to remove them because Microsoft cracked down and blocked it