Class VoiceSelectionParams.Builder (2.84.0)

public static final class VoiceSelectionParams.Builder extends GeneratedMessage.Builder<VoiceSelectionParams.Builder> implements VoiceSelectionParamsOrBuilder

Description of which voice to use for a synthesis request.

Protobuf type google.cloud.texttospeech.v1beta1.VoiceSelectionParams

Static Methods

getDescriptor()

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

Methods

build()

public VoiceSelectionParams build()
Returns
Type Description
VoiceSelectionParams

buildPartial()

public VoiceSelectionParams buildPartial()
Returns
Type Description
VoiceSelectionParams

clear()

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

clearCustomVoice()

public VoiceSelectionParams.Builder clearCustomVoice()

The configuration for a custom voice. If [CustomVoiceParams.model] is set, the service will choose the custom voice matching the specified configuration.

.google.cloud.texttospeech.v1beta1.CustomVoiceParams custom_voice = 4;

Returns
Type Description
VoiceSelectionParams.Builder

clearLanguageCode()

public VoiceSelectionParams.Builder clearLanguageCode()

Required. The language (and potentially also the region) of the voice expressed as a BCP-47 language tag, e.g. "en-US". This should not include a script tag (e.g. use "cmn-cn" rather than "cmn-Hant-cn"), because the script will be inferred from the input provided in the SynthesisInput. The TTS service will use this parameter to help choose an appropriate voice. Note that the TTS service may choose a voice with a slightly different language code than the one selected; it may substitute a different region (e.g. using en-US rather than en-CA if there isn't a Canadian voice available), or even a different language, e.g. using "nb" (Norwegian Bokmal) instead of "no" (Norwegian)".

string language_code = 1 [(.google.api.field_behavior) = REQUIRED];

Returns
Type Description
VoiceSelectionParams.Builder

This builder for chaining.

clearModelName()

public VoiceSelectionParams.Builder clearModelName()

Optional. The name of the model. If set, the service will choose the model matching the specified configuration.

string model_name = 6 [(.google.api.field_behavior) = OPTIONAL];

Returns
Type Description
VoiceSelectionParams.Builder

This builder for chaining.

clearMultiSpeakerVoiceConfig()

public VoiceSelectionParams.Builder clearMultiSpeakerVoiceConfig()

Optional. The configuration for a Gemini multi-speaker text-to-speech setup. Enables the use of two distinct voices in a single synthesis request.

.google.cloud.texttospeech.v1beta1.MultiSpeakerVoiceConfig multi_speaker_voice_config = 7 [(.google.api.field_behavior) = OPTIONAL];

Returns
Type Description
VoiceSelectionParams.Builder

clearName()

public VoiceSelectionParams.Builder clearName()

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

string name = 2;

Returns
Type Description
VoiceSelectionParams.Builder

This builder for chaining.

clearSsmlGender()

public VoiceSelectionParams.Builder clearSsmlGender()

The preferred gender of the voice. If not set, the service will choose a voice based on the other parameters such as language_code and name. Note that this is only a preference, not requirement; if a voice of the appropriate gender is not available, the synthesizer should substitute a voice with a different gender rather than failing the request.

.google.cloud.texttospeech.v1beta1.SsmlVoiceGender ssml_gender = 3;

Returns
Type Description
VoiceSelectionParams.Builder

This builder for chaining.

clearVoiceClone()

public VoiceSelectionParams.Builder clearVoiceClone()

Optional. The configuration for a voice clone. If [VoiceCloneParams.voice_clone_key] is set, the service chooses the voice clone matching the specified configuration.

.google.cloud.texttospeech.v1beta1.VoiceCloneParams voice_clone = 5 [(.google.api.field_behavior) = OPTIONAL];

Returns
Type Description
VoiceSelectionParams.Builder

getCustomVoice()

public CustomVoiceParams getCustomVoice()

The configuration for a custom voice. If [CustomVoiceParams.model] is set, the service will choose the custom voice matching the specified configuration.

.google.cloud.texttospeech.v1beta1.CustomVoiceParams custom_voice = 4;

Returns
Type Description
CustomVoiceParams

The customVoice.

getCustomVoiceBuilder()

public CustomVoiceParams.Builder getCustomVoiceBuilder()

The configuration for a custom voice. If [CustomVoiceParams.model] is set, the service will choose the custom voice matching the specified configuration.

.google.cloud.texttospeech.v1beta1.CustomVoiceParams custom_voice = 4;

Returns
Type Description
CustomVoiceParams.Builder

getCustomVoiceOrBuilder()

public CustomVoiceParamsOrBuilder getCustomVoiceOrBuilder()

The configuration for a custom voice. If [CustomVoiceParams.model] is set, the service will choose the custom voice matching the specified configuration.

.google.cloud.texttospeech.v1beta1.CustomVoiceParams custom_voice = 4;

Returns
Type Description
CustomVoiceParamsOrBuilder

getDefaultInstanceForType()

public VoiceSelectionParams getDefaultInstanceForType()
Returns
Type Description
VoiceSelectionParams

getDescriptorForType()

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

getLanguageCode()

public String getLanguageCode()

Required. The language (and potentially also the region) of the voice expressed as a BCP-47 language tag, e.g. "en-US". This should not include a script tag (e.g. use "cmn-cn" rather than "cmn-Hant-cn"), because the script will be inferred from the input provided in the SynthesisInput. The TTS service will use this parameter to help choose an appropriate voice. Note that the TTS service may choose a voice with a slightly different language code than the one selected; it may substitute a different region (e.g. using en-US rather than en-CA if there isn't a Canadian voice available), or even a different language, e.g. using "nb" (Norwegian Bokmal) instead of "no" (Norwegian)".

string language_code = 1 [(.google.api.field_behavior) = REQUIRED];

Returns
Type Description
String

The languageCode.

getLanguageCodeBytes()

public ByteString getLanguageCodeBytes()

Required. The language (and potentially also the region) of the voice expressed as a BCP-47 language tag, e.g. "en-US". This should not include a script tag (e.g. use "cmn-cn" rather than "cmn-Hant-cn"), because the script will be inferred from the input provided in the SynthesisInput. The TTS service will use this parameter to help choose an appropriate voice. Note that the TTS service may choose a voice with a slightly different language code than the one selected; it may substitute a different region (e.g. using en-US rather than en-CA if there isn't a Canadian voice available), or even a different language, e.g. using "nb" (Norwegian Bokmal) instead of "no" (Norwegian)".

string language_code = 1 [(.google.api.field_behavior) = REQUIRED];

Returns
Type Description
ByteString

The bytes for languageCode.

getModelName()

public String getModelName()

Optional. The name of the model. If set, the service will choose the model matching the specified configuration.

string model_name = 6 [(.google.api.field_behavior) = OPTIONAL];

Returns
Type Description
String

The modelName.

getModelNameBytes()

public ByteString getModelNameBytes()

Optional. The name of the model. If set, the service will choose the model matching the specified configuration.

string model_name = 6 [(.google.api.field_behavior) = OPTIONAL];

Returns
Type Description
ByteString

The bytes for modelName.

getMultiSpeakerVoiceConfig()

public MultiSpeakerVoiceConfig getMultiSpeakerVoiceConfig()

Optional. The configuration for a Gemini multi-speaker text-to-speech setup. Enables the use of two distinct voices in a single synthesis request.

.google.cloud.texttospeech.v1beta1.MultiSpeakerVoiceConfig multi_speaker_voice_config = 7 [(.google.api.field_behavior) = OPTIONAL];

Returns
Type Description
MultiSpeakerVoiceConfig

The multiSpeakerVoiceConfig.

getMultiSpeakerVoiceConfigBuilder()

public MultiSpeakerVoiceConfig.Builder getMultiSpeakerVoiceConfigBuilder()

Optional. The configuration for a Gemini multi-speaker text-to-speech setup. Enables the use of two distinct voices in a single synthesis request.

.google.cloud.texttospeech.v1beta1.MultiSpeakerVoiceConfig multi_speaker_voice_config = 7 [(.google.api.field_behavior) = OPTIONAL];

Returns
Type Description
MultiSpeakerVoiceConfig.Builder

getMultiSpeakerVoiceConfigOrBuilder()

public MultiSpeakerVoiceConfigOrBuilder getMultiSpeakerVoiceConfigOrBuilder()

Optional. The configuration for a Gemini multi-speaker text-to-speech setup. Enables the use of two distinct voices in a single synthesis request.

.google.cloud.texttospeech.v1beta1.MultiSpeakerVoiceConfig multi_speaker_voice_config = 7 [(.google.api.field_behavior) = OPTIONAL];

Returns
Type Description
MultiSpeakerVoiceConfigOrBuilder

getName()

public String getName()

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

string name = 2;

Returns
Type Description
String

The name.

getNameBytes()

public ByteString getNameBytes()

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

string name = 2;

Returns
Type Description
ByteString

The bytes for name.

getSsmlGender()

public SsmlVoiceGender getSsmlGender()

The preferred gender of the voice. If not set, the service will choose a voice based on the other parameters such as language_code and name. Note that this is only a preference, not requirement; if a voice of the appropriate gender is not available, the synthesizer should substitute a voice with a different gender rather than failing the request.

.google.cloud.texttospeech.v1beta1.SsmlVoiceGender ssml_gender = 3;

Returns
Type Description
SsmlVoiceGender

The ssmlGender.

getSsmlGenderValue()

public int getSsmlGenderValue()

The preferred gender of the voice. If not set, the service will choose a voice based on the other parameters such as language_code and name. Note that this is only a preference, not requirement; if a voice of the appropriate gender is not available, the synthesizer should substitute a voice with a different gender rather than failing the request.

.google.cloud.texttospeech.v1beta1.SsmlVoiceGender ssml_gender = 3;

Returns
Type Description
int

The enum numeric value on the wire for ssmlGender.

getVoiceClone()

public VoiceCloneParams getVoiceClone()

Optional. The configuration for a voice clone. If [VoiceCloneParams.voice_clone_key] is set, the service chooses the voice clone matching the specified configuration.

.google.cloud.texttospeech.v1beta1.VoiceCloneParams voice_clone = 5 [(.google.api.field_behavior) = OPTIONAL];

Returns
Type Description
VoiceCloneParams

The voiceClone.

getVoiceCloneBuilder()

public VoiceCloneParams.Builder getVoiceCloneBuilder()

Optional. The configuration for a voice clone. If [VoiceCloneParams.voice_clone_key] is set, the service chooses the voice clone matching the specified configuration.

.google.cloud.texttospeech.v1beta1.VoiceCloneParams voice_clone = 5 [(.google.api.field_behavior) = OPTIONAL];

Returns
Type Description
VoiceCloneParams.Builder

getVoiceCloneOrBuilder()

public VoiceCloneParamsOrBuilder getVoiceCloneOrBuilder()

Optional. The configuration for a voice clone. If [VoiceCloneParams.voice_clone_key] is set, the service chooses the voice clone matching the specified configuration.

.google.cloud.texttospeech.v1beta1.VoiceCloneParams voice_clone = 5 [(.google.api.field_behavior) = OPTIONAL];

Returns
Type Description
VoiceCloneParamsOrBuilder

hasCustomVoice()

public boolean hasCustomVoice()

The configuration for a custom voice. If [CustomVoiceParams.model] is set, the service will choose the custom voice matching the specified configuration.

.google.cloud.texttospeech.v1beta1.CustomVoiceParams custom_voice = 4;

Returns
Type Description
boolean

Whether the customVoice field is set.

hasMultiSpeakerVoiceConfig()

public boolean hasMultiSpeakerVoiceConfig()

Optional. The configuration for a Gemini multi-speaker text-to-speech setup. Enables the use of two distinct voices in a single synthesis request.

.google.cloud.texttospeech.v1beta1.MultiSpeakerVoiceConfig multi_speaker_voice_config = 7 [(.google.api.field_behavior) = OPTIONAL];

Returns
Type Description
boolean

Whether the multiSpeakerVoiceConfig field is set.

hasVoiceClone()

public boolean hasVoiceClone()

Optional. The configuration for a voice clone. If [VoiceCloneParams.voice_clone_key] is set, the service chooses the voice clone matching the specified configuration.

.google.cloud.texttospeech.v1beta1.VoiceCloneParams voice_clone = 5 [(.google.api.field_behavior) = OPTIONAL];

Returns
Type Description
boolean

Whether the voiceClone field is set.

internalGetFieldAccessorTable()

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

isInitialized()

public final boolean isInitialized()
Returns
Type Description
boolean
Overrides

mergeCustomVoice(CustomVoiceParams value)

public VoiceSelectionParams.Builder mergeCustomVoice(CustomVoiceParams value)

The configuration for a custom voice. If [CustomVoiceParams.model] is set, the service will choose the custom voice matching the specified configuration.

.google.cloud.texttospeech.v1beta1.CustomVoiceParams custom_voice = 4;

Parameter
Name Description
value CustomVoiceParams
Returns
Type Description
VoiceSelectionParams.Builder

mergeFrom(VoiceSelectionParams other)

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

mergeFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry)

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

mergeFrom(Message other)

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

mergeMultiSpeakerVoiceConfig(MultiSpeakerVoiceConfig value)

public VoiceSelectionParams.Builder mergeMultiSpeakerVoiceConfig(MultiSpeakerVoiceConfig value)

Optional. The configuration for a Gemini multi-speaker text-to-speech setup. Enables the use of two distinct voices in a single synthesis request.

.google.cloud.texttospeech.v1beta1.MultiSpeakerVoiceConfig multi_speaker_voice_config = 7 [(.google.api.field_behavior) = OPTIONAL];

Parameter
Name Description
value MultiSpeakerVoiceConfig
Returns
Type Description
VoiceSelectionParams.Builder

mergeVoiceClone(VoiceCloneParams value)

public VoiceSelectionParams.Builder mergeVoiceClone(VoiceCloneParams value)

Optional. The configuration for a voice clone. If [VoiceCloneParams.voice_clone_key] is set, the service chooses the voice clone matching the specified configuration.

.google.cloud.texttospeech.v1beta1.VoiceCloneParams voice_clone = 5 [(.google.api.field_behavior) = OPTIONAL];

Parameter
Name Description
value VoiceCloneParams
Returns
Type Description
VoiceSelectionParams.Builder

setCustomVoice(CustomVoiceParams value)

public VoiceSelectionParams.Builder setCustomVoice(CustomVoiceParams value)

The configuration for a custom voice. If [CustomVoiceParams.model] is set, the service will choose the custom voice matching the specified configuration.

.google.cloud.texttospeech.v1beta1.CustomVoiceParams custom_voice = 4;

Parameter
Name Description
value CustomVoiceParams
Returns
Type Description
VoiceSelectionParams.Builder

setCustomVoice(CustomVoiceParams.Builder builderForValue)

public VoiceSelectionParams.Builder setCustomVoice(CustomVoiceParams.Builder builderForValue)

The configuration for a custom voice. If [CustomVoiceParams.model] is set, the service will choose the custom voice matching the specified configuration.

.google.cloud.texttospeech.v1beta1.CustomVoiceParams custom_voice = 4;

Parameter
Name Description
builderForValue CustomVoiceParams.Builder
Returns
Type Description
VoiceSelectionParams.Builder

setLanguageCode(String value)

public VoiceSelectionParams.Builder setLanguageCode(String value)

Required. The language (and potentially also the region) of the voice expressed as a BCP-47 language tag, e.g. "en-US". This should not include a script tag (e.g. use "cmn-cn" rather than "cmn-Hant-cn"), because the script will be inferred from the input provided in the SynthesisInput. The TTS service will use this parameter to help choose an appropriate voice. Note that the TTS service may choose a voice with a slightly different language code than the one selected; it may substitute a different region (e.g. using en-US rather than en-CA if there isn't a Canadian voice available), or even a different language, e.g. using "nb" (Norwegian Bokmal) instead of "no" (Norwegian)".

string language_code = 1 [(.google.api.field_behavior) = REQUIRED];

Parameter
Name Description
value String

The languageCode to set.

Returns
Type Description
VoiceSelectionParams.Builder

This builder for chaining.

setLanguageCodeBytes(ByteString value)

public VoiceSelectionParams.Builder setLanguageCodeBytes(ByteString value)

Required. The language (and potentially also the region) of the voice expressed as a BCP-47 language tag, e.g. "en-US". This should not include a script tag (e.g. use "cmn-cn" rather than "cmn-Hant-cn"), because the script will be inferred from the input provided in the SynthesisInput. The TTS service will use this parameter to help choose an appropriate voice. Note that the TTS service may choose a voice with a slightly different language code than the one selected; it may substitute a different region (e.g. using en-US rather than en-CA if there isn't a Canadian voice available), or even a different language, e.g. using "nb" (Norwegian Bokmal) instead of "no" (Norwegian)".

string language_code = 1 [(.google.api.field_behavior) = REQUIRED];

Parameter
Name Description
value ByteString

The bytes for languageCode to set.

Returns
Type Description
VoiceSelectionParams.Builder

This builder for chaining.

setModelName(String value)

public VoiceSelectionParams.Builder setModelName(String value)

Optional. The name of the model. If set, the service will choose the model matching the specified configuration.

string model_name = 6 [(.google.api.field_behavior) = OPTIONAL];

Parameter
Name Description
value String

The modelName to set.

Returns
Type Description
VoiceSelectionParams.Builder

This builder for chaining.

setModelNameBytes(ByteString value)

public VoiceSelectionParams.Builder setModelNameBytes(ByteString value)

Optional. The name of the model. If set, the service will choose the model matching the specified configuration.

string model_name = 6 [(.google.api.field_behavior) = OPTIONAL];

Parameter
Name Description
value ByteString

The bytes for modelName to set.

Returns
Type Description
VoiceSelectionParams.Builder

This builder for chaining.

setMultiSpeakerVoiceConfig(MultiSpeakerVoiceConfig value)

public VoiceSelectionParams.Builder setMultiSpeakerVoiceConfig(MultiSpeakerVoiceConfig value)

Optional. The configuration for a Gemini multi-speaker text-to-speech setup. Enables the use of two distinct voices in a single synthesis request.

.google.cloud.texttospeech.v1beta1.MultiSpeakerVoiceConfig multi_speaker_voice_config = 7 [(.google.api.field_behavior) = OPTIONAL];

Parameter
Name Description
value MultiSpeakerVoiceConfig
Returns
Type Description
VoiceSelectionParams.Builder

setMultiSpeakerVoiceConfig(MultiSpeakerVoiceConfig.Builder builderForValue)

public VoiceSelectionParams.Builder setMultiSpeakerVoiceConfig(MultiSpeakerVoiceConfig.Builder builderForValue)

Optional. The configuration for a Gemini multi-speaker text-to-speech setup. Enables the use of two distinct voices in a single synthesis request.

.google.cloud.texttospeech.v1beta1.MultiSpeakerVoiceConfig multi_speaker_voice_config = 7 [(.google.api.field_behavior) = OPTIONAL];

Parameter
Name Description
builderForValue MultiSpeakerVoiceConfig.Builder
Returns
Type Description
VoiceSelectionParams.Builder

setName(String value)

public VoiceSelectionParams.Builder setName(String value)

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

string name = 2;

Parameter
Name Description
value String

The name to set.

Returns
Type Description
VoiceSelectionParams.Builder

This builder for chaining.

setNameBytes(ByteString value)

public VoiceSelectionParams.Builder setNameBytes(ByteString value)

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

string name = 2;

Parameter
Name Description
value ByteString

The bytes for name to set.

Returns
Type Description
VoiceSelectionParams.Builder

This builder for chaining.

setSsmlGender(SsmlVoiceGender value)

public VoiceSelectionParams.Builder setSsmlGender(SsmlVoiceGender value)

The preferred gender of the voice. If not set, the service will choose a voice based on the other parameters such as language_code and name. Note that this is only a preference, not requirement; if a voice of the appropriate gender is not available, the synthesizer should substitute a voice with a different gender rather than failing the request.

.google.cloud.texttospeech.v1beta1.SsmlVoiceGender ssml_gender = 3;

Parameter
Name Description
value SsmlVoiceGender

The ssmlGender to set.

Returns
Type Description
VoiceSelectionParams.Builder

This builder for chaining.

setSsmlGenderValue(int value)

public VoiceSelectionParams.Builder setSsmlGenderValue(int value)

The preferred gender of the voice. If not set, the service will choose a voice based on the other parameters such as language_code and name. Note that this is only a preference, not requirement; if a voice of the appropriate gender is not available, the synthesizer should substitute a voice with a different gender rather than failing the request.

.google.cloud.texttospeech.v1beta1.SsmlVoiceGender ssml_gender = 3;

Parameter
Name Description
value int

The enum numeric value on the wire for ssmlGender to set.

Returns
Type Description
VoiceSelectionParams.Builder

This builder for chaining.

setVoiceClone(VoiceCloneParams value)

public VoiceSelectionParams.Builder setVoiceClone(VoiceCloneParams value)

Optional. The configuration for a voice clone. If [VoiceCloneParams.voice_clone_key] is set, the service chooses the voice clone matching the specified configuration.

.google.cloud.texttospeech.v1beta1.VoiceCloneParams voice_clone = 5 [(.google.api.field_behavior) = OPTIONAL];

Parameter
Name Description
value VoiceCloneParams
Returns
Type Description
VoiceSelectionParams.Builder

setVoiceClone(VoiceCloneParams.Builder builderForValue)

public VoiceSelectionParams.Builder setVoiceClone(VoiceCloneParams.Builder builderForValue)

Optional. The configuration for a voice clone. If [VoiceCloneParams.voice_clone_key] is set, the service chooses the voice clone matching the specified configuration.

.google.cloud.texttospeech.v1beta1.VoiceCloneParams voice_clone = 5 [(.google.api.field_behavior) = OPTIONAL];

Parameter
Name Description
builderForValue VoiceCloneParams.Builder
Returns
Type Description
VoiceSelectionParams.Builder