|
| 1 | +.. This file is automatically generated. Do not edit this file directly. |
| 2 | +
|
| 3 | +Google Cloud Text-to-Speech API Python Samples |
| 4 | +=============================================================================== |
| 5 | + |
| 6 | +.. image:: https://gstatic.com/cloudssh/images/open-btn.png |
| 7 | + :target: https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/GoogleCloudPlatform/python-docs-samples&page=editor&open_in_editor=/README.rst |
| 8 | + |
| 9 | + |
| 10 | +This directory contains samples for Google Cloud Text-to-Speech API. The `Google Cloud Text To Speech API`_ enables you to generate and customize synthesized speech from text or SSML. |
| 11 | + |
| 12 | + |
| 13 | + |
| 14 | + |
| 15 | +.. _Google Cloud Text-to-Speech API: https://cloud.google.com/text-to-speech/docs/ |
| 16 | + |
| 17 | +Setup |
| 18 | +------------------------------------------------------------------------------- |
| 19 | + |
| 20 | + |
| 21 | +Authentication |
| 22 | +++++++++++++++ |
| 23 | + |
| 24 | +This sample requires you to have authentication setup. Refer to the |
| 25 | +`Authentication Getting Started Guide`_ for instructions on setting up |
| 26 | +credentials for applications. |
| 27 | + |
| 28 | +.. _Authentication Getting Started Guide: |
| 29 | + https://cloud.google.com/docs/authentication/getting-started |
| 30 | + |
| 31 | +Install Dependencies |
| 32 | +++++++++++++++++++++ |
| 33 | + |
| 34 | +#. Install `pip`_ and `virtualenv`_ if you do not already have them. You may want to refer to the `Python Development Environment Setup Guide`_ for Google Cloud Platform for instructions. |
| 35 | + |
| 36 | + .. _Python Development Environment Setup Guide: |
| 37 | + https://cloud.google.com/python/setup |
| 38 | + |
| 39 | +#. Create a virtualenv. Samples are compatible with Python 2.7 and 3.4+. |
| 40 | + |
| 41 | + .. code-block:: bash |
| 42 | +
|
| 43 | + $ virtualenv env |
| 44 | + $ source env/bin/activate |
| 45 | +
|
| 46 | +#. Install the dependencies needed to run the samples. |
| 47 | + |
| 48 | + .. code-block:: bash |
| 49 | +
|
| 50 | + $ pip install -r requirements.txt |
| 51 | +
|
| 52 | +.. _pip: https://pip.pypa.io/ |
| 53 | +.. _virtualenv: https://virtualenv.pypa.io/ |
| 54 | + |
| 55 | +Samples |
| 56 | +------------------------------------------------------------------------------- |
| 57 | + |
| 58 | +Quickstart |
| 59 | ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
| 60 | + |
| 61 | +.. image:: https://gstatic.com/cloudssh/images/open-btn.png |
| 62 | + :target: https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/GoogleCloudPlatform/python-docs-samples&page=editor&open_in_editor=/quickstart.py;/README.rst |
| 63 | + |
| 64 | + |
| 65 | + |
| 66 | + |
| 67 | +To run this sample: |
| 68 | + |
| 69 | +.. code-block:: bash |
| 70 | +
|
| 71 | + $ python quickstart.py |
| 72 | +
|
| 73 | +
|
| 74 | +List voices |
| 75 | ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
| 76 | + |
| 77 | +.. image:: https://gstatic.com/cloudssh/images/open-btn.png |
| 78 | + :target: https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/GoogleCloudPlatform/python-docs-samples&page=editor&open_in_editor=/list_voices.py;/README.rst |
| 79 | + |
| 80 | + |
| 81 | + |
| 82 | + |
| 83 | +To run this sample: |
| 84 | + |
| 85 | +.. code-block:: bash |
| 86 | +
|
| 87 | + $ python list_voices.py |
| 88 | +
|
| 89 | +
|
| 90 | +Synthesize text |
| 91 | ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
| 92 | + |
| 93 | +.. image:: https://gstatic.com/cloudssh/images/open-btn.png |
| 94 | + :target: https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/GoogleCloudPlatform/python-docs-samples&page=editor&open_in_editor=/synthesize_text.py;/README.rst |
| 95 | + |
| 96 | + |
| 97 | + |
| 98 | + |
| 99 | +To run this sample: |
| 100 | + |
| 101 | +.. code-block:: bash |
| 102 | +
|
| 103 | + $ python synthesize_text.py |
| 104 | +
|
| 105 | + usage: synthesize_text.py [-h] (--text TEXT | --ssml SSML) |
| 106 | +
|
| 107 | + Google Cloud Text-To-Speech API sample application . |
| 108 | +
|
| 109 | + Example usage: |
| 110 | + python synthesize_text.py --text "hello" |
| 111 | + python synthesize_text.py --ssml "<speak>Hello there.</speak>" |
| 112 | +
|
| 113 | + optional arguments: |
| 114 | + -h, --help show this help message and exit |
| 115 | + --text TEXT The text from which to synthesize speech. |
| 116 | + --ssml SSML The ssml string from which to synthesize speech. |
| 117 | +
|
| 118 | +
|
| 119 | +
|
| 120 | +Synthesize file |
| 121 | ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
| 122 | + |
| 123 | +.. image:: https://gstatic.com/cloudssh/images/open-btn.png |
| 124 | + :target: https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/GoogleCloudPlatform/python-docs-samples&page=editor&open_in_editor=/synthesize_file.py;/README.rst |
| 125 | + |
| 126 | + |
| 127 | + |
| 128 | + |
| 129 | +To run this sample: |
| 130 | + |
| 131 | +.. code-block:: bash |
| 132 | +
|
| 133 | + $ python synthesize_file.py |
| 134 | +
|
| 135 | + usage: synthesize_file.py [-h] (--text TEXT | --ssml SSML) |
| 136 | +
|
| 137 | + Google Cloud Text-To-Speech API sample application . |
| 138 | +
|
| 139 | + Example usage: |
| 140 | + python synthesize_file.py --text resources/hello.txt |
| 141 | + python synthesize_file.py --ssml resources/hello.ssml |
| 142 | +
|
| 143 | + optional arguments: |
| 144 | + -h, --help show this help message and exit |
| 145 | + --text TEXT The text file from which to synthesize speech. |
| 146 | + --ssml SSML The ssml file from which to synthesize speech. |
| 147 | +
|
| 148 | +
|
| 149 | +
|
| 150 | +
|
| 151 | +
|
| 152 | +The client library |
| 153 | +------------------------------------------------------------------------------- |
| 154 | + |
| 155 | +This sample uses the `Google Cloud Client Library for Python`_. |
| 156 | +You can read the documentation for more details on API usage and use GitHub |
| 157 | +to `browse the source`_ and `report issues`_. |
| 158 | + |
| 159 | +.. _Google Cloud Client Library for Python: |
| 160 | + https://googlecloudplatform.github.io/google-cloud-python/ |
| 161 | +.. _browse the source: |
| 162 | + https://github.com/GoogleCloudPlatform/google-cloud-python |
| 163 | +.. _report issues: |
| 164 | + https://github.com/GoogleCloudPlatform/google-cloud-python/issues |
| 165 | + |
| 166 | + |
| 167 | +.. _Google Cloud SDK: https://cloud.google.com/sdk/ |
0 commit comments