How could I make Python say some text?
I could use Festival with subprocess but I won't be able to control it (or maybe in interactive mode, but it won't be clean).
Is there a Python TTS library? Like an API for Festival, eSpeak, ... ?
There are several APIs available to convert text to speech in Python. One of such APIs is the Google Text to Speech API commonly known as the gTTS API. gTTS is a very easy to use tool which converts the text entered, into audio which can be saved as a mp3 file.
Speech recognition is a machine's ability to listen to spoken words and identify them. You can then use speech recognition in Python to convert the spoken words into text, make a query or give a reply. You can even program some devices to respond to these spoken words.
You should try using the PyTTSx package since PyTTS is outdated. PyTTSx works with Python 2. For Python 3, install the PyTTSx3 package.
http://pypi.python.org/pypi/pyttsx/
https://pypi.org/project/pyttsx3/
A bit cheesy, but if you use a mac you can pass a terminal command to the console from python.
Try typing the following in the terminal:
$ say 'hello world'
And there will be a voice from the mac that will speak that. From python such a thing is relatively easy:
import os os.system("echo 'hello world'") os.system("say 'hello world'")
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With