caption-alignlisted
Install: claude install-skill vaibhav-barman/live-clipper
# CAPTION ALIGN — the right words on the right frames
> **THE JOB:** three clocks are in play — the source stream, the concatenated cut, and the delivered
> render — and every caption bug in the original project came from reading a time off the wrong one.
> **Derive from the source, align to the render, audit against the waveform.**
Adapted from the creator's skill. **Kept:** the three-clock model, the pipeline, every run rule and its
reason, the pause audit. **Changed:** the cut map is `cut.json` (pieces `a`, `dur`) at 30 fps, the
envelope is the Demucs voice stem, and there are rules for second voices and profanity.
## The pipeline
```
source word times ──(cut.json map)──► caption frames ──(wav2vec2 force-align)──► final anchors
│ │
└──────► RMS pause audit ◄───────────────┘
```
## Step 1 — derive from SOURCE, never from a re-transcribed cut
```py
def tl(src_sec, pieces, fps=30): # source seconds -> output frame
t_out = 0.0
for p in pieces: # pieces from cut.json, in output order
if p["a"] - 1/fps <= src_sec < p["a"] + p["dur"]:
return round((t_out + (src_sec - p["a"])) * fps)
t_out += p["dur"]
return None # word was cut — must not be captioned
```
**Why:** per-piece `-ss/-t` rounds independently, so a re-transcribed cut and the true map diverge at
every