oktober 30, 2015

How your rabbit speaks (using Text To Speech)

Note this: TTS from Acapela is not allowed since 8 december 2016. See this blogpost for more information.

In this post, I will try to explain how your Karotz can talk, that is changing Text To Speech (TTS).

When you enter text and submit it to your Karotz, it is not changing it into speech by itself. Instead, it is using a service from a company called Acapela. They are specialized in Text to Speech (TTS). On their website, you'll find a form where you can enter text and hear different voices speaking your text. In fact, even your rabbit is using this same form!

When you installed the script mentioned in step 6 of the install instructions, you have changed a file called "tts.inc". This file contains all the magic to translate text into speech.

After you have submitted your text to your rabbit, your Karotz is sending a request to the webform on the Acapela website, asking to translate text into speech. Acapela is responding with a new form containing a link to a (MP3) file. The script is reading the link, and makes a second call to fetch the MP3. If this was successful, it will play the MP3 and you'll hear your text spoken by your rabbit.

On the Acapela site, there are much more voices than the web interface of your Karotz shows you. I wanted a Belgium Female voice (called Zoe), and tried to feed a link generated by Acapela directly to my second Karotz.

However, I only heard a French voice instead of Zoe. What was happening? I didn't apply step 6. And when you don't apply the updated "tts.inc", your Karotz is using its own version of "tts.inc" and calls a webservice on OpenKarotz (http://ws.openkarotz.org/tts.php) instead of Acapela. This service sits between your Karotz and Acapela, and will send your request to Acapela. I decided to apply step 6 letting my Karotz call Acapela directly. After this, I could hear my rabbit talk with a Belgium voice.

So, if you want to give your Karotz all the Acapela voices, follow these steps:

  • Apply step 6 of the install instructions: replace file "tts.inc" in "/usr/www/cgi-bin" with the one mentioned in step 6.
  • Edit file "voice_list" in "/usr/www/cgi-bin" and add other voices. I added { "id":"Zoe","lang":"nl" }. If you add a line at the end of the list, don't forget to add a comma to the entry above the one you add.
  • See if you have extra voices in the web interface of your rabbit and try them out!

Have fun!

Leave a message