audio_config.proto 17 KB

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