Is there a way to use the Narrator Voice(Windows Acessibility) on text-to-speech code?

27 Views Asked by At

Just recently I rediscovered the Windows Narrator, something I knew of way back, but which now has the option to add natural voices.

Then I thought about a text-to-speech code I did some years back while learning, and tried to use it with these natural voices. I downloaded some other languages and natural voices, but I could not find them.

I used this code to print the voices.

import pyttsx3

def print_available_voices():
    engine = pyttsx3.init()
    voices = engine.getProperty('voices')
    for idx, voice in enumerate(voices):
        print(f"Voice {idx + 1}:")
        print(f" - ID: {voice.id}")
        print(f" - Name: {voice.name}")
        print(f" - Languages: {voice.languages}")
        print(f" - Gender: {voice.gender}")
        print("")

def main():
    print("Available Voices:")
    print("-----------------")
    print_available_voices()
    print("-----------------")
    

if __name__ == "__main__":
    main()

It still shows some voices, but those look like the ones that came with the language pack.

Through some research I found that pyttsx3 can only access the voices at HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Speech\Voices\Tokens\

And the natural voices appear to be at HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Speech_OneCore\Voices\Tokens\

So, I was wondering if it was possible to manually change it, preferably without having to mess with the registry.

Also, I don't particularly need to use pyttsx3, if other text-to-speech lib can solve the problem and it doesn't sound strange, that's good enough for me.

0

There are 0 best solutions below