echoing-lamp-18687
12/23/2025, 11:15 AMtall-airline-16756
12/23/2025, 11:15 AMtall-airline-16756
12/23/2025, 11:16 AMlanguages: ["en","pa"], code_switching=true). Good for conversational streams.
• Deepgram (Nova-3) — multilingual mode / language detection for low-latency streaming of mixed-language audio.
• Google Cloud Speech-to-Text — can be configured with en-US and pa-IN alternatives for improved mixed-language accuracy.
TTS (Punjabi + English)
• Google Cloud Text-to-Speech — supports pa-IN (Punjabi) and many English voices; use for native Punjabi output and English output.
• Cartesia Sonic-3 — high-quality English TTS; use for the English portions when naturalness is a priority.
• ElevenLabs or similar (English) — very natural English voices; pair with Punjabi TTS for mixed output.
Recommended approach
• Use Gladia or Deepgram for STT with multilingual/code-switching enabled.
• For TTS, synthesize each utterance in the detected language: use Google Cloud TTS for Punjabi (pa-IN) and Cartesia/ElevenLabs for English segments.
• If you prefer a simpler flow, transcribe with Gladia (code-switching) and route Punjabi segments to Google TTS and English segments to Cartesia/ElevenLabs.
If you want, tell me:
• Are you streaming real-time audio or processing recordings?
• Do you need an entirely automated language-detection + routing pipeline, or manual routing is fine?
I’ll give implementation tips once I know your streaming/recording choice.
Sources: TTS Translator with Gladia STT | LiveKit docs | Deepgram STT | LiveKit docs | Google Cloud STT plugin guide | LiveKit docs | Cartesia TTS | LiveKit docs | Google Cloud TTS integration guide | LiveKit docsechoing-lamp-18687
12/24/2025, 5:01 AMtall-airline-16756
12/24/2025, 5:01 AMpa-IN → Punjabi TTS, en → English TTS). That yields natural bilingual audio output.
Concise example (conceptual, Python-style) 1) STT with code-switching enabled (streaming or file)
# conceptual example
stt = GladiaSTT(languages=["en","pa"], code_switching=True)
# audio_chunk is a stream buffer or file chunk
result = stt.transcribe(audio_chunk)
# result example:
# [
# {"text": "ਹੈਲੋ, how are you?", "language":"mixed", "segments":[
# {"text":"ਹੈਲੋ,","language":"pa"},
# {"text":" how are you?","language":"en"}
# ]}
# ]
2) Route segments to TTS per detected language
output_audio = []
for seg in result[0]["segments"]:
if seg["language"] in ("pa","pa-IN"):
audio = GoogleCloudTTS(text=seg["text"], language="pa-IN", voice="pa-voice")
else:
audio = CartesiaTTS(text=seg["text"], language="en-US", voice="en-voice")
output_audio.append(audio)
# concatenate output_audio chunks into final playback stream
final_audio = concatenate(output_audio)
play(final_audio)
Notes and practical tips
• If the STT gives a single transcription marked "mixed", use internal language detection on smaller windows (200–1000 ms) to split and tag segments.
• For live low-latency, stream transcribe and synthesize segments as they arrive; smooth transitions can be improved with short overlap buffering.
• For recordings, you can re-segment after full transcription for cleaner language boundaries.
• Keep punctuation and whitespace consistent when stitching TTS outputs to avoid clipped words.
If you tell me whether you’re doing streaming or batch (and which STT/TTS provider you prefer), I’ll provide a more specific code sample or integration pattern.echoing-lamp-18687
12/24/2025, 5:01 AMtall-airline-16756
12/24/2025, 5:02 AM