Skip to content
Advertisement

Pyttsx isn’t showing installed languages on windows 10

I am trying to use pyttsx3 to say French text. However, only English is available.

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.

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.

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_MACHINESOFTWAREMicrosoftSpeechVoicesTokensTTS_MS_EN-US_ZIRA_11.0
          name=Microsoft Zira Desktop - English (United States)
          languages=[]
          gender=None
          age=None> HKEY_LOCAL_MACHINESOFTWAREMicrosoftSpeechVoicesTokensTTS_MS_EN-US_ZIRA_11.0

What am I missing?

Advertisement

Answer

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.

  1. Open regedit.exe (Windows + R, and type regedit) and navigate to the Registry key ComputerHKEY_LOCAL_MACHINESOFTWAREMicrosoftSpeech_OneCoreVoicesTokens.

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

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

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

  5. In the first part of the data, replace HKEY_LOCAL_MACHINESOFTWAREMicrosoftSpeech_OneCoreVoicesTokensby HKEY_LOCAL_MACHINESOFTWAREMicrosoftSpeechVoicesTokens (you have to do this at two distinct places).

  6. In the second part (the one you pasted below), do the same but change for HKEY_LOCAL_MACHINESOFTWAREWOW6432NodeMicrosoftSPEECHVoicesTokens (again, two places to change).

  7. Save the file, close it, and double click it. Accept the registry modification.

  8. Restart your computer.

Now the exported voices are available to use with pyttsx3!

User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement