Switching Voice Notifications To Ivona

ivonaI had long used the unofficial Google speech API for voice notifications (TTS) as it has a very good, clear voice, much better than Festival which I had used previously. However late one night a couple of months ago this stopped working as Google started to redirect it to a captcha if you tried access it directly. That’s fair enough I suppose, it’s their service to do with what they like and it was never even advertised as a publicly available API for this purpose so all of us who were using it were on a free ride. I’m sure there will be ways around this but it got me looking at alternatives again.

This lead me to Ivona which is a speech synthesis system originally developed by a Polish company but is now owned by Amazon. Using their beta Speech Cloud service you can get a free account for “development purposes” which allows you to make 50,000 requests per month. I don’t know about you but that is more than enough for me.

My speech notifications originate from several sources but primarily they come from Node-RED which runs on my Debian server and this does not have an audio output connected into my whole house audio system. To get around this I run a small Python script on my always on Xubuntu desktop PC that performs a few functions by subscribing to various MQTT topics, one of which is generating speech. This script also links MQTT to an LED matrix display connected via serial and provides a system for playing sounds, eg. send a payload of redalert.mp3 to the topic notify/sound to get a Star Trek TNG red alert sound. It also allows me to control the master volume via MQTT and operate some basic media player controls.

Integrating Ivona speech into this was easy thanks to the Pyvona Python wrapper for Ivona.

Installing Pyvona is easy:

  1. Make sure you have the requests and pygame packages installed
  2. Clone the Pyvona Github
  3. Run python setup.py install

To use it at its simplest you just need to do:

import pyvona
v = pyvona.create_voice(‘access_key’, ‘secret_key’)
v.speak(‘Hello world’)

Changing the access_key and secret_key for the ones you will get from the Credentials section of your free Ivona account.

You can also specify which Amazon data centre to use, setting it to the nearest one for the lowest latency:

v.region = ‘eu-west’

You can also select which of the many Ivona voices to use:

v.voice_name = ‘Salli’

I’ve uploaded my mqtt.py script to Github here, it’s pretty specific to my requirements but may be of use as a starting point for others.

 

One thought on “Switching Voice Notifications To Ivona

Leave a Reply

Your email address will not be published. Required fields are marked *

Notify me of followup comments via e-mail. You can also subscribe without commenting.