Text to Speech (TTS)
Convert written text into natural-sounding speech using AI voices.
Perfect for dialogue, narration, accessibility, or dynamic voice-over content — powered by ElevenLabs and other TTS providers.
✅ Basic Usage
🔉 You’ll receive a Unity
AudioClip
, ready for playback or saving.
⚙️ Configuration Options
SetVoice(GenAIVoice)
Choose which AI voice to use (e.g., ElevenLabsVoice.Rachel
)
SetSpeed(float)
Playback speed multiplier (e.g., 1.0
= normal)
SetSeed(uint)
Optional: generate deterministic output
SetOutputPath(path)
Save audio to specific path
SetOutputFormat(format)
Output format (MP3
, WAV
, PCM
, etc.) — ElevenLabs only
SetModel(model)
Set the model (optional — defaults from settings)
🚀 Streaming TTS
Play audio in real-time as it’s generated — ideal for chat avatars or quick feedback loops.
🎧
StreamAudioPlayer
is a component that plays incoming audio chunks as they arrive.
📦 Output Formats (ElevenLabs)
Use .SetOutputFormat(...)
to control file type:
OutputFormat.MPEG
Compact .mp3
format (default)
OutputFormat.PCM_S16LE_16
Raw PCM, 16-bit, mono, 16kHz
OutputFormat.WAV
Lossless .wav
format (useful for editing)
🧠 Tips
Voices vary by provider. You can define your own
GenAIVoice
or use built-in constants.For Unity playback, use
.AsAudioClip()
or.Play()
extension methods.If your TTS result sounds unnatural, try adjusting
temperature
,seed
, or choosing a different voice.
Last updated