Repository navigation
feat(vartalaap): add livekit-plugins-vartalaap TTS plugin - #8448
roshanpuru wants to merge 4 commits into
Conversation
Vartalaap is a Hinglish and Indian-language TTS API. The plugin synthesises over POST /v1/tts (ChunkedStream, the chunked PCM body forwarded as it arrives) and streams over a pooled WS /v1/tts/stream (SynthesizeStream): text is cut into sentences as the LLM produces it, every sentence is sent as its own utterance and the server serves them in order, so the next sentence is synthesised while the current one plays. Every server parameter (voice, expression, digits, speed, temperature, seed, postfx, profile, raw) is a constructor option and an update_options keyword; prewarm() opens the socket ahead of the first turn; handshake errors never carry the key. Unit tests cover the request body, option validation, key redaction, in-order playback with stale pooled-socket leftovers dropped, and retryable vs non-retryable server errors. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…ence An error event tagged with another utterance's request_id (a pooled-socket leftover) no longer fails the current stream; untagged errors still do. SynthesizeStream reads the owning TTS's options when it sends each sentence, so update_options() between two sentences applies to the next one on the same socket. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
… before applying, expire sockets by lifetime - the receive loop wakes when the sender finishes with nothing pending, instead of waiting for a server message that never comes (a turn whose last sentence ended before the LLM closed the input would otherwise hit the receive timeout) - update_options validates a copy and assigns it only on success - pooled sockets expire 5 min after they were opened, not 5 min after their last reuse Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
There was a problem hiding this comment.
Devin Review found 1 potential issue.
1 flag not posted on this PR by your GitHub settings — view it in Devin Review. (Configure)
| if sender_done.is_set(): | ||
| return await ws.receive(timeout=self._conn_options.timeout) | ||
| recv = asyncio.ensure_future(ws.receive(timeout=self._conn_options.timeout)) |
There was a problem hiding this comment.
🔴 Input pause aborts speech mid-reply
When text pauses for ten seconds after a sentence, _recv_task times out despite having no pending utterance. Previously delivered audio prevents a retry, so the rest of the reply is lost.
Learn more
The input channel can remain open while an LLM waits for a tool or generates its next sentence. After the server ends the previous utterance, pending is empty but sender_done is false, so _recv_task calls ws.receive(timeout=self._conn_options.timeout) again. The default timeout is ten seconds in APIConnectOptions; a quiet connection triggers APITimeoutError. The base streaming retry loop refuses retries once it has emitted audio.
Example: The agent speaks its first sentence, then waits 12 seconds for a tool result before pushing the second. The stream raises a timeout at ten seconds, and the second sentence never plays.
Recommended fix: When pending is empty and the sender is still accepting input, wait for the next send or sender completion without a socket receive deadline. Apply the receive timeout only while an utterance awaits server audio, and keep handling unexpected connection closure during idle periods.
Was this helpful? React with 👍 or 👎 to provide feedback.
With no utterance in flight the pause between sentences is the LLM's, not the server's, so the stream waits for the next sentence or the end of input without a deadline; the connection timeout applies only while the server owes a message. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
|
Superseded by #8449: the plugin is renamed to Vartaloop (livekit-plugins-vartaloop). |
Summary
Adds
livekit-plugins-vartalaap, a TTS plugin for Vartalaap, a Hinglish and Indian-language text-to-speech API (24 kHz pcm16, first audio after the first 80 ms frame).ChunkedStream(synthesize()):POST /v1/tts, the chunked PCM body is forwarded as it arrives.SynthesizeStream(stream()): a pooledWS /v1/tts/streamconnection (utils.ConnectionPool, 5 min sessions,prewarm()). Text is cut into sentences as it is pushed (tokenize.basic.SentenceTokenizer, which ends sentences on the Devanagari danda too) and every sentence is sent at once as its own utterance; the server serves them in order and streams each one's audio back, so the next sentence is synthesised while the current one plays. Events and audio of other utterances left on a pooled socket are ignored.update_options()keyword:voice,expression(the API'sstyle),digits,speed,temperature,seed,postfx,profile,raw; they travel in each utterance's body, so updates apply from the next sentence without reconnecting.503(busy,Retry-After) and5xxare retryableAPIStatusErrors,4xxare not; handshake errors never carry the key.tests/test_plugin_vartalaap_tts.py(pytest.mark.plugin("vartalaap")): request body, validation, key redaction, in-order playback with stale leftovers dropped, retryable vs non-retryable errors.make check(ruff format, ruff check, mypy strict) and the unit tests pass. No version bumps, per CONTRIBUTING.Measured against the live API (2026-11-08, Mac to Mumbai, warm cache, 8 interleaved iterations)
stream()synthesize()16 concurrent streams for 20 s: 28.4 audio-seconds per wall-second through the plugin vs 28.0 raw, TTFA p95 116 ms vs 103 ms. Full tables in the plugin's development repo (
bench/RESULTS*.md).🤖 Generated with Claude Code