Skip to content

fix: pass language parameter to TTS models#97

Closed
jannone wants to merge 1 commit intojamiepine:mainfrom
jannone:fix/pass-language-to-tts-models
Closed

fix: pass language parameter to TTS models#97
jannone wants to merge 1 commit intojamiepine:mainfrom
jannone:fix/pass-language-to-tts-models

Conversation

@jannone
Copy link

@jannone jannone commented Feb 18, 2026

Summary

  • Both backends silently dropped the language parameter — it was accepted by generate() but never forwarded to the underlying Qwen3-TTS model, causing it to default to "Auto" detection which frequently confuses Portuguese for Spanish
  • Added LANGUAGE_CODE_TO_NAME mapping (ISO 639-1 → full language name) to both PyTorch and MLX backends, matching the format Qwen3-TTS expects (e.g. "pt""portuguese")
  • PyTorch backend: passes language= to generate_voice_clone()
  • MLX backend: passes lang_code= to all 4 model.generate() call sites
  • Frontend: auto-syncs the generation form's language dropdown with the selected voice profile's language via a new useEffect

Test plan

  • Select a Portuguese voice profile → language dropdown should auto-sync to Portuguese
  • Generate speech in Portuguese → output should sound Portuguese, not Spanish
  • Switch to English profile → language dropdown syncs to English, generation works normally
  • Test with other supported languages (Chinese, Japanese, etc.)
  • Check backend logs for any language-related errors

🤖 Generated with Claude Code

The language parameter was accepted by both backends' generate() methods
but never forwarded to the underlying TTS models. This caused the model
to default to "Auto" language detection, which frequently confused
Portuguese for Spanish due to lexical similarity.

- Add LANGUAGE_CODE_TO_NAME mapping (ISO 639-1 → full name) to both
  PyTorch and MLX backends, matching what Qwen3-TTS expects
- Pass language to generate_voice_clone() in PyTorch backend
- Pass lang_code to all model.generate() call sites in MLX backend
- Auto-sync generation form language dropdown with selected voice
  profile's language in FloatingGenerateBox

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Copilot AI added a commit to Patrick-DE/voicebox that referenced this pull request Feb 19, 2026
…ne#88, jamiepine#91, jamiepine#95, jamiepine#97)

Co-authored-by: Patrick-DE <14962702+Patrick-DE@users.noreply.github.com>
@jamiepine jamiepine closed this in ca74c15 Mar 13, 2026
@jamiepine
Copy link
Owner

Fixed on main in ca74c15 — both backends were silently dropping the language parameter. Applied the same approach from this PR: LANGUAGE_CODE_TO_NAME mapping + forwarding to both PyTorch (language=) and MLX (lang_code=) backends, plus the frontend profile-language sync. This was indeed the root cause of the language complaints. Thanks for the original diagnosis!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants