Skip to content

fix azure multilingual voice language SSML#5915

Open
mustafatarim wants to merge 1 commit into
livekit:mainfrom
mustafatarim:codex/azure-tts-multilingual-lang
Open

fix azure multilingual voice language SSML#5915
mustafatarim wants to merge 1 commit into
livekit:mainfrom
mustafatarim:codex/azure-tts-multilingual-lang

Conversation

@mustafatarim
Copy link
Copy Markdown

Summary

Fix Azure TTS SSML generation for multilingual voices when the requested text language differs from the voice's primary locale.

Azure multilingual voices such as en-US-JennyMultilingualNeural can synthesize other languages, but the generated SSML currently places the requested language only on the root <speak> element while the voice itself remains cross-locale. For cross-locale multilingual synthesis, this change wraps the spoken content in <lang xml:lang="..."> and keeps the root language aligned with the voice locale.

Changes

  • Detect the primary locale from Azure voice names.
  • Wrap content with <lang xml:lang="..."> only for MultilingualNeural voices when language differs from the voice locale.
  • Preserve existing behavior when no explicit language is provided, when the voice and language locales match, or when the voice is not multilingual.
  • Add Azure TTS SSML unit tests for cross-locale multilingual and non-wrapped cases.

Validation

  • uv run pytest tests/test_plugin_azure_tts.py
  • uv run ruff check livekit-plugins/livekit-plugins-azure/livekit/plugins/azure/tts.py tests/test_plugin_azure_tts.py
  • uv run ruff format --check livekit-plugins/livekit-plugins-azure/livekit/plugins/azure/tts.py tests/test_plugin_azure_tts.py

@CLAassistant
Copy link
Copy Markdown

CLAassistant commented Jun 1, 2026

CLA assistant check
All committers have signed the CLA.

@mustafatarim mustafatarim marked this pull request as ready for review June 1, 2026 12:20
devin-ai-integration[bot]

This comment was marked as resolved.

@mustafatarim mustafatarim force-pushed the codex/azure-tts-multilingual-lang branch from a09c1af to 35294ea Compare June 1, 2026 13:23
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