Reference documentation and code samples for the Dialogflow V2 API module Google::Cloud::Dialogflow::V2::AudioEncoding.
Audio encoding of the audio content sent in the conversational query request.
Refer to the
Cloud Speech API
documentation for more
details.
Constants
AUDIO_ENCODING_UNSPECIFIED
value: 0 Not specified.
AUDIO_ENCODING_LINEAR_16
value: 1 Uncompressed 16-bit signed little-endian samples (Linear PCM).
AUDIO_ENCODING_FLAC
value: 2 FLAC (Free Lossless Audio
Codec) is the recommended encoding because it is lossless (therefore
recognition is not compromised) and requires only about half the
bandwidth of LINEAR16. FLAC stream encoding supports 16-bit and
24-bit samples, however, not all fields in STREAMINFO are supported.
AUDIO_ENCODING_MULAW
value: 3 8-bit samples that compand 14-bit audio samples using G.711 PCMU/mu-law.
AUDIO_ENCODING_AMR
value: 4 Adaptive Multi-Rate Narrowband codec. sample_rate_hertz must be 8000.
AUDIO_ENCODING_AMR_WB
value: 5 Adaptive Multi-Rate Wideband codec. sample_rate_hertz must be 16000.
AUDIO_ENCODING_OGG_OPUS
value: 6 Opus encoded audio frames in Ogg container
(OggOpus).
sample_rate_hertz must be 16000.
AUDIO_ENCODING_SPEEX_WITH_HEADER_BYTE
value: 7 Although the use of lossy encodings is not recommended, if a very low
bitrate encoding is required, OGG_OPUS is highly preferred over
Speex encoding. The Speex encoding supported by
Dialogflow API has a header byte in each block, as in MIME type
audio/x-speex-with-header-byte.
It is a variant of the RTP Speex encoding defined in
RFC 5574.
The stream is a sequence of blocks, one block per RTP packet. Each block
starts with a byte containing the length of the block, in bytes, followed
by one or more frames of Speex data, padded to an integral number of
bytes (octets) as specified in RFC 5574. In other words, each RTP header
is replaced with a single byte containing the block length. Only Speex
wideband is supported. sample_rate_hertz must be 16000.
AUDIO_ENCODING_ALAW
value: 8 8-bit samples that compand 13-bit audio samples using G.711 PCMU/a-law.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-09-09 UTC."],[],[],null,["# Dialogflow V2 API - Module Google::Cloud::Dialogflow::V2::AudioEncoding (v1.10.1)\n\nVersion latestkeyboard_arrow_down\n\n- [1.10.1 (latest)](/ruby/docs/reference/google-cloud-dialogflow-v2/latest/Google-Cloud-Dialogflow-V2-AudioEncoding)\n- [1.10.0](/ruby/docs/reference/google-cloud-dialogflow-v2/1.10.0/Google-Cloud-Dialogflow-V2-AudioEncoding)\n- [1.9.1](/ruby/docs/reference/google-cloud-dialogflow-v2/1.9.1/Google-Cloud-Dialogflow-V2-AudioEncoding)\n- [1.8.0](/ruby/docs/reference/google-cloud-dialogflow-v2/1.8.0/Google-Cloud-Dialogflow-V2-AudioEncoding)\n- [1.7.0](/ruby/docs/reference/google-cloud-dialogflow-v2/1.7.0/Google-Cloud-Dialogflow-V2-AudioEncoding)\n- [1.6.0](/ruby/docs/reference/google-cloud-dialogflow-v2/1.6.0/Google-Cloud-Dialogflow-V2-AudioEncoding)\n- [1.5.0](/ruby/docs/reference/google-cloud-dialogflow-v2/1.5.0/Google-Cloud-Dialogflow-V2-AudioEncoding)\n- [1.4.1](/ruby/docs/reference/google-cloud-dialogflow-v2/1.4.1/Google-Cloud-Dialogflow-V2-AudioEncoding)\n- [1.3.0](/ruby/docs/reference/google-cloud-dialogflow-v2/1.3.0/Google-Cloud-Dialogflow-V2-AudioEncoding)\n- [1.2.0](/ruby/docs/reference/google-cloud-dialogflow-v2/1.2.0/Google-Cloud-Dialogflow-V2-AudioEncoding)\n- [1.1.1](/ruby/docs/reference/google-cloud-dialogflow-v2/1.1.1/Google-Cloud-Dialogflow-V2-AudioEncoding)\n- [1.0.0](/ruby/docs/reference/google-cloud-dialogflow-v2/1.0.0/Google-Cloud-Dialogflow-V2-AudioEncoding)\n- [0.34.0](/ruby/docs/reference/google-cloud-dialogflow-v2/0.34.0/Google-Cloud-Dialogflow-V2-AudioEncoding)\n- [0.33.0](/ruby/docs/reference/google-cloud-dialogflow-v2/0.33.0/Google-Cloud-Dialogflow-V2-AudioEncoding)\n- [0.32.2](/ruby/docs/reference/google-cloud-dialogflow-v2/0.32.2/Google-Cloud-Dialogflow-V2-AudioEncoding)\n- [0.31.0](/ruby/docs/reference/google-cloud-dialogflow-v2/0.31.0/Google-Cloud-Dialogflow-V2-AudioEncoding)\n- [0.30.0](/ruby/docs/reference/google-cloud-dialogflow-v2/0.30.0/Google-Cloud-Dialogflow-V2-AudioEncoding)\n- [0.29.0](/ruby/docs/reference/google-cloud-dialogflow-v2/0.29.0/Google-Cloud-Dialogflow-V2-AudioEncoding)\n- [0.28.0](/ruby/docs/reference/google-cloud-dialogflow-v2/0.28.0/Google-Cloud-Dialogflow-V2-AudioEncoding)\n- [0.27.0](/ruby/docs/reference/google-cloud-dialogflow-v2/0.27.0/Google-Cloud-Dialogflow-V2-AudioEncoding)\n- [0.26.2](/ruby/docs/reference/google-cloud-dialogflow-v2/0.26.2/Google-Cloud-Dialogflow-V2-AudioEncoding)\n- [0.25.0](/ruby/docs/reference/google-cloud-dialogflow-v2/0.25.0/Google-Cloud-Dialogflow-V2-AudioEncoding)\n- [0.24.0](/ruby/docs/reference/google-cloud-dialogflow-v2/0.24.0/Google-Cloud-Dialogflow-V2-AudioEncoding)\n- [0.23.0](/ruby/docs/reference/google-cloud-dialogflow-v2/0.23.0/Google-Cloud-Dialogflow-V2-AudioEncoding)\n- [0.22.0](/ruby/docs/reference/google-cloud-dialogflow-v2/0.22.0/Google-Cloud-Dialogflow-V2-AudioEncoding)\n- [0.21.0](/ruby/docs/reference/google-cloud-dialogflow-v2/0.21.0/Google-Cloud-Dialogflow-V2-AudioEncoding)\n- [0.20.0](/ruby/docs/reference/google-cloud-dialogflow-v2/0.20.0/Google-Cloud-Dialogflow-V2-AudioEncoding)\n- [0.19.0](/ruby/docs/reference/google-cloud-dialogflow-v2/0.19.0/Google-Cloud-Dialogflow-V2-AudioEncoding)\n- [0.18.0](/ruby/docs/reference/google-cloud-dialogflow-v2/0.18.0/Google-Cloud-Dialogflow-V2-AudioEncoding)\n- [0.17.1](/ruby/docs/reference/google-cloud-dialogflow-v2/0.17.1/Google-Cloud-Dialogflow-V2-AudioEncoding)\n- [0.16.0](/ruby/docs/reference/google-cloud-dialogflow-v2/0.16.0/Google-Cloud-Dialogflow-V2-AudioEncoding)\n- [0.15.2](/ruby/docs/reference/google-cloud-dialogflow-v2/0.15.2/Google-Cloud-Dialogflow-V2-AudioEncoding)\n- [0.14.0](/ruby/docs/reference/google-cloud-dialogflow-v2/0.14.0/Google-Cloud-Dialogflow-V2-AudioEncoding)\n- [0.13.0](/ruby/docs/reference/google-cloud-dialogflow-v2/0.13.0/Google-Cloud-Dialogflow-V2-AudioEncoding)\n- [0.12.0](/ruby/docs/reference/google-cloud-dialogflow-v2/0.12.0/Google-Cloud-Dialogflow-V2-AudioEncoding) \nReference documentation and code samples for the Dialogflow V2 API module Google::Cloud::Dialogflow::V2::AudioEncoding.\n\nAudio encoding of the audio content sent in the conversational query request.\nRefer to the\n[Cloud Speech API\ndocumentation](https://cloud.google.com/speech-to-text/docs/basics) for more\ndetails.\n\nConstants\n---------\n\n### AUDIO_ENCODING_UNSPECIFIED\n\n**value:** 0 \nNot specified.\n\n### AUDIO_ENCODING_LINEAR_16\n\n**value:** 1 \nUncompressed 16-bit signed little-endian samples (Linear PCM).\n\n### AUDIO_ENCODING_FLAC\n\n**value:** 2 \n[`FLAC`](https://xiph.org/flac/documentation.html) (Free Lossless Audio\nCodec) is the recommended encoding because it is lossless (therefore\nrecognition is not compromised) and requires only about half the\nbandwidth of `LINEAR16`. `FLAC` stream encoding supports 16-bit and\n24-bit samples, however, not all fields in `STREAMINFO` are supported.\n\n### AUDIO_ENCODING_MULAW\n\n**value:** 3 \n8-bit samples that compand 14-bit audio samples using G.711 PCMU/mu-law.\n\n### AUDIO_ENCODING_AMR\n\n**value:** 4 \nAdaptive Multi-Rate Narrowband codec. `sample_rate_hertz` must be 8000.\n\n### AUDIO_ENCODING_AMR_WB\n\n**value:** 5 \nAdaptive Multi-Rate Wideband codec. `sample_rate_hertz` must be 16000.\n\n### AUDIO_ENCODING_OGG_OPUS\n\n**value:** 6 \nOpus encoded audio frames in Ogg container\n([OggOpus](https://wiki.xiph.org/OggOpus)).\n`sample_rate_hertz` must be 16000.\n\n### AUDIO_ENCODING_SPEEX_WITH_HEADER_BYTE\n\n**value:** 7 \nAlthough the use of lossy encodings is not recommended, if a very low\nbitrate encoding is required, `OGG_OPUS` is highly preferred over\nSpeex encoding. The [Speex](https://speex.org/) encoding supported by\nDialogflow API has a header byte in each block, as in MIME type\n`audio/x-speex-with-header-byte`.\nIt is a variant of the RTP Speex encoding defined in\n[RFC 5574](https://tools.ietf.org/html/rfc5574).\nThe stream is a sequence of blocks, one block per RTP packet. Each block\nstarts with a byte containing the length of the block, in bytes, followed\nby one or more frames of Speex data, padded to an integral number of\nbytes (octets) as specified in RFC 5574. In other words, each RTP header\nis replaced with a single byte containing the block length. Only Speex\nwideband is supported. `sample_rate_hertz` must be 16000.\n\n### AUDIO_ENCODING_ALAW\n\n**value:** 8 \n8-bit samples that compand 13-bit audio samples using G.711 PCMU/a-law."]]