1// Copyright 2023 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 15syntax = "proto3"; 16 17package google.cloud.dialogflow.cx.v3; 18 19import "google/api/field_behavior.proto"; 20import "google/api/resource.proto"; 21import "google/protobuf/duration.proto"; 22 23option cc_enable_arenas = true; 24option csharp_namespace = "Google.Cloud.Dialogflow.Cx.V3"; 25option go_package = "cloud.google.com/go/dialogflow/cx/apiv3/cxpb;cxpb"; 26option java_multiple_files = true; 27option java_outer_classname = "AudioConfigProto"; 28option java_package = "com.google.cloud.dialogflow.cx.v3"; 29option objc_class_prefix = "DF"; 30option ruby_package = "Google::Cloud::Dialogflow::CX::V3"; 31option (google.api.resource_definition) = { 32 type: "automl.googleapis.com/Model" 33 pattern: "projects/{project}/locations/{location}/models/{model}" 34}; 35 36// Audio encoding of the audio content sent in the conversational query request. 37// Refer to the 38// [Cloud Speech API 39// documentation](https://cloud.google.com/speech-to-text/docs/basics) for more 40// details. 41enum AudioEncoding { 42 // Not specified. 43 AUDIO_ENCODING_UNSPECIFIED = 0; 44 45 // Uncompressed 16-bit signed little-endian samples (Linear PCM). 46 AUDIO_ENCODING_LINEAR_16 = 1; 47 48 // [`FLAC`](https://xiph.org/flac/documentation.html) (Free Lossless Audio 49 // Codec) is the recommended encoding because it is lossless (therefore 50 // recognition is not compromised) and requires only about half the 51 // bandwidth of `LINEAR16`. `FLAC` stream encoding supports 16-bit and 52 // 24-bit samples, however, not all fields in `STREAMINFO` are supported. 53 AUDIO_ENCODING_FLAC = 2; 54 55 // 8-bit samples that compand 14-bit audio samples using G.711 PCMU/mu-law. 56 AUDIO_ENCODING_MULAW = 3; 57 58 // Adaptive Multi-Rate Narrowband codec. `sample_rate_hertz` must be 8000. 59 AUDIO_ENCODING_AMR = 4; 60 61 // Adaptive Multi-Rate Wideband codec. `sample_rate_hertz` must be 16000. 62 AUDIO_ENCODING_AMR_WB = 5; 63 64 // Opus encoded audio frames in Ogg container 65 // ([OggOpus](https://wiki.xiph.org/OggOpus)). 66 // `sample_rate_hertz` must be 16000. 67 AUDIO_ENCODING_OGG_OPUS = 6; 68 69 // Although the use of lossy encodings is not recommended, if a very low 70 // bitrate encoding is required, `OGG_OPUS` is highly preferred over 71 // Speex encoding. The [Speex](https://speex.org/) encoding supported by 72 // Dialogflow API has a header byte in each block, as in MIME type 73 // `audio/x-speex-with-header-byte`. 74 // It is a variant of the RTP Speex encoding defined in 75 // [RFC 5574](https://tools.ietf.org/html/rfc5574). 76 // The stream is a sequence of blocks, one block per RTP packet. Each block 77 // starts with a byte containing the length of the block, in bytes, followed 78 // by one or more frames of Speex data, padded to an integral number of 79 // bytes (octets) as specified in RFC 5574. In other words, each RTP header 80 // is replaced with a single byte containing the block length. Only Speex 81 // wideband is supported. `sample_rate_hertz` must be 16000. 82 AUDIO_ENCODING_SPEEX_WITH_HEADER_BYTE = 7; 83} 84 85// Variant of the specified [Speech 86// model][google.cloud.dialogflow.cx.v3.InputAudioConfig.model] to use. 87// 88// See the [Cloud Speech 89// documentation](https://cloud.google.com/speech-to-text/docs/enhanced-models) 90// for which models have different variants. For example, the "phone_call" model 91// has both a standard and an enhanced variant. When you use an enhanced model, 92// you will generally receive higher quality results than for a standard model. 93enum SpeechModelVariant { 94 // No model variant specified. In this case Dialogflow defaults to 95 // USE_BEST_AVAILABLE. 96 SPEECH_MODEL_VARIANT_UNSPECIFIED = 0; 97 98 // Use the best available variant of the [Speech 99 // model][InputAudioConfig.model] that the caller is eligible for. 100 // 101 // Please see the [Dialogflow 102 // docs](https://cloud.google.com/dialogflow/docs/data-logging) for 103 // how to make your project eligible for enhanced models. 104 USE_BEST_AVAILABLE = 1; 105 106 // Use standard model variant even if an enhanced model is available. See the 107 // [Cloud Speech 108 // documentation](https://cloud.google.com/speech-to-text/docs/enhanced-models) 109 // for details about enhanced models. 110 USE_STANDARD = 2; 111 112 // Use an enhanced model variant: 113 // 114 // * If an enhanced variant does not exist for the given 115 // [model][google.cloud.dialogflow.cx.v3.InputAudioConfig.model] and request 116 // language, Dialogflow falls back to the standard variant. 117 // 118 // The [Cloud Speech 119 // documentation](https://cloud.google.com/speech-to-text/docs/enhanced-models) 120 // describes which models have enhanced variants. 121 // 122 // * If the API caller isn't eligible for enhanced models, Dialogflow returns 123 // an error. Please see the [Dialogflow 124 // docs](https://cloud.google.com/dialogflow/docs/data-logging) 125 // for how to make your project eligible. 126 USE_ENHANCED = 3; 127} 128 129// Information for a word recognized by the speech recognizer. 130message SpeechWordInfo { 131 // The word this info is for. 132 string word = 3; 133 134 // Time offset relative to the beginning of the audio that corresponds to the 135 // start of the spoken word. This is an experimental feature and the accuracy 136 // of the time offset can vary. 137 google.protobuf.Duration start_offset = 1; 138 139 // Time offset relative to the beginning of the audio that corresponds to the 140 // end of the spoken word. This is an experimental feature and the accuracy of 141 // the time offset can vary. 142 google.protobuf.Duration end_offset = 2; 143 144 // The Speech confidence between 0.0 and 1.0 for this word. A higher number 145 // indicates an estimated greater likelihood that the recognized word is 146 // correct. The default of 0.0 is a sentinel value indicating that confidence 147 // was not set. 148 // 149 // This field is not guaranteed to be fully stable over time for the same 150 // audio input. Users should also not rely on it to always be provided. 151 float confidence = 4; 152} 153 154// Instructs the speech recognizer on how to process the audio content. 155message InputAudioConfig { 156 // Required. Audio encoding of the audio content to process. 157 AudioEncoding audio_encoding = 1 [(google.api.field_behavior) = REQUIRED]; 158 159 // Sample rate (in Hertz) of the audio content sent in the query. 160 // Refer to 161 // [Cloud Speech API 162 // documentation](https://cloud.google.com/speech-to-text/docs/basics) for 163 // more details. 164 int32 sample_rate_hertz = 2; 165 166 // Optional. If `true`, Dialogflow returns 167 // [SpeechWordInfo][google.cloud.dialogflow.cx.v3.SpeechWordInfo] in 168 // [StreamingRecognitionResult][google.cloud.dialogflow.cx.v3.StreamingRecognitionResult] 169 // with information about the recognized speech words, e.g. start and end time 170 // offsets. If false or unspecified, Speech doesn't return any word-level 171 // information. 172 bool enable_word_info = 13; 173 174 // Optional. A list of strings containing words and phrases that the speech 175 // recognizer should recognize with higher likelihood. 176 // 177 // See [the Cloud Speech 178 // documentation](https://cloud.google.com/speech-to-text/docs/basics#phrase-hints) 179 // for more details. 180 repeated string phrase_hints = 4; 181 182 // Optional. Which Speech model to select for the given request. Select the 183 // model best suited to your domain to get best results. If a model is not 184 // explicitly specified, then we auto-select a model based on the parameters 185 // in the InputAudioConfig. 186 // If enhanced speech model is enabled for the agent and an enhanced 187 // version of the specified model for the language does not exist, then the 188 // speech is recognized using the standard version of the specified model. 189 // Refer to 190 // [Cloud Speech API 191 // documentation](https://cloud.google.com/speech-to-text/docs/basics#select-model) 192 // for more details. 193 // If you specify a model, the following models typically have the best 194 // performance: 195 // 196 // - phone_call (best for Agent Assist and telephony) 197 // - latest_short (best for Dialogflow non-telephony) 198 // - command_and_search (best for very short utterances and commands) 199 string model = 7; 200 201 // Optional. Which variant of the [Speech 202 // model][google.cloud.dialogflow.cx.v3.InputAudioConfig.model] to use. 203 SpeechModelVariant model_variant = 10; 204 205 // Optional. If `false` (default), recognition does not cease until the 206 // client closes the stream. 207 // If `true`, the recognizer will detect a single spoken utterance in input 208 // audio. Recognition ceases when it detects the audio's voice has 209 // stopped or paused. In this case, once a detected intent is received, the 210 // client should close the stream and start a new request with a new stream as 211 // needed. 212 // Note: This setting is relevant only for streaming methods. 213 bool single_utterance = 8; 214} 215 216// Gender of the voice as described in 217// [SSML voice element](https://www.w3.org/TR/speech-synthesis11/#edef_voice). 218enum SsmlVoiceGender { 219 // An unspecified gender, which means that the client doesn't care which 220 // gender the selected voice will have. 221 SSML_VOICE_GENDER_UNSPECIFIED = 0; 222 223 // A male voice. 224 SSML_VOICE_GENDER_MALE = 1; 225 226 // A female voice. 227 SSML_VOICE_GENDER_FEMALE = 2; 228 229 // A gender-neutral voice. 230 SSML_VOICE_GENDER_NEUTRAL = 3; 231} 232 233// Description of which voice to use for speech synthesis. 234message VoiceSelectionParams { 235 // Optional. The name of the voice. If not set, the service will choose a 236 // voice based on the other parameters such as language_code and 237 // [ssml_gender][google.cloud.dialogflow.cx.v3.VoiceSelectionParams.ssml_gender]. 238 // 239 // For the list of available voices, please refer to [Supported voices and 240 // languages](https://cloud.google.com/text-to-speech/docs/voices). 241 string name = 1; 242 243 // Optional. The preferred gender of the voice. If not set, the service will 244 // choose a voice based on the other parameters such as language_code and 245 // [name][google.cloud.dialogflow.cx.v3.VoiceSelectionParams.name]. Note that 246 // this is only a preference, not requirement. If a voice of the appropriate 247 // gender is not available, the synthesizer substitutes a voice with a 248 // different gender rather than failing the request. 249 SsmlVoiceGender ssml_gender = 2; 250} 251 252// Configuration of how speech should be synthesized. 253message SynthesizeSpeechConfig { 254 // Optional. Speaking rate/speed, in the range [0.25, 4.0]. 1.0 is the normal 255 // native speed supported by the specific voice. 2.0 is twice as fast, and 256 // 0.5 is half as fast. If unset(0.0), defaults to the native 1.0 speed. Any 257 // other values < 0.25 or > 4.0 will return an error. 258 double speaking_rate = 1; 259 260 // Optional. Speaking pitch, in the range [-20.0, 20.0]. 20 means increase 20 261 // semitones from the original pitch. -20 means decrease 20 semitones from the 262 // original pitch. 263 double pitch = 2; 264 265 // Optional. Volume gain (in dB) of the normal native volume supported by the 266 // specific voice, in the range [-96.0, 16.0]. If unset, or set to a value of 267 // 0.0 (dB), will play at normal native signal amplitude. A value of -6.0 (dB) 268 // will play at approximately half the amplitude of the normal native signal 269 // amplitude. A value of +6.0 (dB) will play at approximately twice the 270 // amplitude of the normal native signal amplitude. We strongly recommend not 271 // to exceed +10 (dB) as there's usually no effective increase in loudness for 272 // any value greater than that. 273 double volume_gain_db = 3; 274 275 // Optional. An identifier which selects 'audio effects' profiles that are 276 // applied on (post synthesized) text to speech. Effects are applied on top of 277 // each other in the order they are given. 278 repeated string effects_profile_id = 5; 279 280 // Optional. The desired voice of the synthesized audio. 281 VoiceSelectionParams voice = 4; 282} 283 284// Audio encoding of the output audio format in Text-To-Speech. 285enum OutputAudioEncoding { 286 // Not specified. 287 OUTPUT_AUDIO_ENCODING_UNSPECIFIED = 0; 288 289 // Uncompressed 16-bit signed little-endian samples (Linear PCM). 290 // Audio content returned as LINEAR16 also contains a WAV header. 291 OUTPUT_AUDIO_ENCODING_LINEAR_16 = 1; 292 293 // MP3 audio at 32kbps. 294 OUTPUT_AUDIO_ENCODING_MP3 = 2; 295 296 // MP3 audio at 64kbps. 297 OUTPUT_AUDIO_ENCODING_MP3_64_KBPS = 4; 298 299 // Opus encoded audio wrapped in an ogg container. The result will be a 300 // file which can be played natively on Android, and in browsers (at least 301 // Chrome and Firefox). The quality of the encoding is considerably higher 302 // than MP3 while using approximately the same bitrate. 303 OUTPUT_AUDIO_ENCODING_OGG_OPUS = 3; 304 305 // 8-bit samples that compand 14-bit audio samples using G.711 PCMU/mu-law. 306 OUTPUT_AUDIO_ENCODING_MULAW = 5; 307} 308 309// Instructs the speech synthesizer how to generate the output audio content. 310message OutputAudioConfig { 311 // Required. Audio encoding of the synthesized audio content. 312 OutputAudioEncoding audio_encoding = 1 313 [(google.api.field_behavior) = REQUIRED]; 314 315 // Optional. The synthesis sample rate (in hertz) for this audio. If not 316 // provided, then the synthesizer will use the default sample rate based on 317 // the audio encoding. If this is different from the voice's natural sample 318 // rate, then the synthesizer will honor this request by converting to the 319 // desired sample rate (which might result in worse audio quality). 320 int32 sample_rate_hertz = 2; 321 322 // Optional. Configuration of how speech should be synthesized. 323 SynthesizeSpeechConfig synthesize_speech_config = 3; 324} 325 326// Settings related to speech synthesizing. 327message TextToSpeechSettings { 328 // Configuration of how speech should be synthesized, mapping from language 329 // (https://cloud.google.com/dialogflow/cx/docs/reference/language) to 330 // SynthesizeSpeechConfig. 331 // 332 // These settings affect: 333 // 334 // - The synthesize configuration used in [phone 335 // gateway](https://cloud.google.com/dialogflow/cx/docs/concept/integration/phone-gateway). 336 // 337 // - You no longer need to specify 338 // [OutputAudioConfig.synthesize_speech_config][google.cloud.dialogflow.cx.v3.OutputAudioConfig.synthesize_speech_config] 339 // when invoking API calls. Your agent will use the pre-configured options 340 // for speech synthesizing. 341 map<string, SynthesizeSpeechConfig> synthesize_speech_configs = 1; 342} 343