Enforce TTS provider contracts #43

Merged
lost-rob0t merged 1 commit from fix/zara-010-tts-contracts into fix/zara-009-memory-fallback 2026-07-19 01:34:31 +00:00
lost-rob0t commented 2026-07-18 23:41:15 +00:00 (Migrated from github.com)

What

  • define structured synthesis and playback results with explicit WAV/MP3 provider contracts
  • make Piper emit a WAV container, validate empty/invalid audio, and route MP3 through mpv
  • add Qwen connection/read/total timeouts and deterministic HTTP/file/client cleanup
  • bound every provider with a total timeout and clean subprocesses, temporary files, SDK clients, and sessions on normal, error, and cancellation paths
  • enforce replace/cancel single-flight playback and surface the latest playback status

Why

Providers returned incompatible byte formats, Qwen could hang and leak file handles, and replacement utterances could overlap an earlier synthesis or player. Failures were logged without a structured result for callers.

Impact

Every enabled provider now yields declared playable audio or a bounded actionable failure. Playback follows one canonical lifecycle and a new utterance fully stops the prior one before starting.

Validation

  • nix develop -c scripts/test-tts.sh
  • nix develop -c bash -c 'pytest && for test_script in scripts/test-*.sh; do bash "$test_script"; done'
  • nix build

Closes #11

## What - define structured synthesis and playback results with explicit WAV/MP3 provider contracts - make Piper emit a WAV container, validate empty/invalid audio, and route MP3 through `mpv` - add Qwen connection/read/total timeouts and deterministic HTTP/file/client cleanup - bound every provider with a total timeout and clean subprocesses, temporary files, SDK clients, and sessions on normal, error, and cancellation paths - enforce replace/cancel single-flight playback and surface the latest playback status ## Why Providers returned incompatible byte formats, Qwen could hang and leak file handles, and replacement utterances could overlap an earlier synthesis or player. Failures were logged without a structured result for callers. ## Impact Every enabled provider now yields declared playable audio or a bounded actionable failure. Playback follows one canonical lifecycle and a new utterance fully stops the prior one before starting. ## Validation - `nix develop -c scripts/test-tts.sh` - `nix develop -c bash -c 'pytest && for test_script in scripts/test-*.sh; do bash "$test_script"; done'` - `nix build` Closes #11
Sign in to join this conversation.
No description provided.