This page is part of archived documentation for openHAB 2.5. Go to the current stable version

# Google Cloud Text-to-Speech

Google Cloud TTS Service uses the none-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 30 voices, available in multiple languages and variants and applies DeepMind’s groundbreaking research in WaveNet and Google’s powerful neural networks. The implementation caches the converted texts to reduce the load on the API and make the conversion faster. You can find them in the $OPENHAB_USERDATA/cache/org.openhab.voice.googletts folder. Be aware, that using this service may incur cost on your Google Cloud account. You can find pricing information on the documentation page (opens new window).

# 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 (opens new window)
  • Make sure that billing is enabled for your project. link (opens new window)
  • Enable the Cloud Text-to-Speech API. link (opens new window)
  • Set up authentication:
    • Go to the Create service account key page in the GCP Console.link (opens new window)
    • From the Service account drop-down list, select New service account.
    • Enter a name into the Service account name field.
    • Don't select a value from the Role drop-down list. No role is required to access this service.
    • Click Create. A note appears, warning that this service account has no role.
    • Click Create without role. A JSON file that contains your key downloads to your computer.

# Service Configuration

Using your favourite configuration UI (e.g. Paper UI) edit Services/Voice/Google Cloud Text-to-Speech settings and set

  • Service Account Key - Copy-paste the content of the downloaded key file.
  • Pitch - The pitch of selected voice, up to 20 semitones
  • Volume Gain - The volume of the output between 16dB and -96dB
  • Speaking Rate - The speaking rate can be 4x faster or slower than the normal rate
  • Purge Cache - Purges the cache e.g. after testing different voice configuration parameters. When enabled the cache is purged once. Make sure to disable this setting again so the cache is maintained after restarts.

# Voice Configuration

Using your favourite configuration UI

  • Edit System settings
  • Edit Voice settings
  • Set Google Cloud as Default Text-to-Speech
  • Choose default voice for the setup.