Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Google Cloud Platform Documentation #9367

Merged
merged 10 commits into from Jun 18, 2019
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
135 changes: 135 additions & 0 deletions source/_components/google_cloud.markdown
@@ -0,0 +1,135 @@
---
layout: page
title: "Google Cloud Platform"
description: "Google Cloud Platform integration."
date: 2019-05-02 12:08
sidebar: true
comments: false
sharing: true
footer: true
logo: google_cloud.png
ha_category: Text-to-speech
ha_release: 0.94
---

The `google_cloud` platform allow you to use [Google Cloud Platform](https://cloud.google.com/) API and integrate them into Home Assistant.

## {% linkable_title Platform configuration %}

To use Google Cloud Platform you need to provide `config` directory relative path of [`API key`](#obtaining-api-key) file you are going to use. Place it under `config` folder and set `key_file` parameter in `configuration.yaml`:

```yaml
# Example configuration.yaml entry
tts:
- platform: google_cloud
key_file: googlecloud.json
```

## {% linkable_title Obtaining API key %}
API key obtaining process described in corresponding documentation:
* [Text-to-Speach](https://cloud.google.com/text-to-speech/docs/quickstart-protocol)
* [Speach-to-Text](https://cloud.google.com/speech-to-text/docs/quickstart-protocol)
* [Geocoding](https://cloud.google.com/translate/docs/quickstart)

Basic instruction for all APIs:
1. Visit [Cloud Resource Manager](https://console.cloud.google.com/cloud-resource-manager).
2. Click `CREATE PROJECT` button at the top.
3. Specify convenient `Project name` and click `CREATE` button.
4. [Make sure that billing is enabled for your Google Cloud Platform project](https://cloud.google.com/billing/docs/how-to/modify-project).
5. Enable needed Cloud API visiting one of the links below or [APIs library](https://console.cloud.google.com/apis/library), selecting your `Project` from dropdown list and clicking `Continue` button:
* [Text-to-Speech](https://console.cloud.google.com/flows/enableapi?apiid=texttospeech.googleapis.com)
* [Speech-to-Text](https://console.cloud.google.com/flows/enableapi?apiid=speech.googleapis.com)
* [Geocoding](https://console.cloud.google.com/flows/enableapi?apiid=geocoding-backend.googleapis.com)
6. Set up authentication:
1. Visit [this link](https://console.cloud.google.com/apis/credentials/serviceaccountkey)
2. From the `Service account` list, select `New service account`.
3. In the `Service account name` field, enter any name.

If you are requsting Text-to-Speech API key:

4. Don't select a value from the Role list. **No role is required to access this service**.
5. Click `Create`. A note appears, warning that this service account has no role.
6. Click `Create without role`. A JSON file that contains your `API key` downloads to your computer.

## {% linkable_title Google Cloud Text-to-Speech %}

[Google Cloud Text-to-Speech](https://cloud.google.com/text-to-speech/) converts text into human-like speech in more than 100 voices across 20+ languages and variants. It applies groundbreaking research in speech synthesis (WaveNet) and Google's powerful neural networks to deliver high-fidelity audio. With this easy-to-use API, you can create lifelike interactions with your users that transform customer service, device interaction, and other applications.

### {% linkable_title Pricing %}

The Cloud Text-to-Speech API is priced monthly based on the amount of characters to synthesize into audio sent to the service.

| Feature | Monthly free tier | Paid usage |
|-------------------------------|---------------------------|-----------------------------------|
| Standard (non-WaveNet) voices | 0 to 4 million characters | $4.00 USD / 1 million characters |
| WaveNet voices | 0 to 1 million characters | $16.00 USD / 1 million characters |

### {% linkable_title Text-to-Speach configuration %}

{% configuration %}
key_file:
description: "The [`API key`](#obtaining-api-key) file to use with Google Cloud Platform. If not specified `os.environ['GOOGLE_APPLICATION_CREDENTIALS']` path will be used."
required: false
type: string
language:
description: "Default language of the voice, e.g. `en-US`. Supported languages, genders and voices listed [here](https://cloud.google.com/text-to-speech/docs/voices)."
required: false
type: string
default: "`en-US`"
gender:
description: "Default gender of the voice, e.g. `male`. Supported languages, genders and voices listed [here](https://cloud.google.com/text-to-speech/docs/voices)."
required: false
type: string
default: "`neutral`"
voice:
description: "Default voice name, e.g. `en-US-Wavenet-F`. Supported languages, genders and voices listed [here](https://cloud.google.com/text-to-speech/docs/voices). **Important! This parameter will override `language` and `gender` parameters if set**."
required: false
type: string
default: "(None)"
lufton marked this conversation as resolved.
Show resolved Hide resolved
encoding:
description: "Default audio encoder. Supported encodings are `ogg_opus`, `mp3` and `linear16`."
required: false
type: string
default: "ogg_opus"
speed:
description: "Default rate/speed of the voice, in the range [0.25, 4.0]. 1.0 is the normal native speed supported by the specific voice. 2.0 is twice as fast, and 0.5 is half as fast. If unset(0.0), defaults to the native 1.0 speed."
required: false
type: float
default: "1.0"
pitch:
description: "Default pitch of the voice, in the range [-20.0, 20.0]. 20 means increase 20 semitones from the original pitch. -20 means decrease 20 semitones from the original pitch."
required: false
type: float
default: "0"
gain:
description: "Default volume gain (in dB) of the voice, in the range [-96.0, 16.0]. If unset, or set to a value of 0.0 (dB), will play at normal native signal amplitude. A value of -6.0 (dB) will play at approximately half the amplitude of the normal native signal amplitude. A value of +6.0 (dB) will play at approximately twice the amplitude of the normal native signal amplitude. Strongly recommend not to exceed +10 (dB) as there's usually no effective increase in loudness for any value greater than that."
required: false
type: float
default: "0"
profiles:
description: "An identifier which selects 'audio effects' profiles that are applied on (post synthesized) text to speech. Effects are applied on top of each other in the order they are given. Supported profile ids listed [here](https: //cloud.google.com/text-to-speech/docs/audio-profiles)."
required: false
type: list
default: "[]"
{% endconfiguration %}

### {% linkable_title Full configuration example %}

The Google Cloud Text-to-Speech configuration can look like:

```yaml
# Example configuration.yaml entry
tts:
- platform: google_cloud
key_file: googlecloud.json
language: en-US
gender: male
voice: en-US-Wavenet-F
encoding: linear16
speed: 0.9
pitch: -2.5
gain: -5.0
profiles:
- telephony-class-application
- wearable-class-device
```
Binary file added source/images/supported_brands/google_cloud.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.