google-cloud-text_to_speech 0.2.0 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cf511e97f1080d54aa68a1995db34659cc5f23e4712f934dd8ea25a78ebaaaa0
4
- data.tar.gz: 376c3fcf1ff8dc1833eec30c22ea0c5022e3060808d77d75d3617ed72479afa5
3
+ metadata.gz: d2feb74eaaeea0db311cb45e2d84e8e3dc0042855a687a870f5258e7bb2481e5
4
+ data.tar.gz: 7d4cf091bcb0b17dad27cdc3022b5727b7388b26de29597bbe71203b18fcb086
5
5
  SHA512:
6
- metadata.gz: 2011d38868ab689be7cc0fe3b44992d38f452b4150f1bef607e696f2dcf32f55f77c6b48b16c6a56bc38030e475a8113d11aeb36a1b13c64ee7b9fdcc8a5a063
7
- data.tar.gz: 89925d456eb02a8561b743d96e1d90d46aa0a6a5090327ae7a1687393281e2c30451a92c1553cdef8a8f6730fed802d98bd2291a89d32c55875a49ef73ffe448
6
+ metadata.gz: 396132c8883007b2035eaa1e9a68adbf3e8150fc87339d44635f9bf7a1f5170bc88aeefe00ea682db19875843e81c079ae12b2e4354194d83ce1bf12bb00b2d7
7
+ data.tar.gz: 5c34d6d9dab05f3096a0d70e704a3dd590f457d4c7926608488d121cf0b7f29d783a9cc3bf6258b268e4564b9690032c307cdc1f2967dacbe6b445860941fb6b
data/.yardopts CHANGED
@@ -7,3 +7,5 @@
7
7
  ./lib/**/*.rb
8
8
  -
9
9
  README.md
