faint-arm-51818
10/27/2025, 3:54 PMtall-airline-16756
10/27/2025, 3:54 PMtall-airline-16756
10/27/2025, 3:55 PMaudio_encoding parameter to PCM or LINEAR16 to improve audio quality. Playing around with sample rates like 16000 Hz or 48000 Hz might also make a difference.
2. Tune Speech Parameters: It’s a good idea to check that your pitch, speaking_rate, and volume_gain_db are within recommended ranges. For example, keeping volume_gain_db below +10 dB usually helps avoid distortion.
3. Enable SSML: Using SSML tags like <break time="500ms"/> can give you better control over pauses and intonation. Just a heads-up—SSML works best when use_streaming is turned off.
4. Segment Input Text: If you’re working with longer texts, try breaking them into smaller sentences with a sentence tokenizer. This often leads to smoother speech output.
5. Verify Voice and Language Settings: Double-check that your voice_name is set to en-US-Chirp3-HD-Charon and that the language and gender settings align with what you want.
6. Check Network Stability: If you’re using streaming synthesis, a stable network connection is key. If problems persist, consider disabling use_streaming and switching to batch synthesis instead.
If you’re still experiencing issues after trying these tips, it might help to confirm that the Chirp3-HD model is properly set up in your Google Cloud project. Testing with a simple example outside of LiveKit can also help identify where the problem might be.
Sources: examples/other/text-to-speech/rime_tts.py | Troubleshooting & Common Issues | livekit/livekit_composite | DeepWiki | Live Conversations with AI using ChatGPT and WebRTC | Google Cloud TTS integration guide | LiveKit Docsfaint-arm-51818
10/27/2025, 5:02 PMtall-airline-16756
10/27/2025, 5:03 PMblingfire sentence tokenizer. This approach helps the speech synthesis process handle manageable chunks, keeping the intonation and pacing feeling natural.
Basic Usage
Here’s a simple way to use the StreamAdapter wrapper to manage streaming input with proper segmentation:
from livekit.agents.tokenize import blingfire
from livekit.plugins import google
tokenizer = blingfire.SentenceTokenizer()
tts = google.TTS()
tts_stream = tts.stream() # Enables streaming synthesis
Then, you can push text in chunks and call end_input() when you’re done:
for sentence in text.split('. '):
tts_stream.push_text(sentence + '.')
await asyncio.sleep(0.1) # Simulate incremental input
tts_stream.end_input()
Custom Sentence Tokenizer
If you want more control, you can create a custom tokenizer. For example:
from livekit.agents import tokenize
import nltk
class CustomSentenceTokenizer(tokenize.SentenceTokenizer):
def tokenize(self, text: str) -> list[str]:
sentences = nltk.tokenize.sent_tokenize(text, 'english')
return sentences
Then, simply pass this tokenizer to your TTS instance:
tts = google.TTS(tokenizer=CustomSentenceTokenizer())
Best Practices
• Segment by sentences to allow for natural pauses.
• Combine very short sentences to prevent choppy output.
• Use language-specific rules for identifying sentence boundaries.
• Maintain context between chunks to ensure coherent pronunciation.
By following these steps, you’ll enjoy smooth and natural speech synthesis without any voice breaking. If you have any questions or need further help, feel free to ask—I’m here to support you!
Sources: livekit-plugins/livekit-plugins-upliftai/livekit/plugins/upliftai/tts.py | Live Conversations with AI using ChatGPT and WebRTC