Skip to main content

Text-to-speech: give the robot a voice

Time: 10:15 AM to 10:55 AM
Your robot has a speaker, and now you are going to make it talk. You will test two different speech engines, add voice to your movement commands, and give the robot a custom startup message.

Test espeak

Run this directly in the terminal to hear your robot speak:
espeak "Hello, I am PiCar-X"
You should hear the robot speak through its onboard speaker.

Compare speech engines

Run the same sentence through both engines:
  • espeak - fast, robotic voice
  • Pico2Wave - slower, more natural-sounding voice
Notice the difference in quality. Each has trade-offs between speed and naturalness.

Voice Prompt Car

Run the Voice Prompt Car example:
sudo python3 voice_prompt_car.py
The robot announces each action before performing it. For example, it says “turning left” before actually turning.

Customize it

1

Custom startup message

Write a custom message that the robot speaks when the script starts.
2

Add voice to keyboard control

Modify the keyboard control script so the robot says the name of each direction it moves.
After this section, take a 10-minute break (10:55 AM to 11:05 AM).