homeguild_voice_openai_tts
OpenAI TTS provider for homeguild_voice_kit. Natural-sounding text-to-speech with a streaming sentence queue, voice selection, and speed control.
Part of Voice Kit by HomeGuild Labs.
Usage
import 'package:homeguild_voice_openai_tts/homeguild_voice_openai_tts.dart';
final tts = OpenAITTSProvider(
apiKey: 'YOUR_OPENAI_KEY',
voice: 'alloy', // alloy, echo, fable, onyx, nova, shimmer
speed: 1.25, // 0.25 to 4.0
model: 'tts-1', // or 'tts-1-hd' for higher quality
textSanitizer: (text) => text.replaceAll('**', ''), // strip markdown
onUsageTracked: (seconds) => print('Used ${seconds}s of TTS'),
);
Pass it to VoiceConversationManager from homeguild_voice_kit:
final manager = VoiceConversationManager(
sttProvider: stt,
ttsProvider: tts,
streamAdapter: myBackend,
);
Features
- Streaming sentence queue with sequential playback
- Six voice options: alloy, echo, fable, onyx, nova, shimmer
- Runtime speed adjustment (0.25x to 4.0x)
- Optional text sanitizer callback (strip markdown, clean formatting)
- Optional usage tracking callback
- Graceful queue clearing for interruptions
Requirements
- An OpenAI API key with TTS access
License
MIT — see LICENSE.
Libraries
- homeguild_voice_openai_tts
- OpenAI TTS provider for homeguild_voice_kit.