Skip to content

Commit a1b5429

Browse files
Google APIscopybara-github
authored andcommitted
feat: add LRS API
PiperOrigin-RevId: 493606501
1 parent c232fcb commit a1b5429

5 files changed

Lines changed: 133 additions & 13 deletions

File tree

google/cloud/texttospeech/v1/BUILD.bazel

Lines changed: 9 additions & 0 deletions
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.v1.TextToSpeechClientHttpJsonTest",
8689
"com.google.cloud.texttospeech.v1.TextToSpeechClientTest",
90+
"com.google.cloud.texttospeech.v1.TextToSpeechLongAudioSynthesizeClientHttpJsonTest",
91+
"com.google.cloud.texttospeech.v1.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

google/cloud/texttospeech/v1/cloud_tts.proto

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@ option (google.api.resource_definition) = {
3737
// Service that implements Google Cloud Text-to-Speech API.
3838
service TextToSpeech {
3939
option (google.api.default_host) = "texttospeech.googleapis.com";
40-
option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform";
40+
option (google.api.oauth_scopes) =
41+
"https://www.googleapis.com/auth/cloud-platform";
4142

4243
// Returns a list of Voice supported for synthesis.
4344
rpc ListVoices(ListVoicesRequest) returns (ListVoicesResponse) {
@@ -49,7 +50,8 @@ service TextToSpeech {
4950

5051
// Synthesizes speech synchronously: receive results after all text input
5152
// has been processed.
52-
rpc SynthesizeSpeech(SynthesizeSpeechRequest) returns (SynthesizeSpeechResponse) {
53+
rpc SynthesizeSpeech(SynthesizeSpeechRequest)
54+
returns (SynthesizeSpeechResponse) {
5355
option (google.api.http) = {
5456
post: "/v1/text:synthesize"
5557
body: "*"
@@ -81,7 +83,8 @@ enum SsmlVoiceGender {
8183
// Configuration to set up audio encoder. The encoding determines the output
8284
// audio format that we'd like.
8385
enum AudioEncoding {
84-
// Not specified. Will return result [google.rpc.Code.INVALID_ARGUMENT][].
86+
// Not specified. Will return result
87+
// [google.rpc.Code.INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT].
8588
AUDIO_ENCODING_UNSPECIFIED = 0;
8689

8790
// Uncompressed 16-bit signed little-endian samples (Linear PCM).
@@ -156,8 +159,8 @@ message SynthesizeSpeechRequest {
156159

157160
// Contains text input to be synthesized. Either `text` or `ssml` must be
158161
// supplied. Supplying both or neither returns
159-
// [google.rpc.Code.INVALID_ARGUMENT][]. The input size is limited to 5000
160-
// characters.
162+
// [google.rpc.Code.INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT]. The
163+
// input size is limited to 5000 bytes.
161164
message SynthesisInput {
162165
// The input source, which is either plain text or SSML.
163166
oneof input_source {
@@ -166,17 +169,18 @@ message SynthesisInput {
166169

167170
// The SSML document to be synthesized. The SSML document must be valid
168171
// and well-formed. Otherwise the RPC will fail and return
169-
// [google.rpc.Code.INVALID_ARGUMENT][]. For more information, see
172+
// [google.rpc.Code.INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT]. For
173+
// more information, see
170174
// [SSML](https://cloud.google.com/text-to-speech/docs/ssml).
171175
string ssml = 2;
172176
}
173177
}
174178

175179
// Description of which voice to use for a synthesis request.
176180
message VoiceSelectionParams {
177-
// Required. The language (and potentially also the region) of the voice expressed as a
178-
// [BCP-47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt) language tag, e.g.
179-
// "en-US". This should not include a script tag (e.g. use
181+
// Required. The language (and potentially also the region) of the voice
182+
// expressed as a [BCP-47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt)
183+
// language tag, e.g. "en-US". This should not include a script tag (e.g. use
180184
// "cmn-cn" rather than "cmn-Hant-cn"), because the script will be inferred
181185
// from the input provided in the SynthesisInput. The TTS service
182186
// will use this parameter to help choose an appropriate voice. Note that
@@ -245,7 +249,7 @@ message AudioConfig {
245249
// converting to the desired sample rate (which might result in worse audio
246250
// quality), unless the specified sample rate is not supported for the
247251
// encoding chosen, in which case it will fail the request and return
248-
// [google.rpc.Code.INVALID_ARGUMENT][].
252+
// [google.rpc.Code.INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT].
249253
int32 sample_rate_hertz = 5 [(google.api.field_behavior) = OPTIONAL];
250254

251255
// Optional. Input only. An identifier which selects 'audio effects' profiles
@@ -282,9 +286,7 @@ message CustomVoiceParams {
282286
// Required. The name of the AutoML model that synthesizes the custom voice.
283287
string model = 1 [
284288
(google.api.field_behavior) = REQUIRED,
285-
(google.api.resource_reference) = {
286-
type: "automl.googleapis.com/Model"
287-
}
289+
(google.api.resource_reference) = { type: "automl.googleapis.com/Model" }
288290
];
289291

290292
// Optional. The usage of the synthesized audio to be reported.
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.v1;
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/v1/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.V1";
28+
option go_package = "google.golang.org/genproto/googleapis/cloud/texttospeech/v1;texttospeech";
29+
option java_multiple_files = true;
30+
option java_outer_classname = "TextToSpeechLongAudioSynthesisProto";
31+
option java_package = "com.google.cloud.texttospeech.v1";
32+
option php_namespace = "Google\\Cloud\\TextToSpeech\\V1";
33+
option ruby_package = "Google::Cloud::TextToSpeech::V1";
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: "/v1/{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/v1/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.v1.TextToSpeechLongAudioSynthesize",
20+
"method": "SynthesizeLongAudio"
21+
}
22+
],
23+
"timeout": "5000s"
1524
}
1625
]
1726
}

google/cloud/texttospeech/v1/texttospeech_v1.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.v1.TextToSpeech
8+
- name: google.cloud.texttospeech.v1.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.v1.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)