Class SynthesizeSpeechConfig.Builder (0.11.0)

public static final class SynthesizeSpeechConfig.Builder extends GeneratedMessage.Builder<SynthesizeSpeechConfig.Builder> implements SynthesizeSpeechConfigOrBuilder

Configuration for how the agent response should be synthesized.

Protobuf type google.cloud.ces.v1beta.SynthesizeSpeechConfig

Static Methods

getDescriptor()

public static final Descriptors.Descriptor getDescriptor()
Returns
Type Description
Descriptor

Methods

build()

public SynthesizeSpeechConfig build()
Returns
Type Description
SynthesizeSpeechConfig

buildPartial()

public SynthesizeSpeechConfig buildPartial()
Returns
Type Description
SynthesizeSpeechConfig

clear()

public SynthesizeSpeechConfig.Builder clear()
Returns
Type Description
SynthesizeSpeechConfig.Builder
Overrides

clearInstruction()

public SynthesizeSpeechConfig.Builder clearInstruction()

Optional. The instruction used to synthesize speech when using a generative model.

string instruction = 5 [(.google.api.field_behavior) = OPTIONAL];

Returns
Type Description
SynthesizeSpeechConfig.Builder

This builder for chaining.

clearModel()

public SynthesizeSpeechConfig.Builder clearModel()

Optional. The model used to synthesize audio. Currently supported values:

  • "gemini-3.1-flash-tts-preview" If empty, Chirp3-HD is used.

string model = 4 [(.google.api.field_behavior) = OPTIONAL];

Returns
Type Description
SynthesizeSpeechConfig.Builder

This builder for chaining.

clearSpeakingRate()

public SynthesizeSpeechConfig.Builder clearSpeakingRate()

Optional. The 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. Values outside of the range [0.25, 2.0] will return an error.

double speaking_rate = 2 [(.google.api.field_behavior) = OPTIONAL];

Returns
Type Description
SynthesizeSpeechConfig.Builder

This builder for chaining.

clearVoice()

public SynthesizeSpeechConfig.Builder clearVoice()

Optional. The name of the voice. If not set, the service will choose a voice based on the other parameters such as language_code.

For the list of available voices, please refer to Supported voices and languages from Cloud Text-to-Speech.

string voice = 1 [(.google.api.field_behavior) = OPTIONAL];

Returns
Type Description
SynthesizeSpeechConfig.Builder

This builder for chaining.

clearVoiceSampleGcsUri()

public SynthesizeSpeechConfig.Builder clearVoiceSampleGcsUri()

Optional. The Cloud Storage URI to the audio sample for voice cloning. The audio sample should be a mono-channel, 24kHz WAV file.

Note: Please make sure the CES service agent service-<PROJECT-NUMBER>@gcp-sa-ces.iam.gserviceaccount.com has storage.objects.get permission to the Cloud Storage object.

string voice_sample_gcs_uri = 3 [(.google.api.field_behavior) = OPTIONAL];

Returns
Type Description
SynthesizeSpeechConfig.Builder

This builder for chaining.

getDefaultInstanceForType()

public SynthesizeSpeechConfig getDefaultInstanceForType()
Returns
Type Description
SynthesizeSpeechConfig

getDescriptorForType()

public Descriptors.Descriptor getDescriptorForType()
Returns
Type Description
Descriptor
Overrides

getInstruction()

public String getInstruction()

Optional. The instruction used to synthesize speech when using a generative model.

string instruction = 5 [(.google.api.field_behavior) = OPTIONAL];

Returns
Type Description
String

The instruction.

getInstructionBytes()

public ByteString getInstructionBytes()

Optional. The instruction used to synthesize speech when using a generative model.

string instruction = 5 [(.google.api.field_behavior) = OPTIONAL];

Returns
Type Description
ByteString

The bytes for instruction.

getModel()

public String getModel()

Optional. The model used to synthesize audio. Currently supported values:

  • "gemini-3.1-flash-tts-preview" If empty, Chirp3-HD is used.

string model = 4 [(.google.api.field_behavior) = OPTIONAL];

Returns
Type Description
String

