Talking computers were on fire 20 to 30 years ago. Movies like War Games and TV series like Knight Rider featured electronics speaking to their human operators. Speak-n-Spell machines taught a generation of children. Then the magic was out of the bottle and the focus drifted to other technologies.
Today, we have a new explosion of voice enabled devices. They announced this week the Amazon Echo will read Kindle books You will see more devices speaking with the growth of the Internet of Things. Special speech systhesis chips of old are no longer required. The smallest of today's Linux computers often has the capabity to output speech. This includes the Raspberry Pi line of single board computers.
From the Raspberry Pi Zero to the A+/B+ to the Raspberry Pi 2, all have the capacity to run free software to turn text to speech.
This tutorial will show you how to have your Pi use the free software packages Festival and its derivative Flite to output voice.
Festival, written by The Centre for Speech Technology Research in the UK, offers a framework for building speech synthesis systems. It offers full text to speech through a number APIs: from shell level, via a command interpreter, as a C++ library, from Java, and an Emacs editor interface. Festival is multi-lingual (currently British English, American English, and Spanish. Other groups work to release new languages for the system. Festival is in the package manager for the Raspberry Pi making it very easy to install.
Flite is a lighter version of Festival built specifically for embedded systems. It has commands that make it easier to use than Festival on the command line. It runs faster than Festival so we have included as an optional bonus at the end of the tutorial. The downside to using Flite is that the current package as of April 2019 was not compiled correctly for Raspbian so it takes a few more minutes to get it up and running.
There are other speech programs that work well on Raspbian so if festival or flite do not meet your needs consider the following.
- multi-lingual software speech synthesizer
sudo apt-get install espeak
- converts text to audible speech
sudo apt-get install gnustep-gui-runtime
- sends text-to-speech output request to speech-dispatcher
sudo apt-get install speech-dispatcher