Repository navigation
fix(tts): preserve generation settings when finalizing a context - #118
Open
Apeksha9389 wants to merge 1 commit into
Open
Apeksha9389 wants to merge 1 commit into
Apeksha9389 wants to merge 1 commit into
Conversation
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A context can select its voice, model, output format and generation options on push()/send(), but no_more_inputs() builds its final packet from constructor defaults. For example, a sonic-3.6 utterance using PCM16 at 16 kHz and a per-request voice finishes with sonic-latest, float32 at 44.1 kHz and the default voice. Constructor defaults also replace explicit per-call overrides on finalization.
Keep a copy of each successfully sent generation request. Finalize with its synthesis settings, an empty transcript and continue=false; omit the one-shot flush flag. Repeated finalization remains a no-op, constructor defaults retain their normal behavior, and finalization before any input keeps the existing path. Apply the same handling to sync and async contexts.
Four regression tests fail on current main and pass with the fix. They use actual loopback WebSocket servers and the public Cartesia/AsyncCartesia connection APIs, covering contexts with and without defaults and per-call overrides. All 104 library tests pass on Python 3.12 with websockets 15.0.1. Changed-file Ruff lint/format, targeted MyPy/Pyright and git diff --check pass.
The generated REST API suite and live Cartesia synthesis were not run. The full uv sync hit a build-dependency download timeout; checks use the source tree with the required runtime/test dependencies. Only the hand-maintained lib/ implementation and tests are changed.
AI disclosure: prepared with OpenAI Codex assistance; the reported reproductions and checks were executed locally.