A quick project to convert text files to speech.
A best practice in Python is to not "pollute" your entire workspace with Python modules. Instead, segregate them per project. Accordingly, set up and activate a virtual environment.
$ virtualenv .venv
$.venv/Scripts/activate.bat
Install the Google text to speech API.
pip install gTTS
Run the app.
python demo.py
When you are finished, exit the virtual environment.
deactivate
I started out with the Google text to speech API but the win32com.client sounds more like AudioGhost.
pip install pypiwin32
Code
import win32com.client
speaker = win32com.client.Dispatch("SAPI.SpVoice")
while 1:
print("Enter the word you want to speak")
s = input()
speaker.Speak(s)
# Stop with CTRL + Z