How does text to speech work?
TTS converts text to PCM audio. In a voice agent, text usually comes from the LLM response; you can also callagent.say() to speak text directly without the LLM.
Using Text-To-Speech with Stream
The Vision Agents SDK routes synthesized audio from the TTS plugin into your Stream call via the agent’s outbound audio track.Worked example
Let’s walk through a real-world example to see how TTS works in your application. Imagine you’re building a customer support system where callers get placed in a queue. Here’s how TTS makes this experience feel personal and professional: The Scenario: A customer calls your support line and gets placed in a queue. What Happens:- Your system detects the caller and generates a friendly message: “Thank you for calling TechCorp Support. Your estimated wait time is 5 minutes.”
- Instead of showing this as text on screen (which the caller can’t see), your TTS plugin converts it to natural speech that sounds like a real person.
- The voice speaks directly to the caller through the Stream call, creating an immediate human connection.
- As the queue updates, new messages are automatically spoken: “Your wait time is now 3 minutes” or “We’re connecting you to an agent now.”