Search code examples
pythontextspeech

Text to Speech Library for Python using Windows 8.1 (SAPI)


I'm trying to create a simple program that will relay what I type as synthesized speech. I've tried pyttsx, it has been known to not work with python 3.x and it sure doesn't. I also tried using speech, but it interfered with the speech_recognition Library I'm using. I don't have any code to show since I don't even have a Library for it yet.

Running Python 3.4.2 32-bit on Windows 8.1 64-bit


Solution

  • According to this POST, considering that you are targeting the Windows platform, the following will work:

    import win32com.client
    speaker = win32com.client.Dispatch("SAPI.SpVoice")
    speaker.Speak("Hello, it works!")