openhab-addons/bundles/org.openhab.voice.googletts
Gwendal Roulleau 2899421ec3
[googletts] Replace custom TTS cache with common TTS cache (#15208)
* [googletts] Replace custom TTS cache with common TTS cache

--------

Signed-off-by: Gwendal Roulleau <gwendal.roulleau@gmail.com>
2023-07-11 00:29:13 +02:00
..
src/main [googletts] Replace custom TTS cache with common TTS cache (#15208) 2023-07-11 00:29:13 +02:00
NOTICE Codebase as of c53e4aed26 as an initial commit for the shrunk repo 2020-09-20 23:57:58 +02:00
pom.xml fix spotless after release (#14014) 2022-12-19 15:22:17 +01:00
README.md [googletts] Replace custom TTS cache with common TTS cache (#15208) 2023-07-11 00:29:13 +02:00

Google Cloud Text-to-Speech

Google Cloud TTS Service uses the non-free Google Cloud Text-to-Speech API to convert text or Speech Synthesis Markup Language (SSML) input into audio data of natural human speech. It provides multiple voices, available in different languages and variants and applies DeepMinds groundbreaking research in WaveNet and Googles powerful neural networks. The Google Cloud TTS service uses the openHAB TTS cache to cache audio files produced from the most recent queries in order to reduce traffic, improve performance and reduce number of requests. Be aware, that using this service may incur cost on your Google Cloud account. You can find pricing information on the documentation page.

Table of Contents

Obtaining Credentials

Before you can integrate this service with your Google Cloud Text-to-Speech, you must have a Google API Console project:

  • Select or create a GCP project. link
  • Make sure that billing is enabled for your project. link
  • Enable the Cloud Text-to-Speech API. link
  • Set up authentication:
    • Go to the "APIs & Services" -> "Credentials" page in the GCP Console and your project. link
    • From the "Create credentials" drop-down list, select "OAuth client ID".
    • Select application type "Web application" and enter a name into the "Name" field.
    • Add "https://www.google.com" to the "Authorized redirect URIs".
    • Click Create. A pop-up appears, showing your "client ID" and "client secret".

Configuration

Using your favorite configuration UI to edit Settings / Other Services - Google Cloud Text-to-Speech and set:

In case you would like to setup the service via a text file, create a new file in $OPENHAB_ROOT/conf/services named googletts.cfg

Its contents should look similar to:

org.openhab.voice.googletts:clientId=ID
org.openhab.voice.googletts:clientSecret=SECRET
org.openhab.voice.googletts:authcode=XXXXX
org.openhab.voice.googletts:pitch=0
org.openhab.voice.googletts:volumeGain=0
org.openhab.voice.googletts:speakingRate=1

Default Text-to-Speech and Voice Configuration

You can setup your preferred default Text-to-Speech and default voice in the UI:

  • Go to Settings.
  • Edit System Services - Voice.
  • Set Google Cloud as Default Text-to-Speech.
  • Choose your preferred Default Voice for your setup.

In case you would like to setup these settings via a text file, you can edit the file runtime.cfg in $OPENHAB_ROOT/conf/services and set the following entries:

org.openhab.voice:defaultTTS=googletts
org.openhab.voice:defaultVoice=googletts:XXX