lively-coat-10905
10/28/2025, 6:26 AMtall-airline-16756
10/28/2025, 6:26 AMtall-airline-16756
10/28/2025, 6:27 AMfrom livekit import rtc
from livekit.agents import JobContext, JobRequest, WorkerOptions, cli, stt
from livekit.plugins.google import STT
async def entrypoint(job: JobContext):
# Initialize Google Cloud STT
google_stt = STT(
languages="en-US",
model="latest_long",
interim_results=True,
punctuate=True
)
# Wait for the first participant to join
participant = await job.wait_for_participant()
# Find the first subscribed audio track (microphone)
audio_track = None
for track in participant.tracks.values():
if track.source == rtc.TrackSource.SOURCE_MICROPHONE:
pub = participant.get_track_publication(track.sid)
if pub and pub.is_subscribed and isinstance(pub.track, rtc.RemoteAudioTrack):
audio_track = pub.track
break
if not audio_track:
print("No subscribed microphone track found")
return
# Create a stream reader to get raw audio frames
track_stream = rtc.AudioStream(track=audio_track)
# Start the STT streaming session
stt_stream = google_stt.stream()
# Forward audio frames from participant to STT
async def input_task():
async for frame in track_stream:
stt_stream.push_frame(frame)
stt_stream.end_input()
# Process transcription output
async def output_task():
async for event in stt_stream:
if event.type == stt.SpeechEventType.FINAL_TRANSCRIPT:
print("Final Transcript:", event.alternatives[0].text)
elif event.type == stt.SpeechEventType.INTERIM_TRANSCRIPT:
print("Interim Transcript:", event.alternatives[0].text)
# Run transcription tasks concurrently
await asyncio.gather(input_task(), output_task(), return_exceptions=True)
await stt_stream.aclose()
async def request_handler(req: JobRequest):
await req.accept(entrypoint)
if __name__ == "__main__":
cli.run_app(WorkerOptions(request_handler=request_handler))
Just a quick reminder to make sure you have the livekit-plugins-google package installed and that the Google Cloud Speech-to-Text API is enabled in your project. You can easily customize how the transcription works by tweaking parameters like languages, model, and punctuate.
If you have any questions or would like me to walk you through more examples, please don’t hesitate to ask—I’m here to help!
Sources: livekit-plugins/livekit-plugins-google/README.md | Google Cloud STT plugin guide | LiveKit Docs | Google AI and LiveKit | LiveKit Docslively-coat-10905
10/28/2025, 6:32 AMtall-airline-16756
10/28/2025, 6:34 AMml-IN). To help you find out, here are a couple of steps you can try:
1. Take a look at the official Gemini TTS documentation for the list of supported voices and languages: Gemini TTS Voices.
2. If you don’t see Malayalam listed there, you might want to explore Google Cloud TTS, which offers a wider range of languages including Malayalam. You can check out the details here: Google Cloud TTS Voices.
If you’d like, I’m here to help you get started with Google Cloud TTS or clarify anything else. Just let me know!
Sources: livekit-plugins/livekit-plugins-aws/livekit/plugins/aws/tts.py | plugins/google/src/beta/gemini_tts.test.ts | Gemini TTS plugin guide | LiveKit Docs | Google AI and LiveKit | LiveKit Docs | Google Cloud TTS integration guide | LiveKit Docslively-coat-10905
10/28/2025, 6:39 AMtall-airline-16756
10/28/2025, 6:40 AMlively-coat-10905
10/28/2025, 7:15 AM