Conversation
Refactor error handling to maintain exception context.
"fetch latest chnages from upstream "
| "voice_id": self._resolved_voice, | ||
| "language": self._resolved_lang_name, # display name, e.g. "Hindi" | ||
| } | ||
| await ws.send_str(json.dumps(payload)) |
There was a problem hiding this comment.
🟡 Missing _mark_started() call prevents TTS metrics from ever being emitted
The fonadalabs SynthesizeStream._run() never calls self._mark_started(), which is required by the base class SynthesizeStream to record the time when TTS synthesis begins. Every other SynthesizeStream plugin in the codebase (Cartesia, ElevenLabs, Deepgram, xai, Google, asyncai, Gradium, Murf, Sarvam, Minimax, Nvidia, Resemble, UpliftAI, FishAudio, Neuphonic, Telnyx — 16 total) calls self._mark_started() before or when sending data to the TTS service.
Without this call, self._started_time remains 0. In the base class _metrics_monitor_task at livekit-agents/livekit/agents/tts/tts.py:539, the _emit_metrics() function checks if not self._started_time — since not 0 is True, it returns early without emitting any metrics. This means no TTSMetrics are ever collected or emitted via the "metrics_collected" event for the fonadalabs plugin, breaking telemetry and monitoring.
Was this helpful? React with 👍 or 👎 to provide feedback.
| if not segments: | ||
| raise ValueError("No text received from input channel.") | ||
|
|
||
| text = " ".join(segments) |
There was a problem hiding this comment.
🔴 " ".join(segments) introduces spurious spaces between LLM tokens
LLM tokens pushed via push_text() already contain their own whitespace (e.g. "Hello", " world", "!"). The base class itself concatenates them without spaces at livekit-agents/livekit/agents/tts/tts.py:593 (self._pushed_text += token). Using " ".join(segments) on line 288 inserts an extra space between every token, producing text like "Hello world !" instead of "Hello world!". This corrupts the text sent to the TTS API, degrading speech quality. Should use "".join(segments) instead.
Was this helpful? React with 👍 or 👎 to provide feedback.
tinalenguyen
left a comment
There was a problem hiding this comment.
hi, thanks for the PR! few notes, could you:
- add the plugin to these files: pyproject.toml & livekit-agents/pyproject.toml
- bump the version to
1.5.0, it makes it easier to bump up versions for releases - address the devin comments if applicable
|
|
||
|
|
||
| @dataclass | ||
| class _Catalog: |
There was a problem hiding this comment.
could we create a file models.py and add a list of voices and languages there? it helps for users to see available ones, and TTS could accept FonadaVoices | str
There was a problem hiding this comment.
Yes @tinalenguyen we can do that ,thanks for suggestion.
Summary
Adds a new TTS plugin
livekit-plugins-fonadalabsfor FonadaLabs API —a high-quality text-to-speech service specializing in Indian languages.
Features
Environment Variable
FONADALABS_API_KEY— FonadaLabs API key