Pyttsx 未在 Windows 10 上显示已安装的语言 [英] Pyttsx isn’t showing installed languages on windows 10
问题描述
我正在尝试使用 pyttsx3 说法语文本.但是,只有英语可用.
I am trying to use pyttsx3 to say French text. However, only English is available.
遵循如何在pyttsx3中改变声音的建议?,我尝试按照此处的说明安装法语语音包 https://support.office.com/en-us/article/how-to-download-text-to-speech-languages-for-windows-10-d5a6b612-b3ae-423f-afa5-4f6caf1ec5d3.
Following the advice of How to change the voice in pyttsx3?, I tried to install the French speech pack as explained here https://support.office.com/en-us/article/how-to-download-text-to-speech-languages-for-windows-10-d5a6b612-b3ae-423f-afa5-4f6caf1ec5d3.
我重新启动了我的计算机,现在安装了法语语音到文本模块,并在 Windows 设置的语音"菜单下可用.测试按钮起作用了,我听到了法语测试样本.
I restarted my computer and now have the French speech to text module installed and available under the "voice" menu in the windows settings. The test button works and I hear the test sample in French.
我尝试运行以下代码以查看 pyttsx3 可用的内容:
I tried to run the following code to see what pyttsx3 has available:
import pyttsx3
engine = pyttsx3.init()
voices = engine.getProperty('voices')
for voice in voices:
print(voice, voice.id)
engine.setProperty('voice', voice.id)
engine.say("Hello World!")
engine.runAndWait()
engine.stop()
但是,我只得到以下输出:
However, I just get the following output:
<Voice id=HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Speech\Voices\Tokens\TTS_MS_EN-US_ZIRA_11.0
name=Microsoft Zira Desktop - English (United States)
languages=[]
gender=None
age=None> HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Speech\Voices\Tokens\TTS_MS_EN-US_ZIRA_11.0
我错过了什么?
推荐答案
我通过执行那里描述的操作找到了一种解决方法:https://www.ghacks.net/2018/08/11/unlock-all-windows-10-tts-voices-system-wide-to-get-more-of-them/
I found a workaround by doing what is described there: https://www.ghacks.net/2018/08/11/unlock-all-windows-10-tts-voices-system-wide-to-get-more-of-them/
这是我遵循的步骤的摘要.假设您已经下载了原始问题中的语音包.
Here is a summary of the steps I followed. It assumes that you already have downloaded the voice packs as in the original question.
打开
regedit.exe
(Windows + R,然后键入 regedit)并导航到注册表项Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Speech_OneCore\Voices\Tokens代码>.
Open
regedit.exe
(Windows + R, and type regedit) and navigate to the Registry keyComputer\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Speech_OneCore\Voices\Tokens
.
右键单击要使用的语音并选择导出.
Right click on the voice you want to use and chose export.
使用文本编辑器(例如 Notepad++)打开导出的文件.
Open the exported file with a text editor (for example Notepad++).
第二次复制文件中的所有文本,这样您就可以将所有内容复制两次(除了第一行 Windows Registry Editor Version 5.00
).
Copy all the text a second time in the file so you have everything two times (except the first line Windows Registry Editor Version 5.00
).
在第一部分数据中,将\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Speech_OneCore\Voices\Tokens
替换为HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Speech\Voices\Tokens
(您必须在两个不同的地方执行此操作).
In the first part of the data, replace \HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Speech_OneCore\Voices\Tokens
by HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Speech\Voices\Tokens
(you have to do this at two distinct places).
在第二部分(您粘贴到下面的那个)中,对 HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\SPEECH\Voices\Tokens
执行相同操作,但要更改(同样,有两个地方需要改变).
In the second part (the one you pasted below), do the same but change for HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\SPEECH\Voices\Tokens
(again, two places to change).
保存文件,关闭它,然后双击它.接受注册表修改.
Save the file, close it, and double click it. Accept the registry modification.
重新启动计算机.
现在导出的声音可用于 pyttsx3!
Now the exported voices are available to use with pyttsx3!
这篇关于Pyttsx 未在 Windows 10 上显示已安装的语言的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!