Text to Speech in Python

I finally got around to looking at the Linux Voice 18 and I have to say, the Summer hacks section is really cool. I’ve always been curious about recompiling a kernel and playing around with the different settings, but the project that really caught my attention was the Python script that converted IRC chat into voice. That really just sounds like fun. So I tried going through with it, but ran into some issues with my Python versioning. And since I don’t really use IRC, I thought it might be fun to just whip up a quick script that converts whatever text is typed into the terminal into voice. It’s simple enough to do, so here it is!

from espeak import espeak
import time
while True:
response = input(">> ")


To install, make sure that the package espeak is installed. To install espeak, run:
sudo apt-get install espeak espeak-data
Then, to run the script, run
python3 scriptname.py
Here’s a link to the Gist

At some point, I think it’d be pretty cool to turn this into a Telegram Bot via their API. Maybe use this to convert all text into a voice (like Gigolo Joe’s “say” function), but it would also be cool to allow Telegram to convert something a user says into text.

Dylan Hildenbrand

ETH: 0xf9aa91a96bd04f037cb95a4158a8bdda5a921525

profile for Dylan Hildenbrand on Stack Exchange, a network of free, community-driven Q&A sites

Leave a Reply

Your email address will not be published. Required fields are marked *