can i use chirp 3 model of google for tts
# ask-ai
b
can i use chirp 3 model of google for tts
t
Thanks for reaching out, Harsh. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
Great news! LiveKit does support integration with Google's Chirp 3 model for text-to-speech (TTS) using the
voice_cloning_key
parameter in the Google TTS plugin. This means you can create speech with a custom voice model made through Google's Chirp 3 service—pretty cool, right? Here’s a simple way to get started: 1. First, install the Google plugin by running:
pip install "livekit-agents[google]~=1.2"
2. Create your custom voice with Google Cloud’s Chirp 3 service and grab your
voice_cloning_key
. 3. Authenticate with Google Cloud by either setting the
GOOGLE_APPLICATION_CREDENTIALS
environment variable or by passing credentials directly when you create the TTS instance. 4. Set up your TTS instance using your
voice_cloning_key
and any other settings you want, like sample rate. 5. Finally, use this TTS setup in your LiveKit AgentSession, and you’re good to go! If you want to dive deeper into Chirp 3 and how voice cloning works, check out Google's documentation here: Chirp 3: Instant custom voice. It’s a great resource to help you along. Sources: tests/test_stt.py | Google Cloud TTS integration guide | LiveKit Docs | Google Cloud TTS integration guide | LiveKit Docs
b
no no, i am just asking about the normal chirp 3 model not the cloning one
t
Hey there! Yes, LiveKit totally supports using the standard Google Chirp 3 model for TTS without needing any voice cloning. The default voice in LiveKit's Google TTS plugin is
en-US-Chirp3-HD-Charon
, which belongs to the Chirp family—known for its high-quality, natural-sounding speech. If you want to use the standard Chirp 3 model, here’s a quick way to set up your TTS instance:
Copy code
from livekit.plugins import google

tts = google.TTS(
    language="en-US",
    gender="neutral",
    voice_name="en-US-Chirp3-HD-Charon"
)
Just a heads up—the
voice_cloning_key
parameter is totally optional and only comes into play if you’re using custom cloned voices. If you leave it out, it’ll simply use standard voices like Chirp 3 by default. Sources: livekit-plugins/livekit-plugins-lmnt/livekit/plugins/lmnt/tts.py | Google Cloud TTS integration guide | LiveKit Docs
b
is there a way to add noise effect on the voice to make it sound like the phone isn't connecting well
t
LiveKit doesn’t have a built-in feature to add noise effects to TTS output, but don’t worry—you can still create this effect using a couple of handy methods: 1. Play Background Noise: You can use the
BackgroundAudioPlayer
class to play some ambient noise (like static or poor connection sounds) alongside your TTS output. This way, it feels like the audio quality is a bit degraded, without actually changing the TTS stream itself. Here’s a quick example:
Copy code
from livekit.agents import BackgroundAudioPlayer, AudioConfig
import os

background_audio = BackgroundAudioPlayer(
    ambient_sound=AudioConfig(
        str(os.path.join(os.path.dirname(os.path.abspath(__file__)), "bg_noise.mp3")),
        volume=0.8,
    ),
)

await background_audio.start(room=ctx.room, agent_session=session)
2. Customize the TTS Node: If you want to get a bit more hands-on, you can override the
tts_node
in a
VoicePipelineAgent
to add your own audio processing—like injecting synthetic noise or distortion right into the TTS audio frames. Here’s how that might look:
Copy code
async def tts_node(self, text: AsyncIterable[str], model_settings: ModelSettings) -> AsyncIterable[rtc.AudioFrame]:
    async for frame in Agent.default.tts_node(self, text, model_settings):
        noisy_frame = apply_noise_effect(frame)  # Your custom function
        yield noisy_frame
If you'd like, I can walk you through a detailed example of how to set up noise injection using either of these methods—just let me know! Sources: Agent speech and audio | LiveKit Docs | Agent speech and audio | LiveKit Docs | tests/fake_tts.py | Docs::Agents | Noise & echo cancellation | LiveKit Docs