Skip to content

soniox: add reduce_silence option to TTS - #6798

Open
razvanvoica wants to merge 2 commits into
livekit:mainfrom
razvanvoica:soniox-tts-reduce-silence
Open

soniox: add reduce_silence option to TTS#6798
razvanvoica wants to merge 2 commits into
livekit:mainfrom
razvanvoica:soniox-tts-reduce-silence

Conversation

@razvanvoica

@razvanvoica razvanvoica commented Aug 11, 2026

Copy link
Copy Markdown

Summary

Soniox TTS v2 (tts-rt-v2) supports a reduce_silence parameter that shortens the pauses between words, independently of speed (docs). This PR exposes it on soniox.TTS:

  • new reduce_silence: bool = False constructor argument
  • supported in update_options() as well
  • the flag is only included in the WebSocket config message when enabled, so existing configurations produce byte-identical config messages

The server validates model support itself (supports_silence_reduction in the models listing) and returns invalid_request on models that lack it, so no client-side model gating is needed.

Test plan

  • test_reduce_silence_propagates_to_options covers the constructor default, update_options, and the constructor opt-in
  • existing Soniox TTS tests pass unchanged
  • verified manually against the Soniox EU REST endpoint (which shares the config schema per the API reference) with tts-rt-v2: reduce_silence: true accepted and audibly effective

Soniox TTS v2 (tts-rt-v2) supports the reduce_silence parameter, which
shortens the pauses between words independently of the speed parameter.
Expose it on soniox.TTS via the constructor and update_options.

The flag is only sent in the WebSocket config message when enabled, so
existing configurations produce byte-identical config messages. The
server validates model support (supports_silence_reduction) and rejects
it on models that lack it, per the Soniox API reference.
@razvanvoica
razvanvoica requested a review from a team as a code owner August 11, 2026 19:56
@CLAassistant

CLAassistant commented Aug 11, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 1 additional finding.

Open in Devin Review

@chenghao-mou chenghao-mou left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for the PR! left one data validation comment.

@@ -88,6 +88,7 @@ def __init__(
sample_rate: int = DEFAULT_SAMPLE_RATE,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only supported on models with supports_silence_reduction: true - see List models. Setting it to true on any other model returns an invalid_request error. See Reduce silence.

we should validate the model option here when it is True.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in da9b084 - added a _validate_reduce_silence() check that raises ValueError from both the constructor and update_options (validated against the effective model/flag combination there, before any state is mutated). Implemented as a blocklist of the models that report supports_silence_reduction: false in the List models API (tts-rt-v1, tts-rt-v1-preview), so future models keep working without a plugin update and the server stays the final validator for unknown models. Covered by a new test, and updated the existing one which was enabling reduce_silence on the default v1-preview model.

Per review feedback: reduce_silence is only accepted on models that
report supports_silence_reduction in the List models API, so raise a
ValueError from the constructor and update_options instead of letting
the server return invalid_request mid-session. Known unsupported models
(tts-rt-v1, tts-rt-v1-preview) are blocklisted so future models keep
working without a plugin update.
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.

3 participants