Text To Speech - In The Cloud - Vera Verbal Notifications

I’ve always had a dream of interacting with my house, and having invested in Vera as my home ‘controller’ i’d like to see what’s possible with some cloud based voice applications. There’ve been a number of posts on the speech/voice subject in this forum over the years, and I’d ideally like to add features/functionality without adding another physical box. So I’m looking to the cloud, and my first port of call is this hidden Google Translate.

Have a go at using the link below.

http://translate.google.com/translate_tts?tl=en&q=kitchen+lights+off

For this to work, the above would need to be created and then streamed to a music player of some description e.g. a PC or for those like me with a Sonos, i’d like to explore the idea of sending it to that (Sonos, can play streaming URLs), but I am really keen to hear what others think…

[center][size=12pt]COMPLETED[/size][/center]
[center][size=10pt]Google TTS now works with the Sonos & Squeezebox Plugins[/size][/center].

[center][size=12pt]STILL TO DO[/size][/center]
[center][size=10pt]To dynamically create Google TTS URLs that the plug-ins can then use[/size][/center]

I should add that i can get speech to works with via my Sonos if I add the URL above as a new streaming Radio station, however the goal is to have a piece of code that dynamically plays the automatically created URL. Any thoughts?

did you try out HAL Remote: http://forum.micasaverde.com/index.php/board,37.0.html could be first step to realizing your dream :slight_smile:

Hi Capjay,

I did notice HAL (I’ve even made a few comments on that stream) although I seem to recall, it’s windows and Android solution, and I’m more Linux and iOS nowadays. Plus with the Sonos on all the time it seemed like a good fit/target to tie up the two, assuming its possible.

If I was running a a windows PC all day/night it might be a different story but for now the potential of dynamically creating spoken words to come out of a Multi-room setting seems like a pretty good solution?

I’ll still keep my eye on HAL as Richard develops it, and if it could run off a Raspberry Pi, I’m there ! :wink:

This won’t help, but my app has an experimental feature for voice recognition that uses google’s voice recognition api and tts api. However, it is for Android. Just offering another alternative.

  • Garrett

Hi gattettwp

I have to say that the screenshots I saw of your app look awesome!

Are there any plans for a iOS version?

I’ve posted a request on the Sonos Plug in page to see if anyone for can help

http://forum.micasaverde.com/index.php/topic,8505.msg80528.html#msg80528

An update today (i think) to the Squeezebox wiki, shows that it is possible to do.

http://wiki.micasaverde.com/index.php/Squeezebox#Using_Google.27s_TTS_engine_for_announcements

Alas not having a Squeezebox, let’s hope the guys working with the Sonos Plug In can help me.

[quote=“parkerc, post:6, topic:172156”]Hi gattettwp

I have to say that the screenshots I saw of your app look awesome!

Are there any plans for a iOS version?

I’ve posted a request on the Sonos Plug in page to see if anyone for can help

http://forum.micasaverde.com/index.php/topic,8505.msg80528.html#msg80528[/quote]

I do not own any iOS devices anymore. So no plans for developing for the iOS platform. I also am not spending the $99 a year fee to develop an app that I want to provide free to the community.

  • Garrett

I just wanted to add to this thread that there’s been some success is using the Google TTS with both the Sonos & SqueezeBox plugins. I’ve been involved personally in the testing of the Sonos update, and it seems to work well, although it still has a few things to iron out.

http://forum.micasaverde.com/index.php/topic,8505.msg82116.html#msg82116
http://wiki.micasaverde.com/index.php/Squeezebox#Using_Google.27s_TTS_engine_for_announcements

The next desire is to auto create the text that the TTS engine will process.

Hi All

Just wanted to update my own thread, to say the Sonos plugin now supports the submission/playing of a google TTS URL, which you can now either set up via the UI or by using some code like below.

local DEVICE_NO = 5 – the official Sonos device number
local LS_SID = “urn:micasaverde-com:serviceId:Sonos1”
local MN_SID = “urn:micasaverde-com:serviceId:MediaNavigation1”

