4 Make Python Talk

In this chapter, you’ll learn how to make Python talk back to you in a human voice. You’ll first install the text-to-speech module based on your operating system and then teach Python to speak aloud whatever you enter on your computer. You’ll also add the speech recognition feature you learned in Chapter 3 and get Python to repeat your own speech. Finally, you’ll build a real-world application to use voice inputs to ask Python to calculate the area of a rectangle and tell you the answer in a human voice.

To save space, you’ll put all text-to-speech-related code in a self-made module. Once you do that, you can import the ...

Get Make Python Talk now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.