Howdy folks,
Version 2.1 (beta) is ready for consumption. This release includes text-to-speech (TTS) support. This is supposed to work as follows:
- Your squeezebox player may be doing nothing (be idle) or may be playing something.
- When a command is sent to say something at a given volume…
a) The player starts saying the message at the volume specified
b) As the message is being said, the player will display a two line message (if the message is supplied and if your player supports it)
c) When finished playing the message, the player will revert to it’s prior state. (Continue playing the track where it left off, rest the volume, etc.)
Code Structure Changes:
[ol][li]Addition of L_SqueezeboxTTS.lua file. This is essentially a re-use (with permission) of lolodomo’s library that is used in the Sonos and DLNA plug-ins.[/li][/ol]
Usability / Cosmetic Enhancements:
[ol][li]The Squeezebox Server Device now has UI to support the setting of defaults related to TTS.[/li]
[li]The squeezebox Player Devices support a new action: “Say” (documented below)[/li]
[li]The Squeezebox Player Device(s) now has UI support to test the Say action[/li][/ol]
To install the beta, (on either UI5 or UI7):
[ol][li]Please upgrade to the official 2.0 version from the app store if you have not done so already. Make sure your server device and one or more player devices are functioning properly.[/li]
[li]download the attached zip, and upload all of the included files to Vera. ( Apps–>Develop Apps–>luup files). Make sure the check-box for “restart…” has a check mark in it.[/li]
[li]After the luup restart, refresh your bowser (press F5)[/li][/ol]
Set-up:
The Text to speech engine supports googles “non official” API, and the OSX TTS engine. I have exposed the same default settings that are exposed in the Sonos and DLNA plugins. You access the default settings by going to the Squeezebox Server device, and going into the “Player Control” tab. (Wrench in UI5, or the “>” button in UI7).
Here are the settings. They will have defaults automatically populated (Language=en, Engine=GOOGLE, google URL=http://translate.google.com) when the plug-in first installs.
[ol][li]Language: This is the language code. In theory is should dictate the voice that is used and any dialect specific inflections. I have tried some other dialect (like en-UK and en-AU), and they seem to work as intended. Other language codes are reference here that you may want to try…your mileage may vary. The current beta has an issue though where if you change the language setting (or server or URL settings) they don’t go into effect until a luup restart. This will be fixed prior to official release.[/li]
[li]Default Engine: Use GOOGLE’s service, or your own Mac OSX TTS service if you are running one. NOTE: If your vera is set-up to be “secured”, you will not be able to use google’s service.[/li]
[li]Google TTS Server URL: Some folks have gotten different voices by changing the url.[/li]
[li]OSX TTS Server URL: If you’re using an OSX server, the local url for that server.[/li][/ol]
Testing TTS
Go to one of your squeezebox player devices and to the “Player Control” tab. (Wrench in UI5, or the “>” button in UI7). Enter in some text in the box next to the “Test Say” button, and press the Test Say button. You should hear the text-to-speech announcement at the volume level that is currently set for the device.
“Say” action
Action Name: Say
Service Name: urn:micasaverde-com:serviceId:SqueezeBoxPlayer1
Parameters:
[ul][li]Text (the text to say)[/li]
[li]Line1 (optional) The text to display on line one of your player as the message is being said [/li]
[li]Line2 (optional) The text to display on line two of your player as the message is being said [/li]
[li]Volume (optional) Value from 0 to 100. If omitted, the speech will be read at the current volume of your player device. [/li]
[li]Language (optional) the language code to use. If omitted, the default value (see set-up above) will be used [/li]
[li]Engine (optional) Either “GOOGLE” or “OSX_TTS_SERVER” If omitted, the default value (see set-up above) will be used. [/li][/ul]
Sample LUA for the Say action:
Below is sample lua to send a text announcement of The quick brown fox jumped over the lazy dog. Have a nice day! at volume level 70%, to squeezebox player with a vera ID of 10. While the message is being read, the player will display “Vera Squeezebox Plugin” on line one, and “Text to speech test” on line 2 of the display.
local lul_arguments = {}
lul_arguments["Text"] = "The quick brown fox jumped over the lazy dog. Have a nice day!"
lul_arguments["Line1"] = "Vera Squeezbox Plugin"
lul_arguments["Line2"] = "Text to speech test"
lul_arguments["Volume"] = 70
luup.call_action("urn:micasaverde-com:serviceId:SqueezeBoxPlayer1","Say",lul_arguments,10)
Known issues / things to watch out for
I have not done thorough testing with trying to say “multiple” things at once. In other words, send a say command, and then before it is done, send another command. In theory there is a queue system that should work. In practice, I have not tested it.
Some audio file formats do not support skipping to specific times within the file. So if you’re playing something and it gets interrupted by speech, the plugin may not be able to “pick-up where you left off” after the speech is done. The result is likely to just start the track over, (or if it is an on-line stream, start as if you just reconnected to the stream.
You may not see the 2 lines of text on your display if you have “special characters” in the text.
If you change the default TTS settings (language, server, url), a luup restart may be needed for those settings to take. Checking into this…
future enhancements
I have not tried to expose the option to dynamically sync and unsync players at this time. For example, sync all your players, make the announcement, and then revert your players to how they were before the speech. I may try and add this in a future release. Right now, I believe if you have players synced and you send a speech command to one of those players, all sync’d players will also make the announcement.
As always…comments welcome!