Repository navigation
fix(timing): keep boundary phoneme samples so word starts match audio - #24
Merged
Merged
Conversation
The engine dropped piper's BOS/EOS/pad alignments, discarding the sample counts that represent a sentence's leading and trailing silence. Reconcile then placed every word early by the leading silence and ended the last word before the trailing silence, so highlights led the voice by 60-320 ms and AC7's 100 ms target failed. Keep every alignment entry. reconcile already skips boundary phonemes when matching words while still advancing its sample cursor by their durations, and alignment counts now sum exactly to len(samples). T5.3 measured the defect. Dependent tasks: T1.2, T1.3, T5.1, T5.3.
Corrected word timings now begin at the first audible word instead of zero, so the first SRT/VTT cue starts inside piper's leading silence. Assert the cue begins at or after the file start and within 1 s, keeping the monotonic and in-audio checks. Verified with the full local suite (15/15).
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.
Problem
engine/piper_engine.pydropped piper's BOS/EOS/pad (^,$,_) alignments, whichdiscarded the sample counts for a sentence's leading and trailing silence.
timing/reconcile.pyalready skips those phonemes for word matching but still advances its sample cursor by their
durations, so every word was placed early by the leading silence and the last word ended before
the trailing silence.
Measured on the two test voices while preparing T5.3: reported first-word starts ran 60-320 ms
ahead of the acoustic onset (240-320 ms on
en_US-amy-medium), so AC7's +/-100 ms target could nothold. Keeping the boundary entries brings the same sentences to roughly +/-25 ms.
Change
_chunk_alignmentsnow returns every entry, boundary markers included; the now-unused_BOUNDARY_PHONEMESconstant is removed.SentenceAudio.phoneme_alignmentsin ARCHITECTURE section 7.2 is documented as includingboundary markers, with counts that sum to
len(samples)(shared-file protocol, section 14.4).This also makes section 14.5 point 1's assertion true.
leading silence offsets word starts. The integration test now asserts the counts sum exactly to
the sentence sample count.
docs/TASKS.mdrecords the finding and the dependent tasks.Dependent tasks: T1.2, T1.3, T5.1 (AC7 tolerance), T5.3.
Verification
en_US-lessac-mediumwithTTS_DATA_DIR=.venv/tts-datagit diff --checkseven sentences on both voices (two outliers remain where the first token is unaligned and the
next word is measured; T5.3 will report those honestly)