audio_config.proto 18 KB

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