luup.call_action(LS_SID, “SetURIToPlay”, {URIToPlay = “x-rincon-mp3radio://translate.google.com/translate_tts?tl=en&q=kitchen+lights+on”}, DEVICE_NO)
luup.call_action(MN_SID, “Play”, {}, DEVICE_NO)

My question is, and this relates to the squeezebox plugin too, can anyone help me to dynamically create a tts URL (e.g. Taking the temperature [value] of e.g the “living room thermostat” [device description]) and then place those captured values into the code above?

I wish you utmost luck in this!

I’m not sure how to do this, but the output definitely needs to be a 100 character limit and also ensure that spaces are replaced with the plus symbol.

Sent from my SPH-D710 using Tapatalk 2

[quote=“parkerc, post:10, topic:172156”]Hi All

Just wanted to update my own thread, to say the Sonos plugin now supports the submission/playing of a google TTS URL, which you can now either set up via the UI or by using some code like below.

local DEVICE_NO = 5 – the official Sonos device number
local LS_SID = “urn:micasaverde-com:serviceId:Sonos1”
local MN_SID = “urn:micasaverde-com:serviceId:MediaNavigation1”

luup.call_action(LS_SID, “SetURIToPlay”, {URIToPlay = “x-rincon-mp3radio://translate.google.com/translate_tts?tl=en&q=kitchen+lights+on”}, DEVICE_NO)
luup.call_action(MN_SID, “Play”, {}, DEVICE_NO)

My question is, and this relates to the squeezebox plugin too, can anyone help me to dynamically create a tts URL (e.g. Taking the temperature [value] of e.g the “living room thermostat” [device description]) and then place those captured values into the code above?[/quote]
Hi,
Did you discover how to put dynamic variable in the tts message? E.g temperature variable

Thank you
Matteo

I m doing something like this, but I am not able to create a dynamic TTS, as the link cannot read out dynamic variable

local DEVICE_NO = 138
local LS_SID = “urn:micasaverde-com:serviceId:Sonos1”
local MN_SID = “urn:micasaverde-com:serviceId:MediaNavigation1”
local lul_temp = luup.variable_get(“urn:upnp-org:serviceId:TemperatureSensor1”,“CurrentTemperature”, 109)

luup.call_action(LS_SID, “SetURIToPlay”, {URIToPlay = “x-rincon-mp3radio://translate.google.com/translate_tts?tl=it&q=today+there+are+‘…tostring( lul_temp )…’+Gradi”}, DEVICE_NO)
luup.call_action(MN_SID, “Play”, {}, DEVICE_NO)

luup.sleep(50000)
luup.call_action(MN_SID, “Stop”, {}, DEVICE_NO)
return true

Thank you for your help
Matteo

I am working to add this to VeraAlert … I had a request to add this to HAL … but HAL is more command/response … I will add a new alert type to have the message spoken instead of an alarm going off. The android app will have a repeat interval (0 to XX seconds)

Matteo,
That’s the purpose of this type of discussion:
http://forum.micasaverde.com/index.php/topic,11586.0.html

If we can drive that to completion, it would be a general library for converting “strings”, with embedded Device expressions, into something either printable… or in this case into something that can be encoded into a URL for getting TTS to work.

I just gave that thread a nudge to see if see if we can get consensus on the form of the expressions within the string.

Hi @teonebello

I hit the same problem (i think) in that the URI I was trying to update dynamically was already part of a string in quotes " " so it would always send it as text as is

I can get it to say everything within the google TTS URL bit, but just not replace the lookup references, so it ends up sounding strange.

What I’ve been trying to do recently when ive had time is to build the URI outside of that bit of code and then add it in after - so it would be something like this

{URIToPlay = “DYNAMICURI”}, DEVICE_NO

But I always get a Code Failed message.

[quote=“parkerc, post:17, topic:172156”]Hi @teonebello

I hit the same problem (i think) in that the URI I was trying to update dynamically was already part of a string in quotes " " so it would always send it as text as is

I can get it to say everything within the google TTS URL bit, but just not replace the lookup references, so it ends up sounding strange.

What I’ve been trying to do recently when ive had time is to build the URI outside of that bit of code and then add it in after - so it would be something like this

{URIToPlay = “DYNAMICURI”}, DEVICE_NO

But I always get a Code Failed message.[/quote]

I tried also with your proposed solution, but nothing.

Anyone could support us?

I believe that a dynamic vocal command can be a kill feature in vera.

Thank you
Matteo

Two comments:

a) You’re mixing your Quote styles within the string.
This bit:
[tt] {URIToPlay = “x-rincon-mp3radio://translate.google.com/translate_tts?tl=it&q=today+there+are+'…tostring( lul_temp )…'+Gradi”}[/tt]

should look more like:

[tt] {URIToPlay = “x-rincon-mp3radio://translate.google.com/translate_tts?tl=it&q=today+there+are+"…tostring( lul_temp )…"+Gradi”}[/tt]

with double-quote (") characters throughout… you could also use single-quote (') characters throughout, but for what you’re doing you cannot mix them.

b) The delay of 50s is a bad idea
Vera will restart if any Luup code “pauses” for longer than 30s (UI4) or 60s (UI5). If you need to do this, then use [tt]luup.call_delay[/tt], to call a function at a later point in time.

[quote=“teonebello, post:14, topic:172156”]I m doing something like this, but I am not able to create a dynamic TTS, as the link cannot read out dynamic variable

local DEVICE_NO = 138
local LS_SID = “urn:micasaverde-com:serviceId:Sonos1”
local MN_SID = “urn:micasaverde-com:serviceId:MediaNavigation1”
local lul_temp = luup.variable_get(“urn:upnp-org:serviceId:TemperatureSensor1”,“CurrentTemperature”, 109)

luup.call_action(LS_SID, “SetURIToPlay”, {URIToPlay = “x-rincon-mp3radio://translate.google.com/translate_tts?tl=it&q=today+there+are+‘…tostring( lul_temp )…’+Gradi”}, DEVICE_NO)
luup.call_action(MN_SID, “Play”, {}, DEVICE_NO)

luup.sleep(50000)
luup.call_action(MN_SID, “Stop”, {}, DEVICE_NO)
return true

Thank you for your help
Matteo[/quote]

[quote=“guessed, post:19, topic:172156”]Two comments:

a) You’re mixing your Quote styles within the string.
This bit:
[tt] {URIToPlay = “x-rincon-mp3radio://translate.google.com/translate_tts?tl=it&q=today+there+are+'…tostring( lul_temp )…'+Gradi”}[/tt]

should look more like:

[tt] {URIToPlay = “x-rincon-mp3radio://translate.google.com/translate_tts?tl=it&q=today+there+are+"…tostring( lul_temp )…"+Gradi”}[/tt]

with double-quote (") characters throughout… you could also use single-quote (') characters throughout, but for what you’re doing you cannot mix them.

b) The delay of 50s is a bad idea
Vera will restart if any Luup code “pauses” for longer than 30s (UI4) or 60s (UI5). If you need to do this, then use [tt]luup.call_delay[/tt], to call a function at a later point in time.

[quote=“teonebello, post:14, topic:172156”]I m doing something like this, but I am not able to create a dynamic TTS, as the link cannot read out dynamic variable

local DEVICE_NO = 138
local LS_SID = “urn:micasaverde-com:serviceId:Sonos1”
local MN_SID = “urn:micasaverde-com:serviceId:MediaNavigation1”
local lul_temp = luup.variable_get(“urn:upnp-org:serviceId:TemperatureSensor1”,“CurrentTemperature”, 109)

luup.call_action(LS_SID, “SetURIToPlay”, {URIToPlay = “x-rincon-mp3radio://translate.google.com/translate_tts?tl=it&q=today+there+are+‘…tostring( lul_temp )…’+Gradi”}, DEVICE_NO)
luup.call_action(MN_SID, “Play”, {}, DEVICE_NO)

luup.sleep(50000)
luup.call_action(MN_SID, “Stop”, {}, DEVICE_NO)
return true

Thank you for your help
Matteo[/quote][/quote]

It works!!!

THANK YOU FROM SWITZERLAND!!!

Matteo