microscopic-dress-75199
09/29/2025, 4:15 PMtall-airline-16756
09/29/2025, 4:15 PMtall-airline-16756
09/29/2025, 4:15 PMmicroscopic-dress-75199
09/29/2025, 4:16 PMtall-airline-16756
09/29/2025, 4:16 PM.env file to get things connected.
3. Configure TTS: You can tailor voice characteristics like voice_id, model, and voice_settings to adjust stability, style, and speed exactly how you want.
4. Use SSML: Don’t forget to enable SSML parsing! It’s great for controlling pronunciation and pacing with tags like <phoneme> and <break>.
Just a quick heads-up: ElevenLabs-specific prompt markers like [laughing] or [smiling] aren’t directly supported. However, you can still create similar effects by fine-tuning voice settings or by pre-processing the LLM output to include SSML or adjusted parameters.
If you’d like, I’m here to help with detailed examples or any other questions you might have—just let me know!
Sources: pipeline-tts/elevenlabs_tts.py | ElevenLabs TTS integration guide | LiveKit Docs | ElevenLabs integration guide | LiveKit Docs | ElevenLabs TTS integration guide | LiveKit Docsmicroscopic-dress-75199
09/29/2025, 4:18 PMtall-airline-16756
09/29/2025, 4:19 PMenable_ssml_parsing=True. This step is key to getting everything to work smoothly.
2. Example of SSML Input:
<speak>
The word "GIF" is pronounced <phoneme alphabet="ipa" ph="dʒɪf">JIF</phoneme>.
<break time="500ms"/> This is an example of a pause.
</speak>
3. Python Code Example:
from livekit.plugins import elevenlabs
tts_instance = elevenlabs.TTS(
voice_id="ODq5zmih8GrVes37Dizd",
model="eleven_multilingual_v2",
voice_settings=elevenlabs.VoiceSettings(
stability=0.7,
similarity_boost=0.85,
style=0.5,
speed=1.0,
use_speaker_boost=True
),
language="en",
enable_ssml_parsing=True
)
# Example text with SSML
tts_instance.speak("<speak>Hello, <break time='1s'/> how are you?</speak>")
This little example shows how you can use SSML tags like <phoneme> to guide pronunciation and <break> to add pauses. Feel free to include these tags in your text input to make the speech sound just right.
If anything feels unclear or if you'd like me to walk you through more examples, just let me know—I’m here to help!microscopic-dress-75199
09/29/2025, 4:21 PMtall-airline-16756
09/29/2025, 4:22 PMinstructions field) help control how the speech sounds—things like tone, pace, and style. For example, "Speak in a calm and engaging tone."
How to Set Instructions
1. For the Agent (LLM Context): You can provide instructions when you initialize the agent or update them on the fly using await agent.update_instructions("New instructions"). It’s pretty straightforward!
2. For TTS (Speech Style): Just set the instructions in your TTS configuration to guide how the speech is delivered. For example:
from livekit.plugins import google
tts = google.beta.GeminiTTS(
instructions="Speak in a friendly and engaging tone."
)
Best Practices for Creating Instructions
• Define Identity and Role: Clearly explain who the agent is and what they’re here to do.
• Specify Tone and Personality: Use warm and descriptive words like "friendly," "empathetic," or "professional."
• Include Context: Let the agent know the setting, for example, "This is a live, spoken dialogue over the phone."
• Use Natural Language: Encourage a conversational flow with natural pacing and emotional pauses.
• Set Operational Guidelines: Add helpful rules for tricky situations, like "Always confirm changes clearly."
• Focus TTS Prompts on Audio Style: Remember, prompts should shape how things sound, not what is said.
Just a quick note: while tone and emotions can be added to TTS prompts using voice settings or SSML tags, they don’t impact the LLM’s reasoning. If you’d like more examples or need any clarification, please don’t hesitate to ask—I’m here to help!
Sources: agents/src/voice/generation.ts | Google integration guide | LiveKit Docs | Docs::Agents | livekit-agents/livekit/agents/voice/agent.py | Gemini TTS integration guide | LiveKit Docsmicroscopic-dress-75199
09/29/2025, 4:24 PMtts = google.beta.GeminiTTS(
instructions="Speak in a friendly and engaging tone."
)tall-airline-16756
09/29/2025, 4:25 PMvoice_settings, such as:
• stability: Controls emotional stability (0.0–1.0).
• similarity_boost: Enhances similarity to the original voice (0.0–1.0).
• style: Influences expressiveness (0.0–1.0).
• speed: Adjusts narration speed (0.8–1.2).
• use_speaker_boost: Improves voice clarity (boolean).
These settings give you some great ways to customize the voice, though they don’t accept natural language prompts like "Speak in a friendly and engaging tone." ElevenLabs also supports SSML parsing for pronunciation tweaks, but keep in mind this mainly helps with phonetics rather than tone or emotional delivery.
On the other hand, Google Gemini TTS does allow you to include an instructions parameter where you can simply describe the tone, style, and pace you want. For example:
tts = google.beta.GeminiTTS(
model="gemini-2.5-flash-preview-tts",
voice_name="Zephyr",
instructions="Speak in a friendly and engaging tone."
)
If you’d like, I’m here to guide you through setting up either ElevenLabs or Gemini TTS configurations—just let me know how I can assist!
Sources: plugins/elevenlabs/src/tts.ts | Docs::Agents | livekit-plugins/livekit-plugins-elevenlabs/livekit/plugins/elevenlabs/tts.p... | Docs::Agents