Reference documentation and code samples for the Cloud Text-to-Speech V1 Client class StreamingAudioConfig.
Description of the desired output audio data.
Generated from protobuf message google.cloud.texttospeech.v1.StreamingAudioConfig
Namespace
Google \ Cloud \ TextToSpeech \ V1
Methods
__construct
Constructor.
Parameters
Name
Description
data
array
Optional. Data for populating the Message object.
↳ audio_encoding
int
Required. The format of the audio byte stream. Streaming supports PCM, ALAW, MULAW and OGG_OPUS. All other encodings return an error.
↳ sample_rate_hertz
int
Optional. The synthesis sample rate (in hertz) for this audio.
↳ speaking_rate
float
Optional. Input only. Speaking rate/speed, in the range [0.25, 2.0]. 1.0 is the normal native speed supported by the specific voice. 2.0 is twice as fast, and 0.5 is half as fast. If unset(0.0), defaults to the native 1.0 speed. Any other values < 0.25 or > 2.0 will return an error.
getAudioEncoding
Required. The format of the audio byte stream.
Streaming supports PCM, ALAW, MULAW and OGG_OPUS. All other encodings
return an error.
Returns
Type
Description
int
Enum of type AudioEncoding.
setAudioEncoding
Required. The format of the audio byte stream.
Streaming supports PCM, ALAW, MULAW and OGG_OPUS. All other encodings
return an error.
Parameter
Name
Description
var
int
Enum of type AudioEncoding.
Returns
Type
Description
$this
getSampleRateHertz
Optional. The synthesis sample rate (in hertz) for this audio.
Returns
Type
Description
int
setSampleRateHertz
Optional. The synthesis sample rate (in hertz) for this audio.
Parameter
Name
Description
var
int
Returns
Type
Description
$this
getSpeakingRate
Optional. Input only. Speaking rate/speed, in the range [0.25, 2.0]. 1.0 is
the normal native speed supported by the specific voice. 2.0 is twice as
fast, and 0.5 is half as fast. If unset(0.0), defaults to the native 1.0
speed. Any other values < 0.25 or > 2.0 will return an error.
Returns
Type
Description
float
setSpeakingRate
Optional. Input only. Speaking rate/speed, in the range [0.25, 2.0]. 1.0 is
the normal native speed supported by the specific voice. 2.0 is twice as
fast, and 0.5 is half as fast. If unset(0.0), defaults to the native 1.0
speed. Any other values < 0.25 or > 2.0 will return an error.
[[["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,["# Cloud Text-to-Speech V1 Client - Class StreamingAudioConfig (2.2.2)\n\nVersion latestkeyboard_arrow_down\n\n- [2.2.2 (latest)](/php/docs/reference/cloud-text-to-speech/latest/V1.StreamingAudioConfig)\n- [2.2.1](/php/docs/reference/cloud-text-to-speech/2.2.1/V1.StreamingAudioConfig)\n- [2.0.1](/php/docs/reference/cloud-text-to-speech/2.0.1/V1.StreamingAudioConfig)\n- [1.12.2](/php/docs/reference/cloud-text-to-speech/1.12.2/V1.StreamingAudioConfig)\n- [1.11.0](/php/docs/reference/cloud-text-to-speech/1.11.0/V1.StreamingAudioConfig)\n- [1.10.0](/php/docs/reference/cloud-text-to-speech/1.10.0/V1.StreamingAudioConfig)\n- [1.9.1](/php/docs/reference/cloud-text-to-speech/1.9.1/V1.StreamingAudioConfig)\n- [1.8.5](/php/docs/reference/cloud-text-to-speech/1.8.5/V1.StreamingAudioConfig)\n- [1.7.2](/php/docs/reference/cloud-text-to-speech/1.7.2/V1.StreamingAudioConfig)\n- [1.6.1](/php/docs/reference/cloud-text-to-speech/1.6.1/V1.StreamingAudioConfig)\n- [1.5.6](/php/docs/reference/cloud-text-to-speech/1.5.6/V1.StreamingAudioConfig)\n- [1.4.5](/php/docs/reference/cloud-text-to-speech/1.4.5/V1.StreamingAudioConfig) \nReference documentation and code samples for the Cloud Text-to-Speech V1 Client class StreamingAudioConfig.\n\nDescription of the desired output audio data.\n\nGenerated from protobuf message `google.cloud.texttospeech.v1.StreamingAudioConfig`\n\nNamespace\n---------\n\nGoogle \\\\ Cloud \\\\ TextToSpeech \\\\ V1\n\nMethods\n-------\n\n### __construct\n\nConstructor.\n\n### getAudioEncoding\n\nRequired. The format of the audio byte stream.\n\nStreaming supports PCM, ALAW, MULAW and OGG_OPUS. All other encodings\nreturn an error.\n\n### setAudioEncoding\n\nRequired. The format of the audio byte stream.\n\nStreaming supports PCM, ALAW, MULAW and OGG_OPUS. All other encodings\nreturn an error.\n\n### getSampleRateHertz\n\nOptional. The synthesis sample rate (in hertz) for this audio.\n\n### setSampleRateHertz\n\nOptional. The synthesis sample rate (in hertz) for this audio.\n\n### getSpeakingRate\n\nOptional. Input only. Speaking rate/speed, in the range \\[0.25, 2.0\\]. 1.0 is\nthe normal native speed supported by the specific voice. 2.0 is twice as\nfast, and 0.5 is half as fast. If unset(0.0), defaults to the native 1.0\nspeed. Any other values \\\u003c 0.25 or \\\u003e 2.0 will return an error.\n\n### setSpeakingRate\n\nOptional. Input only. Speaking rate/speed, in the range \\[0.25, 2.0\\]. 1.0 is\nthe normal native speed supported by the specific voice. 2.0 is twice as\nfast, and 0.5 is half as fast. If unset(0.0), defaults to the native 1.0\nspeed. Any other values \\\u003c 0.25 or \\\u003e 2.0 will return an error."]]