Last updated on December 11th, 2020 at 02:06 pm
If you want to tame your Alexa using graphical interface and TTS (text to speech) – this video is for you.
In this article I will show you how you can easily interact with the Alexa APIs. We will play a little bit with TTS & SSML. Don’t worry no coding skills are required.
If you don’t want to read then watch the video below!
SSML is a markup language that provides a standard way to mark up text for the generation of synthetic speech. The Alexa Skills Kit supports a subset of the tags defined in the SSML specification.
You may want a longer pause within the speech, or you may want a string of digits to be read as a standard telephone number or maybe you want to make Alexa to whisper like in the beginning of the video and so on so on.
The things that you need to complete this How-To are:
- Working Node-Red installation or Docker client
- Alexa device – Link
- Comment and share this article in your favourite social media (just kidding)
If you already have working Node-RED you can skip the “Steps with Docker” and go straight to “Steps in Node-RED” header.
Steps with Docker
After successful installation of the Docker client open a terminal/console/command prompt (whatever you like to name it).
To run Node-RED in Docker just type the following and don’t forget the -p 3456:3456 option, because it is very important for the Alexa API authentication:
docker run -it -p 1880:1880 -p 3456:3456 --name mynodered nodered/node-red
After successful execution of the above command you should have something similar in the console.
Now you can open the URL http://127.0.0.1:1880 (or whatever your IP and port is) in a browser. If you see the Node-RED dashboard you can continue happily ahead.
Steps in Node-RED
Open the “Manage palette” from the Node-RED menu in the upper right corner. In “Install” tab search for the following modules/plugins and install them:
- node-red-dashboard – This module provides a set of nodes in Node-RED to quickly create a live data dashboard. If you wish to learn more, check the GitHub page of the project.
- node-red-contrib-alexa-remote2 – which is node-red nodes for interacting with Alexa. Again If you wish to learn more, this is the GitHub page of the project.
Go to this page and copy one of the examples let’s say the 1. Alexa Speak Dashboard is a good for a start – link
Import the example using the Node-RED menu by pasting the copied text there and by click on the “import” button.
Double click on the nodes with the red triangle in their upper right corner
Click on the pencil button next to the “Add new alexa-remote-account…” label and…
Be careful here from this configuration more or less depends your success with enabling of the Alexa Text-To-Speach.
You want to double check the following things:
This IP field should be the IP where the Node-RED is installed. This maybe is the localhost or maybe it is different IP. If it’s different change it.
The Port should match the port in the Docker command. Remember the “-p 3456:3456” option. Most of the time you shouldn’t have to change this, so you can leave it like that.
File Path is the place where you should type something/anything, meaningful to you like “authFile”. The plugin will create a file with that name and inside the file, it will store your encrypted Amazon credentials. This is needed because otherwise it will ask you to re-login every time you re-deploy your Node-RED flow.
Service Host and Page
Then you want to change Service Host and Page depending of your location and the table below.
Have in mind that there are some cases when everything seems to be OK, there is no errors anywhere, but Alexa don’t want to speak at all. And the reason for this on all of the cases was the Service Host and Page.
Some nice guys from India manage to make this work by typing alexa.amazon.it and amazon.it as their Service Host and Page. And it worked for some reason. So if you face similar issue try change them one by one.
After you change the above things hit the “Deploy” button and if there is no errors, you should see something similar:
Open a new browser/tab and type the localhost:3456 or Whatever_your_IP_is:3456. Now you should see the amazon alexa sign-in page. And you should enter your Amazon credentials.
After you do that you will see a welcoming green ready under your Alexa nodes like this
Testing the Alexa TTS in the Node-RED dashboard
And the final and most fun part is to test our creation. Go to your Node-RED dashboard by either typing the http://localhost:1880/ui or by clicking the following buttons:
You should see something like this at the end.
Click on the blue refresh button and choose your Alexa device. In the text field below enter your text that you want Alexa to speak – like “Subscribe for the Kiril’s newsletter” and press the SPEAK button.
Question of the day
For what do you plan to use Alexa’s text to speech? Let me know your answers in the comments. Also let me know if you have any questions.
I’m really interested about what kind of clever ideas and routines you will create using TTS.
Support my work
Check my other post about Alexa, Node-Red & MQTT on this link
I post there pretty much daily.
I really hope that you find this information useful and wish you good luck with your TTS enabled Alexa.
Thank you, stay safe and see you next time.