diff --git a/docs/packages/cli.mdx b/docs/packages/cli.mdx index 40c323c1230..b5e7de3da49 100644 --- a/docs/packages/cli.mdx +++ b/docs/packages/cli.mdx @@ -29,7 +29,7 @@ npm install -g hyperframes | Look at it, or share it | [`share`](#share), [`preview`](#preview), [`present`](#present-and-play), [`play`](#present-and-play), [`publish`](#publish), [`open`](#open-and-catch-up), [`catch-up`](#open-and-catch-up) | | Find problems | [`lint`](#lint), [`check`](#check), [`snapshot`](#snapshot), [`keyframes`](#keyframes), [`compare`](#compare-and-grade-compare), [`grade-compare`](#compare-and-grade-compare) | | Rebuild a video | [`reverse`](#reverse), [`measure`](#measure), [`diff`](#diff) | -| Edit from the terminal | [`timeline`](#timeline), [`history`](#history) | +| Edit from the terminal | [`timeline`](#timeline), [`history`](#history), [`narration`](#narration) | | Make a file | [`render`](#render), [`benchmark`](#benchmark) | | Render somewhere else | [`cloud`](#hyperframes-cloud), [`lambda`](#hyperframes-lambda), [`cloudrun`](#hyperframes-cloudrun) | | Fix your setup | [`doctor`](#doctor), [`browser`](#browser), [`update`](#update), [`upgrade`](#upgrade), [`docs`](#docs), [`info`](#info-and-compositions), [`compositions`](#info-and-compositions), [`clean`](#clean) | @@ -1993,6 +1993,45 @@ use is refused before anything is written. A refused edit, such as a move that would overlap a neighbour, writes nothing, exits 2 and says how to fix it. +### `narration` + +Keep each voice-over line, its audio clip and its captions in step. `narration.json` at the project +root is the script: each line's text, voice and audio file, and what it was last voiced from. The +clip that plays a line carries `data-narration-line=""`, and caption words can carry +`"line": ""` (untagged words are matched by their clip's time window). Each line's length and +word timings are read from media-use's `audio_meta.json` by the same id. `hyperframes lint` reports +drift between them. + +```bash +npx hyperframes narration init # adopt a voiced project (media-use's audio_meta.json, or tagged clips) +npx hyperframes narration list # each line and whether it is in sync +npx hyperframes narration check # exits 1 when voice, clips and captions drifted +npx hyperframes narration set l2 "Twenty renewals are due today." +npx hyperframes narration set l2 --dry-run # what would change, written nowhere +``` + +| Command | What it does | +| ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `init` | Write `narration.json` from media-use's `audio_meta.json` and `audio_request.json`, or from clips already tagged with `data-narration-line`, and tag each line's clip. `--force` replaces an existing file. | +| `list` | Each line with its length and its narration findings, or "in sync". | +| `check` | The narration findings from `lint`; exits 1 when any warning remains. | +| `set [text]` | Re-voice one line with Kokoro, transcribe that clip alone outside the project, then update the clip's `src` and `data-duration`, that line's caption words, `caption-overrides.json`, `narration.json` and the line's voice in `audio_meta.json` together, as one `history` entry. | + +| Flag (`set`) | Description | +| ------------- | --------------------------------------------------------------------------------- | +| `--voice` | Kokoro voice for this line | +| `--speed` | Speech speed for this line (0.1 to 3) | +| `--dry-run` | Show what would change; write nothing | +| `--no-retime` | Keep a longer take that runs into the next narration clip, instead of refusing it | +| `--force` | Re-voice even when the text, voice and WAV are unchanged | + +Every command also takes `--dir` and `--json`; `init` and `set` take `--who` (your agent name, for +the `history` entry). `set` re-voices with Kokoro only: a local voice gives the same audio for the +same text, so a re-voiced line still sounds like its neighbours. Lines voiced by a service whose +voices may not repeat are refused; re-voice all of them with media-use instead. The new take is +written as `assets/voice/-.wav` and the old file is kept, so `history undo` always finds +the audio it points back to. + ### `history` List, undo and restore the project's recorded changes. Each change is an entry diff --git a/docs/reference/lint-rules.mdx b/docs/reference/lint-rules.mdx index 86d1fe373ee..d7f7c3a8c8e 100644 --- a/docs/reference/lint-rules.mdx +++ b/docs/reference/lint-rules.mdx @@ -886,6 +886,46 @@ Source: `packages/lint/src/rules/linkedClips.ts`. **Fix:** Give every member the same `data-start`, `data-duration`, `data-media-start` and `data-playback-rate`, or remove `data-link` from all of them to unlink. +## Narration + +Source: `packages/lint/src/projectNarration.ts`. These run only when the project has a `narration.json`: the script of a narrated video, listing each voiced line's text and voice, linked to the `