Skip to content

Commit 380b2f0

Browse files
Google APIscopybara-github
authored andcommitted
feat: add LRS API
PiperOrigin-RevId: 493338018
1 parent 5eb235d commit 380b2f0

6 files changed

Lines changed: 162 additions & 20 deletions

File tree

google/cloud/texttospeech/v1/BUILD.bazel

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,10 @@ py_gapic_library(
169169
srcs = [":texttospeech_proto"],
170170
grpc_service_config = "texttospeech_grpc_service_config.json",
171171
rest_numeric_enums = True,
172+
service_yaml = "texttospeech_v1.yaml",
172173
transport = "grpc",
174+
deps = [
175+
],
173176
)
174177

175178
py_test(
@@ -301,6 +304,7 @@ ruby_cloud_gapic_library(
301304
rest_numeric_enums = True,
302305
ruby_cloud_description = "Text-to-Speech converts text or Speech Synthesis Markup Language (SSML) input into audio data of natural human speech.",
303306
ruby_cloud_title = "Cloud Text-to-Speech V1",
307+
service_yaml = "texttospeech_v1.yaml",
304308
deps = [
305309
":texttospeech_ruby_grpc",
306310
":texttospeech_ruby_proto",

google/cloud/texttospeech/v1beta1/BUILD.bazel

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,15 @@ proto_library(
2222
name = "texttospeech_proto",
2323
srcs = [
2424
"cloud_tts.proto",
25+
"cloud_tts_lrs.proto",
2526
],
2627
deps = [
2728
"//google/api:annotations_proto",
2829
"//google/api:client_proto",
2930
"//google/api:field_behavior_proto",
3031
"//google/api:resource_proto",
32+
"//google/longrunning:operations_proto",
33+
"@com_google_protobuf//:timestamp_proto",
3134
],
3235
)
3336

@@ -84,6 +87,8 @@ java_gapic_test(
8487
test_classes = [
8588
"com.google.cloud.texttospeech.v1beta1.TextToSpeechClientHttpJsonTest",
8689
"com.google.cloud.texttospeech.v1beta1.TextToSpeechClientTest",
90+
"com.google.cloud.texttospeech.v1beta1.TextToSpeechLongAudioSynthesizeClientHttpJsonTest",
91+
"com.google.cloud.texttospeech.v1beta1.TextToSpeechLongAudioSynthesizeClientTest",
8792
],
8893
runtime_deps = [":texttospeech_java_gapic_test"],
8994
)
@@ -119,6 +124,7 @@ go_proto_library(
119124
protos = [":texttospeech_proto"],
120125
deps = [
121126
"//google/api:annotations_go_proto",
127+
"//google/longrunning:longrunning_go_proto",
122128
],
123129
)
124130

@@ -133,6 +139,9 @@ go_gapic_library(
133139
transport = "grpc+rest",
134140
deps = [
135141
":texttospeech_go_proto",
142+
"//google/longrunning:longrunning_go_proto",
143+
"@com_google_cloud_go//longrunning:go_default_library",
144+
"@com_google_cloud_go//longrunning/autogen:go_default_library",
136145
],
137146
)
138147

@@ -169,7 +178,10 @@ py_gapic_library(
169178
srcs = [":texttospeech_proto"],
170179
grpc_service_config = "texttospeech_grpc_service_config.json",
171180
rest_numeric_enums = True,
181+
service_yaml = "texttospeech_v1beta1.yaml",
172182
transport = "grpc",
183+
deps = [
184+
],
173185
)
174186

175187
py_test(
@@ -301,6 +313,7 @@ ruby_cloud_gapic_library(
301313
rest_numeric_enums = True,
302314
ruby_cloud_description = "Text-to-Speech converts text or Speech Synthesis Markup Language (SSML) input into audio data of natural human speech.",
303315
ruby_cloud_title = "Cloud Text-to-Speech V1beta1",
316+
service_yaml = "texttospeech_v1beta1.yaml",
304317
deps = [
305318
":texttospeech_ruby_grpc",
306319
":texttospeech_ruby_proto",
@@ -365,4 +378,20 @@ csharp_gapic_assembly_pkg(
365378
##############################################################################
366379
# C++
367380
##############################################################################
368-
# Put your C++ rules here
381+
load(
382+
"@com_google_googleapis_imports//:imports.bzl",
383+
"cc_grpc_library",
384+
"cc_proto_library",
385+
)
386+
387+
cc_proto_library(
388+
name = "texttospeech_cc_proto",
389+
deps = [":texttospeech_proto"],
390+
)
391+
392+
cc_grpc_library(
393+
name = "texttospeech_cc_grpc",
394+
srcs = [":texttospeech_proto"],
395+
grpc_only = True,
396+
deps = [":texttospeech_cc_proto"],
397+
)

google/cloud/texttospeech/v1beta1/cloud_tts.proto

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2021 Google LLC
1+
// Copyright 2022 Google LLC
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.
@@ -58,19 +58,6 @@ service TextToSpeech {
5858
}
5959
}
6060

61-
// The top-level message sent by the client for the `ListVoices` method.
62-
message ListVoicesRequest {
63-
// Optional. Recommended.
64-
// [BCP-47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt) language tag.
65-
// If not specified, the API will return all supported voices.
66-
// If specified, the ListVoices call will only return voices that can be used
67-
// to synthesize this language_code. For example, if you specify `"en-NZ"`,
68-
// all `"en-NZ"` voices will be returned. If you specify `"no"`, both
69-
// `"no-\*"` (Norwegian) and `"nb-\*"` (Norwegian Bokmal) voices will be
70-
// returned.
71-
string language_code = 1 [(google.api.field_behavior) = OPTIONAL];
72-
}
73-
7461
// Gender of the voice as described in
7562
// [SSML voice element](https://www.w3.org/TR/speech-synthesis11/#edef_voice).
7663
enum SsmlVoiceGender {
@@ -94,7 +81,7 @@ enum SsmlVoiceGender {
9481
// Configuration to set up audio encoder. The encoding determines the output
9582
// audio format that we'd like.
9683
enum AudioEncoding {
97-
// Not specified. Will return result [google.rpc.Code.INVALID_ARGUMENT][].
84+
// Not specified. Will return result [google.rpc.Code.INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT].
9885
AUDIO_ENCODING_UNSPECIFIED = 0;
9986

10087
// Uncompressed 16-bit signed little-endian samples (Linear PCM).
@@ -122,6 +109,19 @@ enum AudioEncoding {
122109
ALAW = 6;
123110
}
124111

112+
// The top-level message sent by the client for the `ListVoices` method.
113+
message ListVoicesRequest {
114+
// Optional. Recommended.
115+
// [BCP-47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt) language tag.
116+
// If not specified, the API will return all supported voices.
117+
// If specified, the ListVoices call will only return voices that can be used
118+
// to synthesize this language_code. For example, if you specify `"en-NZ"`,
119+
// all `"en-NZ"` voices will be returned. If you specify `"no"`, both
120+
// `"no-\*"` (Norwegian) and `"nb-\*"` (Norwegian Bokmal) voices will be
121+
// returned.
122+
string language_code = 1 [(google.api.field_behavior) = OPTIONAL];
123+
}
124+
125125
// The message returned to the client by the `ListVoices` method.
126126
message ListVoicesResponse {
127127
// The list of voices.
@@ -171,8 +171,8 @@ message SynthesizeSpeechRequest {
171171

172172
// Contains text input to be synthesized. Either `text` or `ssml` must be
173173
// supplied. Supplying both or neither returns
174-
// [google.rpc.Code.INVALID_ARGUMENT][]. The input size is limited to 5000
175-
// characters.
174+
// [google.rpc.Code.INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT]. The input size is limited to 5000
175+
// bytes.
176176
message SynthesisInput {
177177
// The input source, which is either plain text or SSML.
178178
oneof input_source {
@@ -181,7 +181,7 @@ message SynthesisInput {
181181

182182
// The SSML document to be synthesized. The SSML document must be valid
183183
// and well-formed. Otherwise the RPC will fail and return
184-
// [google.rpc.Code.INVALID_ARGUMENT][]. For more information, see
184+
// [google.rpc.Code.INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT]. For more information, see
185185
// [SSML](https://cloud.google.com/text-to-speech/docs/ssml).
186186
string ssml = 2;
187187
}
@@ -260,7 +260,7 @@ message AudioConfig {
260260
// converting to the desired sample rate (which might result in worse audio
261261
// quality), unless the specified sample rate is not supported for the
262262
// encoding chosen, in which case it will fail the request and return
263-
// [google.rpc.Code.INVALID_ARGUMENT][].
263+
// [google.rpc.Code.INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT].
264264
int32 sample_rate_hertz = 5 [(google.api.field_behavior) = OPTIONAL];
265265

266266
// Optional. Input only. An identifier which selects 'audio effects' profiles
Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
// Copyright 2022 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+
// http://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+
syntax = "proto3";
16+
17+
package google.cloud.texttospeech.v1beta1;
18+
19+
import "google/api/annotations.proto";
20+
import "google/api/client.proto";
21+
import "google/api/field_behavior.proto";
22+
import "google/cloud/texttospeech/v1beta1/cloud_tts.proto";
23+
import "google/longrunning/operations.proto";
24+
import "google/protobuf/timestamp.proto";
25+
26+
option cc_enable_arenas = true;
27+
option csharp_namespace = "Google.Cloud.TextToSpeech.V1Beta1";
28+
option go_package = "google.golang.org/genproto/googleapis/cloud/texttospeech/v1beta1;texttospeech";
29+
option java_multiple_files = true;
30+
option java_outer_classname = "TextToSpeechLongAudioSynthesisProto";
31+
option java_package = "com.google.cloud.texttospeech.v1beta1";
32+
option php_namespace = "Google\\Cloud\\TextToSpeech\\V1beta1";
33+
option ruby_package = "Google::Cloud::TextToSpeech::V1beta1";
34+
35+
// Service that implements Google Cloud Text-to-Speech API.
36+
service TextToSpeechLongAudioSynthesize {
37+
option (google.api.default_host) = "texttospeech.googleapis.com";
38+
option (google.api.oauth_scopes) =
39+
"https://www.googleapis.com/auth/cloud-platform";
40+
41+
// Synthesizes long form text asynchronously.
42+
rpc SynthesizeLongAudio(SynthesizeLongAudioRequest)
43+
returns (google.longrunning.Operation) {
44+
option (google.api.http) = {
45+
post: "/v1beta1/{parent=projects/*/locations/*/voices/*}:SynthesizeLongAudio"
46+
body: "*"
47+
};
48+
option (google.longrunning.operation_info) = {
49+
response_type: "SynthesizeLongAudioResponse"
50+
metadata_type: "SynthesizeLongAudioMetadata"
51+
};
52+
}
53+
}
54+
55+
// The top-level message sent by the client for the
56+
// `SynthesizeLongAudio` method.
57+
message SynthesizeLongAudioRequest {
58+
// The resource states of the request in the form of
59+
// projects/*/locations/*/voices/*.
60+
string parent = 1;
61+
62+
// Required. The Synthesizer requires either plain text or SSML as input.
63+
SynthesisInput input = 2 [(google.api.field_behavior) = REQUIRED];
64+
65+
// Required. The configuration of the synthesized audio.
66+
AudioConfig audio_config = 3 [(google.api.field_behavior) = REQUIRED];
67+
68+
// Specifies a Cloud Storage URI for the synthesis results. Must be
69+
// specified in the format: `gs://bucket_name/object_name`, and the bucket
70+
// must already exist.
71+
string output_gcs_uri = 4;
72+
73+
// The desired voice of the synthesized audio.
74+
VoiceSelectionParams voice = 5;
75+
}
76+
77+
// The message returned to the client by the `SynthesizeLongAudio` method.
78+
message SynthesizeLongAudioResponse {}
79+
80+
// Metadata for response returned by the `SynthesizeLongAudio` method.
81+
message SynthesizeLongAudioMetadata {
82+
// Time when the request was received.
83+
google.protobuf.Timestamp start_time = 1;
84+
85+
// Time of the most recent processing update.
86+
google.protobuf.Timestamp last_update_time = 2;
87+
88+
// The progress of the most recent processing update in percentage, ie. 70.0%.
89+
double progress_percentage = 3;
90+
}

google/cloud/texttospeech/v1beta1/texttospeech_grpc_service_config.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,15 @@
1212
"DEADLINE_EXCEEDED"
1313
]
1414
}
15+
},
16+
{
17+
"name": [
18+
{
19+
"service": "google.cloud.texttospeech.v1beta1.TextToSpeechLongAudioSynthesize",
20+
"method": "SynthesizeLongAudio"
21+
}
22+
],
23+
"timeout": "5000s"
1524
}
1625
]
1726
}

google/cloud/texttospeech/v1beta1/texttospeech_v1beta1.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ title: Cloud Text-to-Speech API
55

66
apis:
77
- name: google.cloud.texttospeech.v1beta1.TextToSpeech
8+
- name: google.cloud.texttospeech.v1beta1.TextToSpeechLongAudioSynthesize
9+
- name: google.longrunning.Operations
810

911
documentation:
1012
summary: |-
@@ -25,3 +27,11 @@ authentication:
2527
oauth:
2628
canonical_scopes: |-
2729
https://www.googleapis.com/auth/cloud-platform
30+
- selector: google.cloud.texttospeech.v1beta1.TextToSpeechLongAudioSynthesize.SynthesizeLongAudio
31+
oauth:
32+
canonical_scopes: |-
33+
https://www.googleapis.com/auth/cloud-platform
34+
- selector: 'google.longrunning.Operations.*'
35+
oauth:
36+
canonical_scopes: |-
37+
https://www.googleapis.com/auth/cloud-platform

0 commit comments

Comments
 (0)