0

I was having problem with my pyttsx3 not showing some installed languages.

So I followed this solution:

Open regedit.exe (Windows + R, and type regedit) and navigate to the Registry key Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Speech_OneCore\Voices\Tokens.

Right click on the voice you want to use and chose export.

Open the exported file with a text editor (for example Notepad++).

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).

In the first part of the data, replace \HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Speech_OneCore\Voices\Tokensby HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Speech\Voices\Tokens (you have to do this at two distinct places).

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.

Restart your computer.


But to my surprised, after restarting my pc, after trying some basic test code from this library, I am getting errors and I have no idea what went wrong or how to fix it. There is my code (basic test, worked before I followed the sollution up here)

import pyttsx3

engine = pyttsx3.init()

engine.say("Hello world")
engine.runAndWait()
voices = engine.getProperty('voices')
for voice in voices:
    print("Voice: %s" % voice.name)
    print(" - ID: %s" % voice.id)
    print(" - Languages: %s" % voice.languages)
    print(" - Gender: %s" % voice.gender)
    print(" - Age: %s" % voice.age)
    print("\n")

Well after following the solution up, all I get is error message:

Traceback (most recent call last):
  File "C:\Users\Esmessica\Desktop\file_folder\main.py", line 6, in <module>
    voices = engine.getProperty('voices')
  File "C:\Users\Esmessica\Desktop\file_folder\venv\lib\site-packages\pyttsx3\engine.py", line 146, in getProperty
    return self.proxy.getProperty(name)
  File "C:\Users\Esmessica\Desktop\file_folder\venv\lib\site-packages\pyttsx3\driver.py", line 173, in getProperty
    return self._driver.getProperty(name)
  File "C:\Users\Esmessica\Desktop\file_folder\venv\lib\site-packages\pyttsx3\drivers\sapi5.py", line 88, in getProperty
    return [self._toVoice(attr) for attr in self._tts.GetVoices()]
  File "C:\Users\Esmessica\Desktop\file_folder\venv\lib\site-packages\pyttsx3\drivers\sapi5.py", line 88, in <listcomp>
    return [self._toVoice(attr) for attr in self._tts.GetVoices()]
  File "C:\Users\Esmessica\Desktop\file_folder\venv\lib\site-packages\pyttsx3\drivers\sapi5.py", line 77, in _toVoice
    return Voice(attr.Id, attr.GetDescription())
_ctypes.COMError: (-2147200966, None, (None, None, None, 0, None))

Process finished with exit code 1

I don't know how to solve this or how did it even happened. Probably something wrong with registries? I never worked with registries or with this library so I am sorry if my question is kind of amateur.

0 Answers0