Want your Raspberry Pi to speak to you? Try installing eSpeak on it. It’s a lightweight text-to-speech program that can easily be installed on your Raspberry Pi system and help you convert your Pi into a talking robot. It reads the commands and text from a file and speaks in different languages, including English, French, Dutch and more.
This article will show you how you can install eSpeak on a Raspberry Pi system and make your Raspberry Pi speak.
Make Your Raspberry Pi Speak
eSpeak is already available in the default system repository and you can apply the following command to install it on the Raspberry Pi system.
You can also install the eSpeak Python utility from the following command, as it allows you to import eSpeak in your Python code.
Once the installation is done, follow the below-given command to make your Raspberry Pi speak:
If you want your Raspberry Pi to read text from a file, you can use the following command:
Note: You must connect the speaker to your Raspberry Pi device, or you can use Android mobile as your Raspberry Pi speakers by following the guidelines here to listen to the audio played from your Raspberry Pi device.
For different voices selection, you can use the following command:
For speaking in the different programming languages, just follow the below-given syntax:
In my case, I am using the Romanian language “ro” as an example.
eSpeak Using Python
You can also make your Raspberry Pi speak from the Python code. For this purpose, you first have to run Python on the Raspberry Pi terminal using the following command:
Then import the eSpeak library using the following code:
Once the library is imported, you can run the following code to make Raspberry Pi speak:
Remove eSpeak from Raspberry Pi
You can remove eSpeak, and eSpeak python module from the Raspberry Pi system using the following command:
Conclusion
eSpeak is a speech-to-text program that can convert Raspberry Pi into a talking machine. The apt package manager can install the program on Raspberry Pi. After the installation, you must enter the text with the “espeak” command or use the Python code to make Raspberry Pi speak. You can also allow Raspberry Pi to read text from a source file or use different languages for speaking.