future-stone-69754
10/28/2025, 5:32 AMtall-airline-16756
10/28/2025, 5:32 AMtall-airline-16756
10/28/2025, 5:32 AMtts argument in your AgentSession configuration. Here’s a quick example:
session = AgentSession(
llm="openai/gpt-4o-mini",
tts="cartesia/sonic-2:9626c31c-bec5-4cca-baa8-f8ba9e84c8bc", # Example with Cartesia
stt="assemblyai/universal-streaming:en"
)
If you’d like, I’m here to help you set up any specific TTS model or answer any questions you have—just let me know!
Sources: Qwen LLM | LiveKit Docs | examples/voice_agents/realtime_load_chat_history.py | tools/server/README.md | Models | LiveKit Docsfuture-stone-69754
10/28/2025, 5:37 AMtall-airline-16756
10/28/2025, 5:39 AMtts_node in your agent to seamlessly integrate your own TTS system. This approach lets you use a custom TTS engine, apply pronunciation rules, and manage audio processing just the way you need. Here's a simple overview to get you started:
1. Create a custom class that extends tts.TTS.
2. Implement the necessary methods like synthesize() or stream() to connect with your model.
3. Override the tts_node in your agent pipeline to utilize your custom TTS instance.
4. If you'd like, you can also use SSML or preprocessing hooks for better pronunciation control.
Here's an example to illustrate:
class CustomTTS(tts.TTS):
def __init__(self, model_path, voice_id):
super().__init__(capabilities=tts.TTSCapabilities(streaming=True), sample_rate=24000)
self.model_path = model_path
self.voice_id = voice_id
def synthesize(self, text):
# Implement your custom synthesis logic here
pass
class Agent(VoiceAgent):
async def tts_node(self, text, model_settings):
custom_tts = CustomTTS(model_path="path/to/model", voice_id="custom_voice")
async for text_chunk in text:
audio_stream = custom_tts.synthesize(text_chunk)
async for audio_frame in audio_stream:
yield audio_frame
If you'd like, I can walk you through implementing a specific custom TTS backend or assist with any particular part of your setup. Just let me know how I can support you best!
Sources: Pipeline nodes and hooks | LiveKit Docs | livekit-agents/livekit/agents/voice/agent.py | agents/src/inference/tts.ts | Text-to-speech (TTS) models | LiveKit Docs | LMNT TTS plugin guide | LiveKit Docsfuture-stone-69754
10/28/2025, 5:43 AMtall-airline-16756
10/28/2025, 5:43 AMtts.TTS class in LiveKit to connect with the Hugging Face API. You’ll implement methods like synthesize() to send text input and receive audio output.
3. Ensure Audio Format Compatibility: LiveKit expects PCM audio at 24kHz. If the API returns a different format, you can convert it in real-time or request PCM output to keep everything smooth.
4. Register and Use the Plugin: Use your custom TTS instance in your agent pipeline. For example:
class Qwen3TTSTTS(tts.TTS):
def __init__(self, api_key, endpoint_url):
super().__init__(capabilities=tts.TTSCapabilities(streaming=False), sample_rate=24000)
self.api_key = api_key
self.endpoint_url = endpoint_url
def synthesize(self, text):
# Implement API call to Hugging Face here
pass
# Use in agent
async def entrypoint(job):
tts_plugin = Qwen3TTSTTS(api_key="your_hf_token", endpoint_url="https://api-inference.huggingface.co/models/qwen/Qwen3-TTS-Flash")
job.agent.output_audio.add_all([tts_plugin])
If you’d like, I’m here to walk you through deploying the model on Hugging Face or help with implementing the plugin. Just let me know how I can assist!
Sources: Text-to-speech (TTS) models | LiveKit Docs | livekit-plugins/livekit-plugins-baseten/livekit/plugins/baseten/tts.py | common/arg.cpp