Skip to content
Mark Niemann-Ross edited this page Jan 9, 2017 · 8 revisions

Architecture of Text-to-speech

Text-to-speech on the fish involves several steps:

  1. Obtain a string to speak
  2. Convert the string to an audio file
  3. Play the audio file

These steps should happen asynchronously. That is:

  1. Any program, at any time, should be able to request speech
  2. Converting text to an audio file shouldn't block anything else
  3. Playing back the sound should be FIFO. The second sound in the queue shouldn't play until the first is finished.
  4. There should be a way to dump the queue or set a priority. (to come if necessary)

To implement this, I'm going to try SQLite. A record will look like:

  • UID - unique id
  • creation date of record - second sort
  • priority - first sort
  • string to be spoken
  • BLOB - wav file to be spoken

The process is broken into three parts:

  1. bmbb_fish.fishSays - queue speech requests to SQLite. Two arguments: priority and phrase
  2. do_TTS.py & - sweeps SQLite for phrases that need to be converted to audio, handles the conversion, then inserts the BLOB into the record
  3. speakNextPhrase.py & - pulls the next phrase from SQLite and plays it. When that phrase is finished, delete it from SQLite and get the next phrase. If there are no phrases to speak, then wait until there are.

notes on microsoft bing Text-to-speech

Microsoft Bing Text-to-speech

subscription keys here

github sample code

attempts with espeak

sudo apt-get install espeak

If you are using python 2

wget https://pypi.python.org/packages/source/p/pyttsx/pyttsx-1.1.tar.gz
gunzip pyttsx-1.1.tar.gz
tar -xf pyttsx-1.1.tar
cd pyttsx-1.1/
sudo python setup.py install

If you are using python 3

sudo apt-get install python3-pip   (this may not be necessary python)
sudo pip install pyttsx

or

wget https://bootstrap.pypa.io/ez_setup.py -O - | sudo python3
wget https://pypi.python.org/packages/source/p/pyttsx/pyttsx-1.1.tar.gz
gunzip pyttsx-1.1.tar.gz
tar -xf pyttsx-1.1.tar
cd pyttsx-1.1/
sudo python3 setup.py install