Hey there! To help speed up the latency of your TTS and STT models in LiveKit, here are some friendly tips you might find useful:
•
Optimize Network Proximity: Try to have your agent located close to the LLM, STT, and TTS services. This can really help cut down on network delays.
•
Use Streaming APIs: If your STT and TTS providers offer streaming APIs, switching to those can make things faster compared to the usual non-streaming methods.
•
Choose Low-Latency Models: For TTS, models like Rime are great for real-time use. For STT, smaller models like Whisper (especially if you run them locally) can reduce latency, though keep in mind they might support fewer languages.
•
Optimize Audio Processing: Adjusting audio frame sizes—like using a 20ms frame size with WebRTC’s default encoding—can help balance speed and accuracy.
•
Monitor and Analyze Metrics: Keep an eye on latency using metrics APIs, focusing on Time To First Token (TTFT) and Time To First Byte (TTFB) to spot any slow spots.
These ideas should help bring down that 2-3 minute delay you’re seeing. If you want to dive deeper into any of these or need a hand, just let me know—I’m here to help!
Sources:
Live Conversations with AI using ChatGPT and WebRTC