From d985436b77cfd0231bb170014e4eadc19392d3ff Mon Sep 17 00:00:00 2001 From: Google APIs Date: Tue, 17 Dec 2024 10:59:32 -0800 Subject: [PATCH] feat: StreamingSynthesize now supports opus PiperOrigin-RevId: 707168599 --- .../texttospeech/v1beta1/cloud_tts.proto | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/google/cloud/texttospeech/v1beta1/cloud_tts.proto b/google/cloud/texttospeech/v1beta1/cloud_tts.proto index 6616fe854a..32b2704dd1 100644 --- a/google/cloud/texttospeech/v1beta1/cloud_tts.proto +++ b/google/cloud/texttospeech/v1beta1/cloud_tts.proto @@ -115,6 +115,11 @@ enum AudioEncoding { // 8-bit samples that compand 14-bit audio samples using G.711 PCMU/A-law. // Audio content returned as ALAW also contains a WAV header. ALAW = 6; + + // Uncompressed 16-bit signed little-endian samples (Linear PCM). + // Note that as opposed to LINEAR16, audio will not be wrapped in a WAV (or + // any other) header. + PCM = 7; } // The top-level message sent by the client for the `ListVoices` method. @@ -432,10 +437,25 @@ message Timepoint { double time_seconds = 3; } +// Description of the desired output audio data. +message StreamingAudioConfig { + // Required. The format of the audio byte stream. + // For now, streaming only supports PCM and OGG_OPUS. All other encodings + // will return an error. + AudioEncoding audio_encoding = 1 [(google.api.field_behavior) = REQUIRED]; + + // Optional. The synthesis sample rate (in hertz) for this audio. + int32 sample_rate_hertz = 2 [(google.api.field_behavior) = OPTIONAL]; +} + // Provides configuration information for the StreamingSynthesize request. message StreamingSynthesizeConfig { // Required. The desired voice of the synthesized audio. VoiceSelectionParams voice = 1 [(google.api.field_behavior) = REQUIRED]; + + // Optional. The configuration of the synthesized audio. + StreamingAudioConfig streaming_audio_config = 4 + [(google.api.field_behavior) = OPTIONAL]; } // Input to be synthesized.