Repository navigation
feat(lint): detect narration drift against narration.json - #8939
Open
DhanushMurugesanG wants to merge 2 commits into
Open
DhanushMurugesanG wants to merge 2 commits into
DhanushMurugesanG wants to merge 2 commits into
Conversation
Adds two subpaths that later narration work builds on. No behaviour changes: nothing imports them yet. - @hyperframes/parsers/narration: reads, checks and writes narration.json, the script of a narrated project (each line's text, voice, audio file and what it was last voiced from), keeping unknown keys. Lengths and word timings are not copied into it: narrationTimingsOf() reads them from media-use's audio_meta.json by line id. - @hyperframes/parsers/caption-array: finds const/let/var `script` and `TRANSCRIPT` caption arrays in HTML, reads their words, and splices or shifts words while every other element stays byte-identical. Refs heygen-com#6708
A project with narration.json now gets a warning when a line's text, voice or WAV changed since it was voiced, when a line has no linked clip or its clip is the wrong length, and when the caption words that show it no longer match its voice. Captions that read differently from the script get an info. No manifest, no findings, and nothing blocks a render. Lengths and word timings come from media-use's audio_meta.json by line id. Without it, the length isn't checked and a line's captions only need to fall inside its clip. Refs heygen-com#6708
5 tasks done
Preview approval requiredThis pull request comes from a fork, so Mintlify won't build a preview until someone with write access approves commit |
This was referenced Nov 26, 2026
This branch has not been deployed
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.
Part 2 of 4 for linked narration (#6708). Builds on #8938: until that merges, this PR also shows its commit. Only the last commit (
feat(lint): …) is new here.What
When a project has a
narration.json,hyperframes lint(andcheck) now warns about drift between the script, the audio and the captions:narration_manifest_invalidnarration.jsonisn't validnarration_line_unlinked<audio data-narration-line>clip, or more than one; or a clip names an unknown linenarration_audio_stalenarration_clip_timing_mismatchaudio_meta.jsonsays the voice lastsnarration_captions_out_of_syncnarration_transcript_mismatchNo
narration.json, no findings. Everything is a warning or info, so drift never blocks a render. This part is read-only.Why
It's useful on its own: an agent or a person editing a narrated project learns that a line's voice no longer says its text, or that captions slipped, before rendering.
Related work
Refs #6708. Follows #8938; next are
narration list/init/checkandnarration set.How
packages/lint/src/projectNarration.tstakes the main timeline's audio clips and the caption array's words in global time.project.tsaddsdata-narration-lineto the audio spans it already collects, and records each mounted file's origin, so captions in a nested scene are placed at the scene's start."line": "<id>", or else the untagged words inside its clip's time window, so captions made before this existed still work.audio_meta.jsonby line id (see feat(parsers): narration.json model and caption-array reader #8938 for why they aren't copied intonarration.json), and only when its entry describes the line's own audio file. Without it, the length isn't checked, and a tagged caption word only has to start inside its clip.Test plan
projectNarration.test.ts, 13 cases on real projects throughlintProject. No manifest; in sync; invalid manifest; text, voice and WAV changes; missing WAV; unlinked lines and clips; length within and past 0.05 s; shifted and missing caption words; noaudio_meta.json; anaudio_meta.jsonentry for another file; untagged words; captions in a mounted scene; transcript mismatch as info.bun run --filter @hyperframes/lint test: 33 files, 1,379 tests pass.docs/reference/lint-rules.mdx.