Skip to content

feat(tts): forward language parameter to TTS engine#1773

Merged
jundot merged 1 commit into
jundot:mainfrom
apetersson:feat/tts-language-forward
Jun 10, 2026
Merged

feat(tts): forward language parameter to TTS engine#1773
jundot merged 1 commit into
jundot:mainfrom
apetersson:feat/tts-language-forward

Conversation

@apetersson

Copy link
Copy Markdown
Contributor

The OpenAI-compatible /v1/audio/speech endpoint accepts an optional 'language' field (e.g. 'german', 'english') but it was silently dropped — AudioSpeechRequest had no language field, TTSEngine never received it, and the upstream Qwen3-TTS model fell back to lang_code "auto".

  • Add language field to AudioSpeechRequest
  • Accept and forward language in TTSEngine.synthesize() and stream_synthesize_pcm(), mapped to lang_code for Qwen3-TTS models
  • Pass request.language in audio_routes.py for all three call sites: native streaming, segmented fallback, and non-streaming synthesis
  • Log language in all TTS log lines

The OpenAI-compatible /v1/audio/speech endpoint accepts an optional
'language' field (e.g. 'german', 'english') but it was silently
dropped — AudioSpeechRequest had no language field, TTSEngine never
received it, and the upstream Qwen3-TTS model fell back to lang_code
"auto".

- Add language field to AudioSpeechRequest
- Accept and forward language in TTSEngine.synthesize() and
  stream_synthesize_pcm(), mapped to lang_code for Qwen3-TTS models
- Pass request.language in audio_routes.py for all three call sites:
  native streaming, segmented fallback, and non-streaming synthesis
- Log language in all TTS log lines
@jundot

jundot commented Jun 10, 2026

Copy link
Copy Markdown
Owner

Thanks for the PR. The request and route-level forwarding look correct, and mapping the API language field to mlx-audio lang_code is the right backend hook for Qwen3-TTS and the other TTS models that expose lang_code.

One compatibility detail I noticed is that adding language before speed changes positional TTSEngine.synthesize() and stream_synthesize_pcm() callers. This looks good to me, and I am going to merge it; I will fold that signature-ordering fix and a focused passthrough test into a follow-up.

@jundot jundot merged commit be758c7 into jundot:main Jun 10, 2026
4 checks passed
@apetersson

Copy link
Copy Markdown
Contributor Author

just a gotcha to note: not all models treat the language parameter the same. some want language like "english" or "german" some want it like "en" "de.

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