The model.

getModelBytes()

public ByteString getModelBytes()

Optional. The model used to synthesize audio. Currently supported values:

  • "gemini-3.1-flash-tts-preview" If empty, Chirp3-HD is used.

string model = 4 [(.google.api.field_behavior) = OPTIONAL];

Returns
Type Description
ByteString

The bytes for model.

getSpeakingRate()

public double getSpeakingRate()

Optional. The 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. Values outside of the range [0.25, 2.0] will return an error.

double speaking_rate = 2 [(.google.api.field_behavior) = OPTIONAL];

Returns
Type Description
double

The speakingRate.

getVoice()

public String getVoice()

Optional. The name of the voice. If not set, the service will choose a voice based on the other parameters such as language_code.

For the list of available voices, please refer to Supported voices and languages from Cloud Text-to-Speech.

string voice = 1 [(.google.api.field_behavior) = OPTIONAL];

Returns
Type Description
String

The voice.

getVoiceBytes()

public ByteString getVoiceBytes()

Optional. The name of the voice. If not set, the service will choose a voice based on the other parameters such as language_code.

For the list of available voices, please refer to Supported voices and languages from Cloud Text-to-Speech.

string voice = 1 [(.google.api.field_behavior) = OPTIONAL];

Returns
Type Description
ByteString

The bytes for voice.

getVoiceSampleGcsUri()

public String getVoiceSampleGcsUri()

Optional. The Cloud Storage URI to the audio sample for voice cloning. The audio sample should be a mono-channel, 24kHz WAV file.

Note: Please make sure the CES service agent service-<PROJECT-NUMBER>@gcp-sa-ces.iam.gserviceaccount.com has storage.objects.get permission to the Cloud Storage object.

string voice_sample_gcs_uri = 3 [(.google.api.field_behavior) = OPTIONAL];

Returns
Type Description
String

The voiceSampleGcsUri.

getVoiceSampleGcsUriBytes()

public ByteString getVoiceSampleGcsUriBytes()

Optional. The Cloud Storage URI to the audio sample for voice cloning. The audio sample should be a mono-channel, 24kHz WAV file.

Note: Please make sure the CES service agent service-<PROJECT-NUMBER>@gcp-sa-ces.iam.gserviceaccount.com has storage.objects.get permission to the Cloud Storage object.

string voice_sample_gcs_uri = 3 [(.google.api.field_behavior) = OPTIONAL];

Returns
Type Description
ByteString

The bytes for voiceSampleGcsUri.

internalGetFieldAccessorTable()

protected GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable()
Returns
Type Description
FieldAccessorTable
Overrides

isInitialized()

public final boolean isInitialized()
Returns
Type Description
boolean
Overrides

mergeFrom(SynthesizeSpeechConfig other)

public SynthesizeSpeechConfig.Builder mergeFrom(SynthesizeSpeechConfig other)
Parameter
Name Description
other SynthesizeSpeechConfig
Returns
Type Description
SynthesizeSpeechConfig.Builder

mergeFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry)

public SynthesizeSpeechConfig.Builder mergeFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry)
Parameters
Name Description
input CodedInputStream
extensionRegistry ExtensionRegistryLite
Returns
Type Description
SynthesizeSpeechConfig.Builder
Overrides
Exceptions
Type Description
IOException

mergeFrom(Message other)

public SynthesizeSpeechConfig.Builder mergeFrom(Message other)
Parameter
Name Description
other Message
Returns
Type Description
SynthesizeSpeechConfig.Builder
Overrides

setInstruction(String value)

public SynthesizeSpeechConfig.Builder setInstruction(String value)

Optional. The instruction used to synthesize speech when using a generative model.

string instruction = 5 [(.google.api.field_behavior) = OPTIONAL];

Parameter
Name Description
value String

The instruction to set.

Returns
Type Description
SynthesizeSpeechConfig.Builder

This builder for chaining.

setInstructionBytes(ByteString value)

public SynthesizeSpeechConfig.Builder setInstructionBytes(ByteString value)

Optional. The instruction used to synthesize speech when using a generative model.

string instruction = 5 [(.google.api.field_behavior) = OPTIONAL];

Parameter
Name Description
value ByteString

The bytes for instruction to set.

Returns
Type Description
SynthesizeSpeechConfig.Builder

This builder for chaining.

setModel(String value)

public SynthesizeSpeechConfig.Builder setModel(String value)

Optional. The model used to synthesize audio. Currently supported values:

  • "gemini-3.1-flash-tts-preview" If empty, Chirp3-HD is used.

string model = 4 [(.google.api.field_behavior) = OPTIONAL];

Parameter
Name Description
value String

The model to set.

Returns
Type Description
SynthesizeSpeechConfig.Builder

This builder for chaining.

setModelBytes(ByteString value)

public SynthesizeSpeechConfig.Builder setModelBytes(ByteString value)

Optional. The model used to synthesize audio. Currently supported values:

  • "gemini-3.1-flash-tts-preview" If empty, Chirp3-HD is used.

string model = 4 [(.google.api.field_behavior) = OPTIONAL];

Parameter
Name Description
value ByteString

The bytes for model to set.

Returns
Type Description
SynthesizeSpeechConfig.Builder

This builder for chaining.

setSpeakingRate(double value)

public SynthesizeSpeechConfig.Builder setSpeakingRate(double value)

Optional. The 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. Values outside of the range [0.25, 2.0] will return an error.

double speaking_rate = 2 [(.google.api.field_behavior) = OPTIONAL];

Parameter
Name Description
value double

The speakingRate to set.

Returns
Type Description
SynthesizeSpeechConfig.Builder

This builder for chaining.

setVoice(String value)

public SynthesizeSpeechConfig.Builder setVoice(String value)

Optional. The name of the voice. If not set, the service will choose a voice based on the other parameters such as language_code.

For the list of available voices, please refer to Supported voices and languages from Cloud Text-to-Speech.

string voice = 1 [(.google.api.field_behavior) = OPTIONAL];

Parameter
Name Description
value String

The voice to set.

Returns
Type Description
SynthesizeSpeechConfig.Builder

This builder for chaining.

setVoiceBytes(ByteString value)

public SynthesizeSpeechConfig.Builder setVoiceBytes(ByteString value)

Optional. The name of the voice. If not set, the service will choose a voice based on the other parameters such as language_code.

For the list of available voices, please refer to Supported voices and languages from Cloud Text-to-Speech.

string voice = 1 [(.google.api.field_behavior) = OPTIONAL];

Parameter
Name Description
value ByteString

The bytes for voice to set.

Returns
Type Description
SynthesizeSpeechConfig.Builder

This builder for chaining.

setVoiceSampleGcsUri(String value)

public SynthesizeSpeechConfig.Builder setVoiceSampleGcsUri(String value)

Optional. The Cloud Storage URI to the audio sample for voice cloning. The audio sample should be a mono-channel, 24kHz WAV file.

Note: Please make sure the CES service agent service-<PROJECT-NUMBER>@gcp-sa-ces.iam.gserviceaccount.com has storage.objects.get permission to the Cloud Storage object.

string voice_sample_gcs_uri = 3 [(.google.api.field_behavior) = OPTIONAL];

Parameter
Name Description
value String

The voiceSampleGcsUri to set.

Returns
Type Description
SynthesizeSpeechConfig.Builder

This builder for chaining.

setVoiceSampleGcsUriBytes(ByteString value)

public SynthesizeSpeechConfig.Builder setVoiceSampleGcsUriBytes(ByteString value)

Optional. The Cloud Storage URI to the audio sample for voice cloning. The audio sample should be a mono-channel, 24kHz WAV file.

Note: Please make sure the CES service agent service-<PROJECT-NUMBER>@gcp-sa-ces.iam.gserviceaccount.com has storage.objects.get permission to the Cloud Storage object.

string voice_sample_gcs_uri = 3 [(.google.api.field_behavior) = OPTIONAL];

Parameter
Name Description
value ByteString

The bytes for voiceSampleGcsUri to set.

Returns
Type Description
SynthesizeSpeechConfig.Builder

This builder for chaining.