chore(voice): report real wav duration, ignoring a streaming placeholder header#27
Merged
Conversation
…der header fish.audio streams the wav and writes a placeholder/oversized data-chunk size in the header (the final length isn't known up front), so wav_seconds trusting getnframes() reported a bogus constant (~48695s) — pinning the synth log's rtf to 0.00 and making "is TTS real-time?" unreadable. Measure the PCM actually on disk (readframes stops at EOF) so the duration is real regardless of the header. Verified: a real fish.audio clip now reports ~3.7s. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
wav_secondsreported a bogus, constant duration (~48695s seen in the dev log)for every remote synth, which pinned the
synthlog'srtfto0.00— making"is TTS keeping up with real time?" unreadable.
Root cause: fish.audio streams the wav and can't know the final length up
front, so it writes a placeholder/oversized data-chunk size (
0xFFFFFFFF) in theheader.
wave.getnframes()trusts that placeholder → a huge, clip-independentframe count.
48695.77 × 44100 ≈ 0xFFFFFFFF / 2frames confirms it.Fix: measure the PCM actually on disk (
readframesstops at EOF) instead oftrusting the header's declared frame count, so the duration is real regardless of
what the header claims.
Verification
0xFFFFFFFFstillreports its true 2.0s (regression test).
so
rtfis meaningful again.Scope
Pure observability fix (dev-log
audio_s/rtf) — no runtime behavior change.Independent of the cold-start PRs (#24/#25/#26); branches off
main.AI coding brief
synthevents showedaudio_s=48695.77 rtf=0.00on every clip — obviouslywrong. User asked to fix this log bug first.
analysis the user asked for.
vary with text length) — a fast way to spot "reading a header field, not the
data." Worth checking derived metrics against a couple of different inputs
before trusting them in an analysis.
🤖 Generated with Claude Code