fix: honour default_voice_code in _split_multi_voice - #515
Merged
Conversation
_split_multi_voice computed segment_lang as the first letter of the voice name when no explicit lang_code was provided, bypassing settings.default_voice_code entirely. This caused voices whose filename does not begin with a valid Kokoro language code to be routed to the wrong pipeline, returning empty audio (HTTP 200 with a zero-byte body). Mirror the precedence used in kokoro_v1.py: lang_code > settings.default_voice_code > voice[:1] Add two unit tests to guard the fix and the existing explicit-wins case. Fixes remsky#514 Signed-off-by: Christian-Sidak <61099993+Christian-Sidak@users.noreply.github.com>
Owner
|
Good catch, and thanks. I was able to repro, and looks like generate_from_phonemes has the same omission on the /dev path, I'll follow up with a commit on it |
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.
Summary
_split_multi_voice()inapi/src/services/tts_service.pycomputedsegment_langfrom the first character of the voice name when no explicitlang_codewas provided, skippingsettings.default_voice_codeentirely.ursa,eve,iris) were therefore routed to the wrong phonemiser pipeline, returning HTTP 200 with an empty body.kokoro_v1.py:lang_code>settings.default_voice_code>voice[:1].Fixes #514
Changes
api/src/services/tts_service.py(line ~295)Before:
After:
api/tests/test_tts_service.pyTwo new unit tests added alongside the existing
_split_multi_voicetests:test_split_multi_voice_default_voice_code_used_when_no_lang_code-- verifies that a voice namedursa(no language prefix) usessettings.default_voice_codewhen nolang_codeis passed.test_split_multi_voice_explicit_lang_code_beats_default-- verifies that an explicitlang_codestill wins oversettings.default_voice_code.Test plan
settingsis already imported intts_service.py(line 15)kokoro_v1.pytest_tts_service.py_split_multi_voiceare affected (the precedence is strictly additive)