GoogleTTSCapability class abstract
Google-specific TTS capability interface
This interface provides Google Gemini's native text-to-speech capabilities which differ from traditional TTS APIs by using chat-like interactions with audio output modality.
Key Features:
- Controllable speech style through natural language prompts
- Single and multi-speaker support
- Voice configuration with prebuilt voices
- Streaming audio generation
- Integration with chat models for audio output
Usage Example:
final googleProvider = await ai()
.google()
.apiKey(apiKey)
.model('gemini-2.5-flash-preview-tts')
.build();
if (googleProvider is GoogleTTSCapability) {
final response = await googleProvider.generateSpeech(
GoogleTTSRequest(
text: 'Say cheerfully: Have a wonderful day!',
voiceConfig: GoogleVoiceConfig.prebuilt('Kore'),
),
);
// response.audioData contains the generated audio
}
- Implementers
Constructors
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
generateSpeech(
GoogleTTSRequest request) → Future< GoogleTTSResponse> - Generate speech from text using Google's native TTS
-
generateSpeechStream(
GoogleTTSRequest request) → Stream< GoogleTTSStreamEvent> - Generate speech with streaming output
-
getAvailableVoices(
) → Future< List< GoogleVoiceInfo> > - Get available voices for Google TTS
-
getSupportedLanguages(
) → Future< List< String> > - Get supported languages for Google TTS
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
getPredefinedVoices(
) → List< GoogleVoiceInfo> - Get predefined Google TTS voices
-
getSupportedLanguageCodes(
) → List< String> - Get supported languages for Google TTS