Skip to content

test(measure): record T5.3 latency and word-start accuracy - #25

Open
prateekchaplot wants to merge 1 commit into
mainfrom
arch/tts/t5.3
Open

prateekchaplot wants to merge 1 commit into
mainfrom
arch/tts/t5.3

Conversation

@prateekchaplot

Copy link
Copy Markdown
Owner

What this adds

  • tests/measure.py — starts the real application (create_app) in a background
    uvicorn thread on an ephemeral port with TTS_DATA_DIR=.venv/measure-data, then drives
    generations through the public HTTP API. It records submit, first progress, first
    sentence, every per-sentence progress interval, the succeeded event, and the completed
    audio download (the point where the UI can play). It then decodes the returned WAV and
    compares each measurable word's reported start with its acoustic onset.
  • docs/MEASUREMENTS.md — the recorded run, with the hardware note, per-run latency
    table, NFR-02 and A-3 verdicts, and the manual AC7 listening checklist.

Results (this machine)

Hardware: 16 logical cores (Intel Family 6 Model 154), 15.8 GiB RAM, Windows 11 build
26300, Python 3.12.2, piper-tts 1.8.0, onnxruntime 1.32.0, CPU inference, single process.

Measure Result Target
Time-to-first-audio, 1,999 chars 2,960 ms lessac / 3,210 ms amy (first progress at ~90 ms) —
Per-sentence SSE progress p95 191 ms, median 129 ms over 234 intervals < 250 ms
Word-start deviation p95 15 ms, max 32 ms over 160 measurable onsets ±100 ms

3 texts (139 / 1,999 / 4,975 chars) × 2 voices, with the 2,000-character text repeated 3
times per voice after one warm-up generation. The app serves the finished WAV, so
time-to-first-audio equals total synthesis time; the first progress event arrives in ~90 ms
and drives the UI while the job runs.

A-3 verdict: confirmed. The ±100 ms word-start tolerance holds with a wide margin, so
tests/e2e/support/env.ts keeps WORD_START_TOLERANCE_MS = 100; no T5.1 change is needed.

Honesty about coverage

Only 160 of 3,656 word instances are measurable by signal: 3,168 are excluded because
connected speech leaves no silent gap before the word, and 491 are aligned=false by design
(FR-05 degraded path). Every exclusion is counted in the report. The automated numbers are a
signal proxy; the manual AC7 listening checklist is still pending human review and lists
8 words (0/25/50/75% through the target text, 4 per voice) to check by ear in the app.

Harness bug found while measuring

Don't convert frame indexes with a nominal 10 ms at 22,050 Hz: 220 samples is 9.977 ms, and
the resulting 0.23% scale error invented a 260 ms "late drift" at 115 s that looked exactly
like a timing defect (it also explained the sentence-4 "A" outlier from the timing-fix PR).
Frame positions now use the exact frame duration, and the drift vanished. This is documented
in the report's Method section so a future reader doesn't re-discover it the hard way.

Verification

  • python tests/measure.py --runs 3 --out docs/MEASUREMENTS.md (both voices, isolated data dir)
  • pytest tests/unit 202 passed; pytest tests/integration 16 passed
  • Ruff check + format over src/tts tests (CI scope, includes tests/measure.py)
  • strict mypy, git diff --check
  • PR CI (lint, unit ubuntu+windows, integration, e2e)

Dependent tasks: T5.2 consumes these numbers for docs/KNOWN_LIMITATIONS.md (§14.5 point 4).

tests/measure.py starts the real app on an ephemeral port against an isolated data directory and drives generations through the public HTTP API, timing submit, first progress, first sentence, every SSE progress interval, and the completed audio download. It then decodes the WAV and compares each measurable word's reported start with its acoustic onset, counting every excluded or unaligned word instead of dropping it.

docs/MEASUREMENTS.md holds the recorded run: 3 texts x 2 voices with the 2,000-character text repeated 3 times, hardware note, raw per-run latency table, NFR-02 and A-3 verdicts, and the manual AC7 listening checklist (pending human review).

Results: time-to-first-audio 2,960 ms (lessac) / 3,210 ms (amy) for 1,999 characters; per-sentence SSE p95 191 ms (target < 250 ms); word-start |deviation| p95 15 ms, max 32 ms over 160 measurable onsets, so A-3's +/-100 ms is confirmed and WORD_START_TOLERANCE_MS stays 100.
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.

1 participant