Files
VoiceStudio/backend
Palash DebnathandClaude Opus 4.8 c5ba10b20a feat(tts): inline [pause Nms] marker for silence in generated speech (#276) (#277)
Lets users insert pauses in the transcript: `[pause]` (350ms default),
`[pause 500ms]`, `[pause 1s]`, `[pause 1.5s]`. Requester confirmed the
`[pause Nms]` syntax (fits the existing marker style).

Implementation is fully opt-in and model-free:
- `omnivoice/utils/text.parse_pause_markers()` splits the text into
  `(span, pause_ms_after)` tuples (case-insensitive; bare number = ms; `s`
  suffix = seconds; adjacent markers sum; clamped to 10s). Text with no marker
  returns unchanged, so existing behavior is untouched.
- `_run_inference` synthesizes each span as today and stitches a `torch.zeros`
  silence buffer between them at the `[pause]` points (matching channel
  dims/dtype/device); DSP/mastering then runs once over the combined audio.
  An explicit overall `duration` isn't split across spans (left to the model
  per span).

Tests (no TTS model loaded): tests/test_pause_markers.py covers the parser
(ms/s/default/clamp/leading/trailing/adjacent/round-trip) and the silence
stitching with a fake gen fn (lengths + zeroed regions). Full pause + CJK guard
+ router smoke suites pass (39).

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-04 08:01:29 +05:30
..
2026-06-03 10:45:25 +05:30