10
+ AUTHENTICATION.md
11
+ LICENSE
data/AUTHENTICATION.md ADDED
@@ -0,0 +1,199 @@
1
+ # Authentication
2
+
3
+ In general, the google-cloud-text_to_speech library uses [Service
4
+ Account](https://cloud.google.com/iam/docs/creating-managing-service-accounts)
5
+ credentials to connect to Google Cloud services. When running within [Google
6
+ Cloud Platform environments](#google-cloud-platform-environments)
7
+ the credentials will be discovered automatically. When running on other
8
+ environments, the Service Account credentials can be specified by providing the
9
+ path to the [JSON
10
+ keyfile](https://cloud.google.com/iam/docs/managing-service-account-keys) for
11
+ the account (or the JSON itself) in [environment
12
+ variables](#environment-variables). Additionally, Cloud SDK credentials can also
13
+ be discovered automatically, but this is only recommended during development.
14
+
15
+ ## Quickstart
16
+
17
+ 1. [Create a service account and credentials](#creating-a-service-account).
18
+ 2. Set the [environment variable](#environment-variables).
19
+
20
+ ```sh
21
+ export TEXTTOSPEECH_CREDENTIALS=/path/to/json`
22
+ ```
23
+
24
+ 3. Initialize the client.
25
+
26
+ ```ruby
27
+ require "google/cloud/text_to_speech"
28
+
29
+ client = Google::Cloud::TextToSpeech.new
30
+ ```
31
+
32
+ ## Project and Credential Lookup
33
+
34
+ The google-cloud-text_to_speech library aims to make authentication
35
+ as simple as possible, and provides several mechanisms to configure your system
36
+ without providing **Project ID** and **Service Account Credentials** directly in
37
+ code.
38
+
39
+ **Project ID** is discovered in the following order:
40
+
41
+ 1. Specify project ID in method arguments
42
+ 2. Specify project ID in configuration
43
+ 3. Discover project ID in environment variables
44
+ 4. Discover GCE project ID
45
+ 5. Discover project ID in credentials JSON
46
+
47
+ **Credentials** are discovered in the following order:
48
+
49
+ 1. Specify credentials in method arguments
50
+ 2. Specify credentials in configuration
51
+ 3. Discover credentials path in environment variables
52
+ 4. Discover credentials JSON in environment variables
53
+ 5. Discover credentials file in the Cloud SDK's path
54
+ 6. Discover GCE credentials
55
+
56
+ ### Google Cloud Platform environments
57
+
58
+ While running on Google Cloud Platform environments such as Google Compute
59
+ Engine, Google App Engine and Google Kubernetes Engine, no extra work is needed.
60
+ The **Project ID** and **Credentials** and are discovered automatically. Code
61
+ should be written as if already authenticated. Just be sure when you [set up the
62
+ GCE instance][gce-how-to], you add the correct scopes for the APIs you want to
63
+ access. For example:
64
+
65
+ * **All APIs**
66
+ * `https://www.googleapis.com/auth/cloud-platform`
67
+ * `https://www.googleapis.com/auth/cloud-platform.read-only`
68
+ * **BigQuery**
69
+ * `https://www.googleapis.com/auth/bigquery`
70
+ * `https://www.googleapis.com/auth/bigquery.insertdata`
71
+ * **Compute Engine**
72
+ * `https://www.googleapis.com/auth/compute`
73
+ * **Datastore**
74
+ * `https://www.googleapis.com/auth/datastore`
75
+ * `https://www.googleapis.com/auth/userinfo.email`
76
+ * **DNS**
77
+ * `https://www.googleapis.com/auth/ndev.clouddns.readwrite`
78
+ * **Pub/Sub**
79
+ * `https://www.googleapis.com/auth/pubsub`
80
+ * **Storage**
81
+ * `https://www.googleapis.com/auth/devstorage.full_control`
82
+ * `https://www.googleapis.com/auth/devstorage.read_only`
83
+ * `https://www.googleapis.com/auth/devstorage.read_write`
84
+
85
+ ### Environment Variables
86
+
87
+ The **Project ID** and **Credentials JSON** can be placed in environment
88
+ variables instead of declaring them directly in code. Each service has its own
89
+ environment variable, allowing for different service accounts to be used for
90
+ different services. (See the READMEs for the individual service gems for
91
+ details.) The path to the **Credentials JSON** file can be stored in the
92
+ environment variable, or the **Credentials JSON** itself can be stored for
93
+ environments such as Docker containers where writing files is difficult or not
94
+ encouraged.
95
+
96
+ The environment variables that google-cloud-text_to_speech checks for project ID are:
97
+
98
+ 1. `TEXTTOSPEECH_PROJECT`
99
+ 2. `GOOGLE_CLOUD_PROJECT`
100
+
101
+ The environment variables that google-cloud-text_to_speech checks for credentials are configured on {Google::Cloud::TextToSpeech::V1::Credentials}:
102
+
103
+ 1. `TEXTTOSPEECH_CREDENTIALS` - Path to JSON file, or JSON contents
104
+ 2. `TEXTTOSPEECH_KEYFILE` - Path to JSON file, or JSON contents
105
+ 3. `GOOGLE_CLOUD_CREDENTIALS` - Path to JSON file, or JSON contents
106
+ 4. `GOOGLE_CLOUD_KEYFILE` - Path to JSON file, or JSON contents
107
+ 5. `GOOGLE_APPLICATION_CREDENTIALS` - Path to JSON file
108
+
109
+ ```ruby
110
+ require "google/cloud/text_to_speech"
111
+
112
+ ENV["TEXTTOSPEECH_PROJECT"] = "my-project-id"
113
+ ENV["TEXTTOSPEECH_CREDENTIALS"] = "path/to/keyfile.json"
114
+
115
+ client = Google::Cloud::TextToSpeech.new
116
+ ```
117
+
118
+ ### Configuration
119
+
120
+ The **Project ID** and **Credentials JSON** can be configured instead of placing them in environment variables or providing them as arguments.
121
+
122
+ ```ruby
123
+ require "google/cloud/text_to_speech"
124
+
125
+ Google::Cloud::TextToSpeech.configure do |config|
126
+ config.project_id = "my-project-id"
127
+ config.credentials = "path/to/keyfile.json"
128
+ end
129
+
130
+ client = Google::Cloud::TextToSpeech.new
131
+ ```
132
+
133
+ ### Cloud SDK
134
+
135
+ This option allows for an easy way to authenticate during development. If
136
+ credentials are not provided in code or in environment variables, then Cloud SDK
137
+ credentials are discovered.
138
+
139
+ To configure your system for this, simply:
140
+
141
+ 1. [Download and install the Cloud SDK](https://cloud.google.com/sdk)
142
+ 2. Authenticate using OAuth 2.0 `$ gcloud auth login`
143
+ 3. Write code as if already authenticated.
144
+
145
+ **NOTE:** This is _not_ recommended for running in production. The Cloud SDK
146
+ *should* only be used during development.
147
+
148
+ [gce-how-to]: https://cloud.google.com/compute/docs/authentication#using
149
+ [dev-console]: https://console.cloud.google.com/project
150
+
151
+ [enable-apis]: https://raw.githubusercontent.com/GoogleCloudPlatform/gcloud-common/master/authentication/enable-apis.png
152
+
153
+ [create-new-service-account]: https://raw.githubusercontent.com/GoogleCloudPlatform/gcloud-common/master/authentication/create-new-service-account.png
154
+ [create-new-service-account-existing-keys]: https://raw.githubusercontent.com/GoogleCloudPlatform/gcloud-common/master/authentication/create-new-service-account-existing-keys.png
155
+ [reuse-service-account]: https://raw.githubusercontent.com/GoogleCloudPlatform/gcloud-common/master/authentication/reuse-service-account.png
156
+
157
+ ## Creating a Service Account
158
+
159
+ Google Cloud requires a **Project ID** and **Service Account Credentials** to
160
+ connect to the APIs. You will use the **Project ID** and **JSON key file** to
161
+ connect to most services with google-cloud-text_to_speech.
162
+
163
+ If you are not running this client within [Google Cloud Platform
164
+ environments](#google-cloud-platform-environments), you need a Google
165
+ Developers service account.
166
+
167
+ 1. Visit the [Google Developers Console][dev-console].
168
+ 1. Create a new project or click on an existing project.
169
+ 1. Activate the slide-out navigation tray and select **API Manager**. From
170
+ here, you will enable the APIs that your application requires.
171
+
172
+ ![Enable the APIs that your application requires][enable-apis]
173
+
174
+ *Note: You may need to enable billing in order to use these services.*
175
+
176
+ 1. Select **Credentials** from the side navigation.
177
+
178
+ You should see a screen like one of the following.
179
+
180
+ ![Create a new service account][create-new-service-account]
181
+
182
+ ![Create a new service account With Existing Keys][create-new-service-account-existing-keys]
183
+
184
+ Find the "Add credentials" drop down and select "Service account" to be
185
+ guided through downloading a new JSON key file.
186
+
187
+ If you want to re-use an existing service account, you can easily generate a
188
+ new key file. Just select the account you wish to re-use, and click "Generate
189
+ new JSON key":
190
+
191
+ ![Re-use an existing service account][reuse-service-account]
192
+
193
+ The key file you download will be used by this library to authenticate API
194
+ requests and should be stored in a secure location.
195
+
196
+ ## Troubleshooting
197
+
198
+ If you're having trouble authenticating you can ask for help by following the
199
+ {file:TROUBLESHOOTING.md Troubleshooting Guide}.
@@ -0,0 +1,153 @@
1
+ # Copyright 2019 Google LLC
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # https://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+
16
+ require "google/cloud/text_to_speech/v1beta1/text_to_speech_client"
17
+
18
+ module Google
19
+ module Cloud
20
+ module TextToSpeech
21
+ # rubocop:disable LineLength
22
+
23
+ ##
24
+ # # Ruby Client for Cloud Text-to-Speech API ([Alpha](https://github.com/googleapis/google-cloud-ruby#versioning))
25
+ #
26
+ # [Cloud Text-to-Speech API][Product Documentation]:
27
+ # Synthesizes natural-sounding speech by applying powerful neural network
28
+ # models.
29
+ # - [Product Documentation][]
30
+ #
31
+ # ## Quick Start
32
+ # In order to use this library, you first need to go through the following
33
+ # steps:
34
+ #
35
+ # 1. [Select or create a Cloud Platform project.](https://console.cloud.google.com/project)
36
+ # 2. [Enable billing for your project.](https://cloud.google.com/billing/docs/how-to/modify-project#enable_billing_for_a_project)
37
+ # 3. [Enable the Cloud Text-to-Speech API.](https://console.cloud.google.com/apis/library/texttospeech.googleapis.com)
38
+ # 4. [Setup Authentication.](https://googleapis.github.io/google-cloud-ruby/#/docs/google-cloud/master/guides/authentication)
39
+ #
40
+ # ### Installation
41
+ # ```
42
+ # $ gem install google-cloud-text_to_speech
43
+ # ```
44
+ #
45
+ # ### Preview
46
+ # #### TextToSpeechClient
47
+ # ```rb
48
+ # require "google/cloud/text_to_speech"
49
+ #
50
+ # text_to_speech_client = Google::Cloud::TextToSpeech.new(version: :v1beta1)
51
+ # text = "test"
52
+ # input = { text: text }
53
+ # language_code = "en-US"
54
+ # voice = { language_code: language_code }
55
+ # audio_encoding = :MP3
56
+ # audio_config = { audio_encoding: audio_encoding }
57
+ # response = text_to_speech_client.synthesize_speech(input, voice, audio_config)
58
+ # ```
59
+ #
60
+ # ### Next Steps
61
+ # - Read the [Cloud Text-to-Speech API Product documentation][Product Documentation]
62
+ # to learn more about the product and see How-to Guides.
63
+ # - View this [repository's main README](https://github.com/googleapis/google-cloud-ruby/blob/master/README.md)
64
+ # to see the full list of Cloud APIs that we cover.
65
+ #
66
+ # [Product Documentation]: https://cloud.google.com/texttospeech
67
+ #
68
+ # ## Enabling Logging
69
+ #
70
+ # To enable logging for this library, set the logger for the underlying [gRPC](https://github.com/grpc/grpc/tree/master/src/ruby) library.
71
+ # The logger that you set may be a Ruby stdlib [`Logger`](https://ruby-doc.org/stdlib-2.5.0/libdoc/logger/rdoc/Logger.html) as shown below,
72
+ # or a [`Google::Cloud::Logging::Logger`](https://googleapis.github.io/google-cloud-ruby/#/docs/google-cloud-logging/latest/google/cloud/logging/logger)
73
+ # that will write logs to [Stackdriver Logging](https://cloud.google.com/logging/). See [grpc/logconfig.rb](https://github.com/grpc/grpc/blob/master/src/ruby/lib/grpc/logconfig.rb)
74
+ # and the gRPC [spec_helper.rb](https://github.com/grpc/grpc/blob/master/src/ruby/spec/spec_helper.rb) for additional information.
75
+ #
76
+ # Configuring a Ruby stdlib logger:
77
+ #
78
+ # ```ruby
79
+ # require "logger"
80
+ #
81
+ # module MyLogger
82
+ # LOGGER = Logger.new $stderr, level: Logger::WARN
83
+ # def logger
84
+ # LOGGER
85
+ # end
86
+ # end
87
+ #
88
+ # # Define a gRPC module-level logger method before grpc/logconfig.rb loads.
89
+ # module GRPC
90
+ # extend MyLogger
91
+ # end
92
+ # ```
93
+ #
94
+ module V1beta1
95
+ # rubocop:enable LineLength
96
+
97
+ ##
98
+ # Service that implements Google Cloud Text-to-Speech API.
99
+ #
100
+ # @param credentials [Google::Auth::Credentials, String, Hash, GRPC::Core::Channel, GRPC::Core::ChannelCredentials, Proc]
101
+ # Provides the means for authenticating requests made by the client. This parameter can
102
+ # be many types.
103
+ # A `Google::Auth::Credentials` uses a the properties of its represented keyfile for
104
+ # authenticating requests made by this client.
105
+ # A `String` will be treated as the path to the keyfile to be used for the construction of
106
+ # credentials for this client.
107
+ # A `Hash` will be treated as the contents of a keyfile to be used for the construction of
108
+ # credentials for this client.
109
+ # A `GRPC::Core::Channel` will be used to make calls through.
110
+ # A `GRPC::Core::ChannelCredentials` for the setting up the RPC client. The channel credentials
111
+ # should already be composed with a `GRPC::Core::CallCredentials` object.
112
+ # A `Proc` will be used as an updater_proc for the Grpc channel. The proc transforms the
113
+ # metadata for requests, generally, to give OAuth credentials.
114
+ # @param scopes [Array<String>]
115
+ # The OAuth scopes for this service. This parameter is ignored if
116
+ # an updater_proc is supplied.
117
+ # @param client_config [Hash]
118
+ # A Hash for call options for each method. See
119
+ # Google::Gax#construct_settings for the structure of
120
+ # this data. Falls back to the default config if not specified
121
+ # or the specified config is missing data points.
122
+ # @param timeout [Numeric]
123
+ # The default timeout, in seconds, for calls made through this client.
124
+ # @param metadata [Hash]
125
+ # Default metadata to be sent with each request. This can be overridden on a per call basis.
126
+ # @param exception_transformer [Proc]
127
+ # An optional proc that intercepts any exceptions raised during an API call to inject
128
+ # custom error handling.
129
+ def self.new \
130
+ credentials: nil,
131
+ scopes: nil,
132
+ client_config: nil,
133
+ timeout: nil,
134
+ metadata: nil,
135
+ exception_transformer: nil,
136
+ lib_name: nil,
137
+ lib_version: nil
138
+ kwargs = {
139
+ credentials: credentials,
140
+ scopes: scopes,
141
+ client_config: client_config,
142
+ timeout: timeout,
143
+ metadata: metadata,
144
+ exception_transformer: exception_transformer,
145
+ lib_name: lib_name,
146
+ lib_version: lib_version
147
+ }.select { |_, v| v != nil }
148
+ Google::Cloud::TextToSpeech::V1beta1::TextToSpeechClient.new(**kwargs)
149
+ end
150
+ end
151
+ end
152
+ end
153
+ end
@@ -0,0 +1,41 @@
1
+ # Copyright 2019 Google LLC
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # https://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+
16
+ require "googleauth"
17
+
18
+ module Google
19
+ module Cloud
20
+ module TextToSpeech
21
+ module V1beta1
22
+ class Credentials < Google::Auth::Credentials
23
+ SCOPE = [
24
+ "https://www.googleapis.com/auth/cloud-platform"
25
+ ].freeze
26
+ PATH_ENV_VARS = %w(TEXTTOSPEECH_CREDENTIALS
27
+ TEXTTOSPEECH_KEYFILE
28
+ GOOGLE_CLOUD_CREDENTIALS
29
+ GOOGLE_CLOUD_KEYFILE
30
+ GCLOUD_KEYFILE)
31
+ JSON_ENV_VARS = %w(TEXTTOSPEECH_CREDENTIALS_JSON
32
+ TEXTTOSPEECH_KEYFILE_JSON
33
+ GOOGLE_CLOUD_CREDENTIALS_JSON
34
+ GOOGLE_CLOUD_KEYFILE_JSON
35
+ GCLOUD_KEYFILE_JSON)
36
+ DEFAULT_PATHS = ["~/.config/gcloud/application_default_credentials.json"]
37
+ end
38
+ end
39
+ end
40
+ end
41
+ end
@@ -0,0 +1,201 @@
1
+ # Copyright 2019 Google LLC
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # https://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+
16
+ module Google
17
+ module Cloud
18
+ module Texttospeech
19
+ module V1beta1
20
+ # The top-level message sent by the client for the `ListVoices` method.
21
+ # @!attribute [rw] language_code
22
+ # @return [String]
23
+ # Optional (but recommended)
24
+ # [BCP-47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt) language tag. If
25
+ # specified, the ListVoices call will only return voices that can be used to
26
+ # synthesize this language_code. E.g. when specifying "en-NZ", you will get
27
+ # supported "en-*" voices; when specifying "no", you will get supported
28
+ # "no-*" (Norwegian) and "nb-*" (Norwegian Bokmal) voices; specifying "zh"
29
+ # will also get supported "cmn-*" voices; specifying "zh-hk" will also get
30
+ # supported "yue-*" voices.
31
+ class ListVoicesRequest; end
32
+
33
+ # The message returned to the client by the `ListVoices` method.
34
+ # @!attribute [rw] voices
35
+ # @return [Array<Google::Cloud::Texttospeech::V1beta1::Voice>]
36
+ # The list of voices.
37
+ class ListVoicesResponse; end
38
+
39
+ # Description of a voice supported by the TTS service.
40
+ # @!attribute [rw] language_codes
41
+ # @return [Array<String>]
42
+ # The languages that this voice supports, expressed as
43
+ # [BCP-47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt) language tags (e.g.
44
+ # "en-US", "es-419", "cmn-tw").
45
+ # @!attribute [rw] name
46
+ # @return [String]
47
+ # The name of this voice. Each distinct voice has a unique name.
48
+ # @!attribute [rw] ssml_gender
49
+ # @return [Google::Cloud::Texttospeech::V1beta1::SsmlVoiceGender]
50
+ # The gender of this voice.
51
+ # @!attribute [rw] natural_sample_rate_hertz
52
+ # @return [Integer]
53
+ # The natural sample rate (in hertz) for this voice.
54
+ class Voice; end
55
+
56
+ # The top-level message sent by the client for the `SynthesizeSpeech` method.
57
+ # @!attribute [rw] input
58
+ # @return [Google::Cloud::Texttospeech::V1beta1::SynthesisInput]
59
+ # Required. The Synthesizer requires either plain text or SSML as input.
60
+ # @!attribute [rw] voice
61
+ # @return [Google::Cloud::Texttospeech::V1beta1::VoiceSelectionParams]
62
+ # Required. The desired voice of the synthesized audio.
63
+ # @!attribute [rw] audio_config
64
+ # @return [Google::Cloud::Texttospeech::V1beta1::AudioConfig]
65
+ # Required. The configuration of the synthesized audio.
66
+ class SynthesizeSpeechRequest; end
67
+
68
+ # Contains text input to be synthesized. Either `text` or `ssml` must be
69
+ # supplied. Supplying both or neither returns
70
+ # {Google::Rpc::Code::INVALID_ARGUMENT}. The input size is limited to 5000
71
+ # characters.
72
+ # @!attribute [rw] text
73
+ # @return [String]
74
+ # The raw text to be synthesized.
75
+ # @!attribute [rw] ssml
76
+ # @return [String]
77
+ # The SSML document to be synthesized. The SSML document must be valid
78
+ # and well-formed. Otherwise the RPC will fail and return
79
+ # {Google::Rpc::Code::INVALID_ARGUMENT}. For more information, see
80
+ # [SSML](https://cloud.google.com/speech/text-to-speech/docs/ssml).
81
+ class SynthesisInput; end
82
+
83
+ # Description of which voice to use for a synthesis request.
84
+ # @!attribute [rw] language_code
85
+ # @return [String]
86
+ # The language (and optionally also the region) of the voice expressed as a
87
+ # [BCP-47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt) language tag, e.g.
88
+ # "en-US". Required. This should not include a script tag (e.g. use
89
+ # "cmn-cn" rather than "cmn-Hant-cn"), because the script will be inferred
90
+ # from the input provided in the SynthesisInput. The TTS service
91
+ # will use this parameter to help choose an appropriate voice. Note that
92
+ # the TTS service may choose a voice with a slightly different language code
93
+ # than the one selected; it may substitute a different region
94
+ # (e.g. using en-US rather than en-CA if there isn't a Canadian voice
95
+ # available), or even a different language, e.g. using "nb" (Norwegian
96
+ # Bokmal) instead of "no" (Norwegian)".
97
+ # @!attribute [rw] name
98
+ # @return [String]
99
+ # The name of the voice. Optional; if not set, the service will choose a
100
+ # voice based on the other parameters such as language_code and gender.
101
+ # @!attribute [rw] ssml_gender
102
+ # @return [Google::Cloud::Texttospeech::V1beta1::SsmlVoiceGender]
103
+ # The preferred gender of the voice. Optional; if not set, the service will
104
+ # choose a voice based on the other parameters such as language_code and
105
+ # name. Note that this is only a preference, not requirement; if a
106
+ # voice of the appropriate gender is not available, the synthesizer should
107
+ # substitute a voice with a different gender rather than failing the request.
108
+ class VoiceSelectionParams; end
109
+
110
+ # Description of audio data to be synthesized.
111
+ # @!attribute [rw] audio_encoding
112
+ # @return [Google::Cloud::Texttospeech::V1beta1::AudioEncoding]
113
+ # Required. The format of the requested audio byte stream.
114
+ # @!attribute [rw] speaking_rate
115
+ # @return [Float]
116
+ # Optional speaking rate/speed, in the range [0.25, 4.0]. 1.0 is the normal
117
+ # native speed supported by the specific voice. 2.0 is twice as fast, and
118
+ # 0.5 is half as fast. If unset(0.0), defaults to the native 1.0 speed. Any
119
+ # other values < 0.25 or > 4.0 will return an error.
120
+ # @!attribute [rw] pitch
121
+ # @return [Float]
122
+ # Optional speaking pitch, in the range [-20.0, 20.0]. 20 means increase 20
123
+ # semitones from the original pitch. -20 means decrease 20 semitones from the
124
+ # original pitch.
125
+ # @!attribute [rw] volume_gain_db
126
+ # @return [Float]
127
+ # Optional volume gain (in dB) of the normal native volume supported by the
128
+ # specific voice, in the range [-96.0, 16.0]. If unset, or set to a value of
129
+ # 0.0 (dB), will play at normal native signal amplitude. A value of -6.0 (dB)
130
+ # will play at approximately half the amplitude of the normal native signal
131
+ # amplitude. A value of +6.0 (dB) will play at approximately twice the
132
+ # amplitude of the normal native signal amplitude. Strongly recommend not to
133
+ # exceed +10 (dB) as there's usually no effective increase in loudness for
134
+ # any value greater than that.
135
+ # @!attribute [rw] sample_rate_hertz
136
+ # @return [Integer]
137
+ # The synthesis sample rate (in hertz) for this audio. Optional. If this is
138
+ # different from the voice's natural sample rate, then the synthesizer will
139
+ # honor this request by converting to the desired sample rate (which might
140
+ # result in worse audio quality), unless the specified sample rate is not
141
+ # supported for the encoding chosen, in which case it will fail the request
142
+ # and return {Google::Rpc::Code::INVALID_ARGUMENT}.
143
+ # @!attribute [rw] effects_profile_id
144
+ # @return [Array<String>]
145
+ # An identifier which selects 'audio effects' profiles that are applied on
146
+ # (post synthesized) text to speech.
147
+ # Effects are applied on top of each other in the order they are given.
148
+ class AudioConfig; end
149
+
150
+ # The message returned to the client by the `SynthesizeSpeech` method.
151
+ # @!attribute [rw] audio_content
152
+ # @return [String]
153
+ # The audio data bytes encoded as specified in the request, including the
154
+ # header (For LINEAR16 audio, we include the WAV header). Note: as
155
+ # with all bytes fields, protobuffers use a pure binary representation,
156
+ # whereas JSON representations use base64.
157
+ class SynthesizeSpeechResponse; end
158
+
159
+ # Configuration to set up audio encoder. The encoding determines the output
160
+ # audio format that we'd like.
161
+ module AudioEncoding
162
+ # Not specified. Will return result {Google::Rpc::Code::INVALID_ARGUMENT}.
163
+ AUDIO_ENCODING_UNSPECIFIED = 0
164
+
165
+ # Uncompressed 16-bit signed little-endian samples (Linear PCM).
166
+ # Audio content returned as LINEAR16 also contains a WAV header.
167
+ LINEAR16 = 1
168
+
169
+ # MP3 audio.
170
+ MP3 = 2
171
+
172
+ # Opus encoded audio wrapped in an ogg container. The result will be a
173
+ # file which can be played natively on Android, and in browsers (at least
174
+ # Chrome and Firefox). The quality of the encoding is considerably higher
175
+ # than MP3 while using approximately the same bitrate.
176
+ OGG_OPUS = 3
177
+ end
178
+
179
+ # Gender of the voice as described in
180
+ # [SSML voice element](https://www.w3.org/TR/speech-synthesis11/#edef_voice).
181
+ module SsmlVoiceGender
182
+ # An unspecified gender.
183
+ # In VoiceSelectionParams, this means that the client doesn't care which
184
+ # gender the selected voice will have. In the Voice field of
185
+ # ListVoicesResponse, this may mean that the voice doesn't fit any of the
186
+ # other categories in this enum, or that the gender of the voice isn't known.
187
+ SSML_VOICE_GENDER_UNSPECIFIED = 0
188
+
189
+ # A male voice.
190
+ MALE = 1
191
+
192
+ # A female voice.
193
+ FEMALE = 2
194
+
195
+ # A gender-neutral voice.
196
+ NEUTRAL = 3
197
+ end
198
+ end
199
+ end
200
+ end
201
+ end
@@ -0,0 +1,270 @@
1
+ # Copyright 2019 Google LLC
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # https://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+ #
15
+ # EDITING INSTRUCTIONS
16
+ # This file was generated from the file
17
+ # https://github.com/googleapis/googleapis/blob/master/google/cloud/texttospeech/v1beta1/cloud_tts.proto,
18
+ # and updates to that file get reflected here through a refresh process.
19
+ # For the short term, the refresh process will only be runnable by Google
20
+ # engineers.
21
+
22
+
23
+ require "json"
24
+ require "pathname"
25
+
26
+ require "google/gax"
27
+
28
+ require "google/cloud/texttospeech/v1beta1/cloud_tts_pb"
29
+ require "google/cloud/text_to_speech/v1beta1/credentials"
30
+
31
+ module Google
32
+ module Cloud
33
+ module TextToSpeech
34
+ module V1beta1
35
+ # Service that implements Google Cloud Text-to-Speech API.
36
+ #
37
+ # @!attribute [r] text_to_speech_stub
38
+ # @return [Google::Cloud::Texttospeech::V1beta1::TextToSpeech::Stub]
39
+ class TextToSpeechClient
40
+ # @private
41
+ attr_reader :text_to_speech_stub
42
+
43
+ # The default address of the service.
44
+ SERVICE_ADDRESS = "texttospeech.googleapis.com".freeze
45
+
46
+ # The default port of the service.
47
+ DEFAULT_SERVICE_PORT = 443
48
+
49
+ # The default set of gRPC interceptors.
50
+ GRPC_INTERCEPTORS = []
51
+
52
+ DEFAULT_TIMEOUT = 30
53
+
54
+ # The scopes needed to make gRPC calls to all of the methods defined in
55
+ # this service.
56
+ ALL_SCOPES = [
57
+ "https://www.googleapis.com/auth/cloud-platform"
58
+ ].freeze
59
+
60
+
61
+ # @param credentials [Google::Auth::Credentials, String, Hash, GRPC::Core::Channel, GRPC::Core::ChannelCredentials, Proc]
62
+ # Provides the means for authenticating requests made by the client. This parameter can
63
+ # be many types.
64
+ # A `Google::Auth::Credentials` uses a the properties of its represented keyfile for
65
+ # authenticating requests made by this client.
66
+ # A `String` will be treated as the path to the keyfile to be used for the construction of
67
+ # credentials for this client.
68
+ # A `Hash` will be treated as the contents of a keyfile to be used for the construction of
69
+ # credentials for this client.
70
+ # A `GRPC::Core::Channel` will be used to make calls through.
71
+ # A `GRPC::Core::ChannelCredentials` for the setting up the RPC client. The channel credentials
72
+ # should already be composed with a `GRPC::Core::CallCredentials` object.
73
+ # A `Proc` will be used as an updater_proc for the Grpc channel. The proc transforms the
74
+ # metadata for requests, generally, to give OAuth credentials.
75
+ # @param scopes [Array<String>]
76
+ # The OAuth scopes for this service. This parameter is ignored if
77
+ # an updater_proc is supplied.
78
+ # @param client_config [Hash]
79
+ # A Hash for call options for each method. See
80
+ # Google::Gax#construct_settings for the structure of
81
+ # this data. Falls back to the default config if not specified
82
+ # or the specified config is missing data points.
83
+ # @param timeout [Numeric]
84
+ # The default timeout, in seconds, for calls made through this client.
85
+ # @param metadata [Hash]
86
+ # Default metadata to be sent with each request. This can be overridden on a per call basis.
87
+ # @param exception_transformer [Proc]
88
+ # An optional proc that intercepts any exceptions raised during an API call to inject
89
+ # custom error handling.
90
+ def initialize \
91
+ credentials: nil,
92
+ scopes: ALL_SCOPES,
93
+ client_config: {},
94
+ timeout: DEFAULT_TIMEOUT,
95
+ metadata: nil,
96
+ exception_transformer: nil,
97
+ lib_name: nil,
98
+ lib_version: ""
99
+ # These require statements are intentionally placed here to initialize
100
+ # the gRPC module only when it's required.
101
+ # See https://github.com/googleapis/toolkit/issues/446
102
+ require "google/gax/grpc"
103
+ require "google/cloud/texttospeech/v1beta1/cloud_tts_services_pb"
104
+
105
+ credentials ||= Google::Cloud::TextToSpeech::V1beta1::Credentials.default
106
+
107
+ if credentials.is_a?(String) || credentials.is_a?(Hash)
108
+ updater_proc = Google::Cloud::TextToSpeech::V1beta1::Credentials.new(credentials).updater_proc
109
+ end
110
+ if credentials.is_a?(GRPC::Core::Channel)
111
+ channel = credentials
112
+ end
113
+ if credentials.is_a?(GRPC::Core::ChannelCredentials)
114
+ chan_creds = credentials
115
+ end
116
+ if credentials.is_a?(Proc)
117
+ updater_proc = credentials
118
+ end
119
+ if credentials.is_a?(Google::Auth::Credentials)
120
+ updater_proc = credentials.updater_proc
121
+ end
122
+
123
+ package_version = Gem.loaded_specs['google-cloud-text_to_speech'].version.version
124
+
125
+ google_api_client = "gl-ruby/#{RUBY_VERSION}"
126
+ google_api_client << " #{lib_name}/#{lib_version}" if lib_name
127
+ google_api_client << " gapic/#{package_version} gax/#{Google::Gax::VERSION}"
128
+ google_api_client << " grpc/#{GRPC::VERSION}"
129
+ google_api_client.freeze
130
+
131
+ headers = { :"x-goog-api-client" => google_api_client }
132
+ headers.merge!(metadata) unless metadata.nil?
133
+ client_config_file = Pathname.new(__dir__).join(
134
+ "text_to_speech_client_config.json"
135
+ )
136
+ defaults = client_config_file.open do |f|
137
+ Google::Gax.construct_settings(
138
+ "google.cloud.texttospeech.v1beta1.TextToSpeech",
139
+ JSON.parse(f.read),
140
+ client_config,
141
+ Google::Gax::Grpc::STATUS_CODE_NAMES,
142
+ timeout,
143
+ errors: Google::Gax::Grpc::API_ERRORS,
144
+ metadata: headers
145
+ )
146
+ end
147
+
148
+ # Allow overriding the service path/port in subclasses.
149
+ service_path = self.class::SERVICE_ADDRESS
150
+ port = self.class::DEFAULT_SERVICE_PORT
151
+ interceptors = self.class::GRPC_INTERCEPTORS
152
+ @text_to_speech_stub = Google::Gax::Grpc.create_stub(
153
+ service_path,
154
+ port,
155
+ chan_creds: chan_creds,
156
+ channel: channel,
157
+ updater_proc: updater_proc,
158
+ scopes: scopes,
159
+ interceptors: interceptors,
160
+ &Google::Cloud::Texttospeech::V1beta1::TextToSpeech::Stub.method(:new)
161
+ )
162
+
163
+ @list_voices = Google::Gax.create_api_call(
164
+ @text_to_speech_stub.method(:list_voices),
165
+ defaults["list_voices"],
166
+ exception_transformer: exception_transformer
167
+ )
168
+ @synthesize_speech = Google::Gax.create_api_call(
169
+ @text_to_speech_stub.method(:synthesize_speech),
170
+ defaults["synthesize_speech"],
171
+ exception_transformer: exception_transformer
172
+ )
173
+ end
174
+
175
+ # Service calls
176
+
177
+ # Returns a list of {Google::Cloud::Texttospeech::V1beta1::Voice Voice}
178
+ # supported for synthesis.
179
+ #
180
+ # @param language_code [String]
181
+ # Optional (but recommended)
182
+ # [BCP-47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt) language tag. If
183
+ # specified, the ListVoices call will only return voices that can be used to
184
+ # synthesize this language_code. E.g. when specifying "en-NZ", you will get
185
+ # supported "en-*" voices; when specifying "no", you will get supported
186
+ # "no-*" (Norwegian) and "nb-*" (Norwegian Bokmal) voices; specifying "zh"
187
+ # will also get supported "cmn-*" voices; specifying "zh-hk" will also get
188
+ # supported "yue-*" voices.
189
+ # @param options [Google::Gax::CallOptions]
190
+ # Overrides the default settings for this call, e.g, timeout,
191
+ # retries, etc.
192
+ # @yield [result, operation] Access the result along with the RPC operation
193
+ # @yieldparam result [Google::Cloud::Texttospeech::V1beta1::ListVoicesResponse]
194
+ # @yieldparam operation [GRPC::ActiveCall::Operation]
195
+ # @return [Google::Cloud::Texttospeech::V1beta1::ListVoicesResponse]
196
+ # @raise [Google::Gax::GaxError] if the RPC is aborted.
197
+ # @example
198
+ # require "google/cloud/text_to_speech"
199
+ #
200
+ # text_to_speech_client = Google::Cloud::TextToSpeech.new(version: :v1beta1)
201
+ # response = text_to_speech_client.list_voices
202
+
203
+ def list_voices \
204
+ language_code: nil,
205
+ options: nil,
206
+ &block
207
+ req = {
208
+ language_code: language_code
209
+ }.delete_if { |_, v| v.nil? }
210
+ req = Google::Gax::to_proto(req, Google::Cloud::Texttospeech::V1beta1::ListVoicesRequest)
211
+ @list_voices.call(req, options, &block)
212
+ end
213
+
214
+ # Synthesizes speech synchronously: receive results after all text input
215
+ # has been processed.
216
+ #
217
+ # @param input [Google::Cloud::Texttospeech::V1beta1::SynthesisInput | Hash]
218
+ # Required. The Synthesizer requires either plain text or SSML as input.
219
+ # A hash of the same form as `Google::Cloud::Texttospeech::V1beta1::SynthesisInput`
220
+ # can also be provided.
221
+ # @param voice [Google::Cloud::Texttospeech::V1beta1::VoiceSelectionParams | Hash]
222
+ # Required. The desired voice of the synthesized audio.
223
+ # A hash of the same form as `Google::Cloud::Texttospeech::V1beta1::VoiceSelectionParams`
224
+ # can also be provided.
225
+ # @param audio_config [Google::Cloud::Texttospeech::V1beta1::AudioConfig | Hash]
226
+ # Required. The configuration of the synthesized audio.
227
+ # A hash of the same form as `Google::Cloud::Texttospeech::V1beta1::AudioConfig`
228
+ # can also be provided.
229
+ # @param options [Google::Gax::CallOptions]
230
+ # Overrides the default settings for this call, e.g, timeout,
231
+ # retries, etc.
232
+ # @yield [result, operation] Access the result along with the RPC operation
233
+ # @yieldparam result [Google::Cloud::Texttospeech::V1beta1::SynthesizeSpeechResponse]
234
+ # @yieldparam operation [GRPC::ActiveCall::Operation]
235
+ # @return [Google::Cloud::Texttospeech::V1beta1::SynthesizeSpeechResponse]
236
+ # @raise [Google::Gax::GaxError] if the RPC is aborted.
237
+ # @example
238
+ # require "google/cloud/text_to_speech"
239
+ #
240
+ # text_to_speech_client = Google::Cloud::TextToSpeech.new(version: :v1beta1)
241
+ #
242
+ # # TODO: Initialize `input`:
243
+ # input = {}
244
+ #
245
+ # # TODO: Initialize `voice`:
246
+ # voice = {}
247
+ #
248
+ # # TODO: Initialize `audio_config`:
249
+ # audio_config = {}
250
+ # response = text_to_speech_client.synthesize_speech(input, voice, audio_config)
251
+
252
+ def synthesize_speech \
253
+ input,
254
+ voice,
255
+ audio_config,
256
+ options: nil,
257
+ &block
258
+ req = {
259
+ input: input,
260
+ voice: voice,
261
+ audio_config: audio_config
262
+ }.delete_if { |_, v| v.nil? }
263
+ req = Google::Gax::to_proto(req, Google::Cloud::Texttospeech::V1beta1::SynthesizeSpeechRequest)
264
+ @synthesize_speech.call(req, options, &block)
265
+ end
266
+ end
267
+ end
268
+ end
269
+ end
270
+ end
@@ -0,0 +1,36 @@
1
+ {
2
+ "interfaces": {
3
+ "google.cloud.texttospeech.v1beta1.TextToSpeech": {
4
+ "retry_codes": {
5
+ "idempotent": [
6
+ "DEADLINE_EXCEEDED",
7
+ "UNAVAILABLE"
8
+ ],
9
+ "non_idempotent": []
10
+ },
11
+ "retry_params": {
12
+ "default": {
13
+ "initial_retry_delay_millis": 100,
14
+ "retry_delay_multiplier": 1.3,
15
+ "max_retry_delay_millis": 60000,
16
+ "initial_rpc_timeout_millis": 20000,
17
+ "rpc_timeout_multiplier": 1.0,
18
+ "max_rpc_timeout_millis": 20000,
19
+ "total_timeout_millis": 600000
20
+ }
21
+ },
22
+ "methods": {
23
+ "ListVoices": {
24
+ "timeout_millis": 30000,
25
+ "retry_codes_name": "idempotent",
26
+ "retry_params_name": "default"
27
+ },
28
+ "SynthesizeSpeech": {
29
+ "timeout_millis": 60000,
30
+ "retry_codes_name": "idempotent",
31
+ "retry_params_name": "default"
32
+ }
33
+ }
34
+ }
35
+ }
36
+ }
@@ -0,0 +1,79 @@
1
+ # Generated by the protocol buffer compiler. DO NOT EDIT!
2
+ # source: google/cloud/texttospeech/v1beta1/cloud_tts.proto
3
+
4
+
5
+ require 'google/protobuf'
6
+
7
+ require 'google/api/annotations_pb'
8
+ Google::Protobuf::DescriptorPool.generated_pool.build do
9
+ add_message "google.cloud.texttospeech.v1beta1.ListVoicesRequest" do
10
+ optional :language_code, :string, 1
11
+ end
12
+ add_message "google.cloud.texttospeech.v1beta1.ListVoicesResponse" do
13
+ repeated :voices, :message, 1, "google.cloud.texttospeech.v1beta1.Voice"
14
+ end
15
+ add_message "google.cloud.texttospeech.v1beta1.Voice" do
16
+ repeated :language_codes, :string, 1
17
+ optional :name, :string, 2
18
+ optional :ssml_gender, :enum, 3, "google.cloud.texttospeech.v1beta1.SsmlVoiceGender"
19
+ optional :natural_sample_rate_hertz, :int32, 4
20
+ end
21
+ add_message "google.cloud.texttospeech.v1beta1.SynthesizeSpeechRequest" do
22
+ optional :input, :message, 1, "google.cloud.texttospeech.v1beta1.SynthesisInput"
23
+ optional :voice, :message, 2, "google.cloud.texttospeech.v1beta1.VoiceSelectionParams"
24
+ optional :audio_config, :message, 3, "google.cloud.texttospeech.v1beta1.AudioConfig"
25
+ end
26
+ add_message "google.cloud.texttospeech.v1beta1.SynthesisInput" do
27
+ oneof :input_source do
28
+ optional :text, :string, 1
29
+ optional :ssml, :string, 2
30
+ end
31
+ end
32
+ add_message "google.cloud.texttospeech.v1beta1.VoiceSelectionParams" do
33
+ optional :language_code, :string, 1
34
+ optional :name, :string, 2
35
+ optional :ssml_gender, :enum, 3, "google.cloud.texttospeech.v1beta1.SsmlVoiceGender"
36
+ end
37
+ add_message "google.cloud.texttospeech.v1beta1.AudioConfig" do
38
+ optional :audio_encoding, :enum, 1, "google.cloud.texttospeech.v1beta1.AudioEncoding"
39
+ optional :speaking_rate, :double, 2
40
+ optional :pitch, :double, 3
41
+ optional :volume_gain_db, :double, 4
42
+ optional :sample_rate_hertz, :int32, 5
43
+ repeated :effects_profile_id, :string, 6
44
+ end
45
+ add_message "google.cloud.texttospeech.v1beta1.SynthesizeSpeechResponse" do
46
+ optional :audio_content, :bytes, 1
47
+ end
48
+ add_enum "google.cloud.texttospeech.v1beta1.SsmlVoiceGender" do
49
+ value :SSML_VOICE_GENDER_UNSPECIFIED, 0
50
+ value :MALE, 1
51
+ value :FEMALE, 2
52
+ value :NEUTRAL, 3
53
+ end
54
+ add_enum "google.cloud.texttospeech.v1beta1.AudioEncoding" do
55
+ value :AUDIO_ENCODING_UNSPECIFIED, 0
56
+ value :LINEAR16, 1
57
+ value :MP3, 2
58
+ value :OGG_OPUS, 3
59
+ end
60
+ end
61
+
62
+ module Google
63
+ module Cloud
64
+ module Texttospeech
65
+ module V1beta1
66
+ ListVoicesRequest = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.texttospeech.v1beta1.ListVoicesRequest").msgclass
67
+ ListVoicesResponse = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.texttospeech.v1beta1.ListVoicesResponse").msgclass
68
+ Voice = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.texttospeech.v1beta1.Voice").msgclass
69
+ SynthesizeSpeechRequest = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.texttospeech.v1beta1.SynthesizeSpeechRequest").msgclass
70
+ SynthesisInput = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.texttospeech.v1beta1.SynthesisInput").msgclass
71
+ VoiceSelectionParams = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.texttospeech.v1beta1.VoiceSelectionParams").msgclass
72
+ AudioConfig = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.texttospeech.v1beta1.AudioConfig").msgclass
73
+ SynthesizeSpeechResponse = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.texttospeech.v1beta1.SynthesizeSpeechResponse").msgclass
74
+ SsmlVoiceGender = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.texttospeech.v1beta1.SsmlVoiceGender").enummodule
75
+ AudioEncoding = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.texttospeech.v1beta1.AudioEncoding").enummodule
76
+ end
77
+ end
78
+ end
79
+ end
@@ -0,0 +1,50 @@
1
+ # Generated by the protocol buffer compiler. DO NOT EDIT!
2
+ # Source: google/cloud/texttospeech/v1beta1/cloud_tts.proto for package 'google.cloud.texttospeech.v1beta1'
3
+ # Original file comments:
4
+ # Copyright 2018 Google Inc.
5
+ #
6
+ # Licensed under the Apache License, Version 2.0 (the "License");
7
+ # you may not use this file except in compliance with the License.
8
+ # You may obtain a copy of the License at
9
+ #
10
+ # http://www.apache.org/licenses/LICENSE-2.0
11
+ #
12
+ # Unless required by applicable law or agreed to in writing, software
13
+ # distributed under the License is distributed on an "AS IS" BASIS,
14
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ # See the License for the specific language governing permissions and
16
+ # limitations under the License.
17
+ #
18
+
19
+
20
+ require 'grpc'
21
+ require 'google/cloud/texttospeech/v1beta1/cloud_tts_pb'
22
+
23
+ module Google
24
+ module Cloud
25
+ module Texttospeech
26
+ module V1beta1
27
+ module TextToSpeech
28
+ # Service that implements Google Cloud Text-to-Speech API.
29
+ class Service
30
+
31
+ include GRPC::GenericService
32
+
33
+ self.marshal_class_method = :encode
34
+ self.unmarshal_class_method = :decode
35
+ self.service_name = 'google.cloud.texttospeech.v1beta1.TextToSpeech'
36
+
37
+ # Returns a list of [Voice][google.cloud.texttospeech.v1beta1.Voice]
38
+ # supported for synthesis.
39
+ rpc :ListVoices, ListVoicesRequest, ListVoicesResponse
40
+ # Synthesizes speech synchronously: receive results after all text input
41
+ # has been processed.
42
+ rpc :SynthesizeSpeech, SynthesizeSpeechRequest, SynthesizeSpeechResponse
43
+ end
44
+
45
+ Stub = Service.rpc_stub_class
46
+ end
47
+ end
48
+ end
49
+ end
50
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: google-cloud-text_to_speech
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Google LLC
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-02-04 00:00:00.000000000 Z
11
+ date: 2019-04-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: google-gax
@@ -58,14 +58,14 @@ dependencies:
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: 0.61.0
61
+ version: 0.64.0
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: 0.61.0
68
+ version: 0.64.0
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: simplecov
71
71
  requirement: !ruby/object:Gem::Requirement
@@ -102,6 +102,7 @@ extensions: []
102
102
  extra_rdoc_files: []
103
103
  files:
104
104
  - ".yardopts"
105
+ - AUTHENTICATION.md
105
106
  - LICENSE
106
107
  - README.md
107
108
  - lib/google/cloud/text_to_speech.rb
@@ -110,8 +111,15 @@ files:
110
111
  - lib/google/cloud/text_to_speech/v1/doc/google/cloud/texttospeech/v1/cloud_tts.rb
111
112
  - lib/google/cloud/text_to_speech/v1/text_to_speech_client.rb
112
113
  - lib/google/cloud/text_to_speech/v1/text_to_speech_client_config.json
114
+ - lib/google/cloud/text_to_speech/v1beta1.rb
115
+ - lib/google/cloud/text_to_speech/v1beta1/credentials.rb
116
+ - lib/google/cloud/text_to_speech/v1beta1/doc/google/cloud/texttospeech/v1beta1/cloud_tts.rb
117
+ - lib/google/cloud/text_to_speech/v1beta1/text_to_speech_client.rb
118
+ - lib/google/cloud/text_to_speech/v1beta1/text_to_speech_client_config.json
113
119
  - lib/google/cloud/texttospeech/v1/cloud_tts_pb.rb
114
120
  - lib/google/cloud/texttospeech/v1/cloud_tts_services_pb.rb
121
+ - lib/google/cloud/texttospeech/v1beta1/cloud_tts_pb.rb
122
+ - lib/google/cloud/texttospeech/v1beta1/cloud_tts_services_pb.rb
115
123
  homepage: https://github.com/googleapis/googleapis
116
124
  licenses:
117
125
  - Apache-2.0
@@ -131,8 +139,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
131
139
  - !ruby/object:Gem::Version
132
140
  version: '0'
133
141
  requirements: []
134
- rubyforge_project:
135
- rubygems_version: 2.7.6
142
+ rubygems_version: 3.0.3
136
143
  signing_key:
137
144
  specification_version: 4
138
145
  summary: API Client library for Cloud Text-to-Speech API