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

feat: add LRS API #3706

Merged
merged 2 commits into from
Dec 7, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/google-cloud-texttospeech/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ Samples are in the [`samples/`](https://github.com/googleapis/google-cloud-node/
| --------------------------- | --------------------------------- | ------ |
| Text_to_speech.list_voices | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-texttospeech/samples/generated/v1/text_to_speech.list_voices.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-texttospeech/samples/generated/v1/text_to_speech.list_voices.js,samples/README.md) |
| Text_to_speech.synthesize_speech | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-texttospeech/samples/generated/v1/text_to_speech.synthesize_speech.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-texttospeech/samples/generated/v1/text_to_speech.synthesize_speech.js,samples/README.md) |
| Text_to_speech_long_audio_synthesize.synthesize_long_audio | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-texttospeech/samples/generated/v1/text_to_speech_long_audio_synthesize.synthesize_long_audio.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-texttospeech/samples/generated/v1/text_to_speech_long_audio_synthesize.synthesize_long_audio.js,samples/README.md) |
| Text_to_speech.list_voices | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-texttospeech/samples/generated/v1beta1/text_to_speech.list_voices.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-texttospeech/samples/generated/v1beta1/text_to_speech.list_voices.js,samples/README.md) |
| Text_to_speech.synthesize_speech | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-texttospeech/samples/generated/v1beta1/text_to_speech.synthesize_speech.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-texttospeech/samples/generated/v1beta1/text_to_speech.synthesize_speech.js,samples/README.md) |
| Text_to_speech_long_audio_synthesize.synthesize_long_audio | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-texttospeech/samples/generated/v1beta1/text_to_speech_long_audio_synthesize.synthesize_long_audio.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-texttospeech/samples/generated/v1beta1/text_to_speech_long_audio_synthesize.synthesize_long_audio.js,samples/README.md) |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ option (google.api.resource_definition) = {
// Service that implements Google Cloud Text-to-Speech API.
service TextToSpeech {
option (google.api.default_host) = "texttospeech.googleapis.com";
option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform";
option (google.api.oauth_scopes) =
"https://www.googleapis.com/auth/cloud-platform";

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

// Synthesizes speech synchronously: receive results after all text input
// has been processed.
rpc SynthesizeSpeech(SynthesizeSpeechRequest) returns (SynthesizeSpeechResponse) {
rpc SynthesizeSpeech(SynthesizeSpeechRequest)
returns (SynthesizeSpeechResponse) {
option (google.api.http) = {
post: "/v1/text:synthesize"
body: "*"
Expand Down Expand Up @@ -81,7 +83,8 @@ enum SsmlVoiceGender {
// Configuration to set up audio encoder. The encoding determines the output
// audio format that we'd like.
enum AudioEncoding {
// Not specified. Will return result [google.rpc.Code.INVALID_ARGUMENT][].
// Not specified. Will return result
// [google.rpc.Code.INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT].
AUDIO_ENCODING_UNSPECIFIED = 0;

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

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

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

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

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

// Optional. The usage of the synthesized audio to be reported.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
// Copyright 2022 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

syntax = "proto3";

package google.cloud.texttospeech.v1;

import "google/api/annotations.proto";
import "google/api/client.proto";
import "google/api/field_behavior.proto";
import "google/cloud/texttospeech/v1/cloud_tts.proto";
import "google/longrunning/operations.proto";
import "google/protobuf/timestamp.proto";

option cc_enable_arenas = true;
option csharp_namespace = "Google.Cloud.TextToSpeech.V1";
option go_package = "google.golang.org/genproto/googleapis/cloud/texttospeech/v1;texttospeech";
option java_multiple_files = true;
option java_outer_classname = "TextToSpeechLongAudioSynthesisProto";
option java_package = "com.google.cloud.texttospeech.v1";
option php_namespace = "Google\\Cloud\\TextToSpeech\\V1";
option ruby_package = "Google::Cloud::TextToSpeech::V1";

// Service that implements Google Cloud Text-to-Speech API.
service TextToSpeechLongAudioSynthesize {
option (google.api.default_host) = "texttospeech.googleapis.com";
option (google.api.oauth_scopes) =
"https://www.googleapis.com/auth/cloud-platform";

// Synthesizes long form text asynchronously.
rpc SynthesizeLongAudio(SynthesizeLongAudioRequest)
returns (google.longrunning.Operation) {
option (google.api.http) = {
post: "/v1/{parent=projects/*/locations/*/voices/*}:SynthesizeLongAudio"
body: "*"
};
option (google.longrunning.operation_info) = {
response_type: "SynthesizeLongAudioResponse"
metadata_type: "SynthesizeLongAudioMetadata"
};
}
}

// The top-level message sent by the client for the
// `SynthesizeLongAudio` method.
message SynthesizeLongAudioRequest {
// The resource states of the request in the form of
// `projects/*/locations/*/voices/*`.
string parent = 1;

// Required. The Synthesizer requires either plain text or SSML as input.
SynthesisInput input = 2 [(google.api.field_behavior) = REQUIRED];

// Required. The configuration of the synthesized audio.
AudioConfig audio_config = 3 [(google.api.field_behavior) = REQUIRED];

// Specifies a Cloud Storage URI for the synthesis results. Must be
// specified in the format: `gs://bucket_name/object_name`, and the bucket
// must already exist.
string output_gcs_uri = 4;

// The desired voice of the synthesized audio.
VoiceSelectionParams voice = 5;
}

// The message returned to the client by the `SynthesizeLongAudio` method.
message SynthesizeLongAudioResponse {}

// Metadata for response returned by the `SynthesizeLongAudio` method.
message SynthesizeLongAudioMetadata {
// Time when the request was received.
google.protobuf.Timestamp start_time = 1;

// Time of the most recent processing update.
google.protobuf.Timestamp last_update_time = 2;

// The progress of the most recent processing update in percentage, ie. 70.0%.
double progress_percentage = 3;
}
Loading