Last active
March 23, 2019 14:30
-
-
Save ilyas-shah/5e8d2658ff2203cc4cc68cfed0567300 to your computer and use it in GitHub Desktop.
Text to speech in Python using pyttsx3
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Install python, 3.xx recommended | |
# Run the following commands: | |
# pip install pyttsx3 | |
# save below code in a file and name as whatever you want. | |
# To run this code, type "python <your filename.py>" | |
# the above command will prompt to write something, once you write, press Enter | |
# and it will say the text you wrote. | |
# import library into code | |
# know about this library at: https://pyttsx.readthedocs.io/en/latest/ | |
import pyttsx3 | |
# Intialize library | |
engine = pyttsx3.init() | |
# raw_input is used to prompt user to write something on command line | |
text = raw_input("write something and I will say it -> \n") | |
engine.say(text) | |
engine.runAndWait() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment