SpeechConfig

@PublicPreviewAPI
class SpeechConfig


Speech configuration class for controlling the model's speech and audio generation behaviors.

This allows you to configure the voice properties (single-speaker OR multi-speaker setup) and language preferences when requesting the model to generate spoken responses.

Summary

Public constructors

SpeechConfig(
    multiSpeakerVoiceConfig: MultiSpeakerVoiceConfig,
    languageCode: String?
)

Constructs a SpeechConfig for a multi-speaker setup.

SpeechConfig(voice: Voice, languageCode: String?)

Constructs a SpeechConfig for a single-speaker setup.

Public properties

String?

The optional IETF BCP-47 language code (such as "en-US", "es-ES") used to guide the model's speech synthesis and recognition.

MultiSpeakerVoiceConfig?

The multi-speaker configuration.

Voice?

The single-speaker Voice configuration.

Public constructors

SpeechConfig

SpeechConfig(
    multiSpeakerVoiceConfig: MultiSpeakerVoiceConfig,
    languageCode: String? = null
)

Constructs a SpeechConfig for a multi-speaker setup.

Note: Multi-speaker configurations are not supported by the Live API (like LiveGenerationConfig).

Parameters
multiSpeakerVoiceConfig: MultiSpeakerVoiceConfig

The configuration detailing multiple speakers and their corresponding voices.

languageCode: String? = null

An optional IETF BCP-47 language code to guide speech generation.

SpeechConfig

SpeechConfig(voice: Voice, languageCode: String? = null)

Constructs a SpeechConfig for a single-speaker setup.

Parameters
voice: Voice

The specific Voice to use for speech generation.

languageCode: String? = null

An optional IETF BCP-47 language code to guide speech generation.

Public properties

languageCode

val languageCodeString?

The optional IETF BCP-47 language code (such as "en-US", "es-ES") used to guide the model's speech synthesis and recognition.

multiSpeakerVoiceConfig

val multiSpeakerVoiceConfigMultiSpeakerVoiceConfig?

The multi-speaker configuration. Note that this configuration is not supported by the Live API (like LiveGenerationConfig).

voice

val voiceVoice?

The single-speaker Voice configuration.